Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
halo
packages_apps_Browser
Commits
ab448ac1
Commit
ab448ac1
authored
13 years ago
by
Steve Block
Committed by
Android (Google) Code Review
13 years ago
Browse files
Options
Download
Plain Diff
Merge "Rename Tab.LockIcon to Tab.SecurityState"
parents
5e65609a
2466effd
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
49 additions
and
41 deletions
+49
-41
src/com/android/browser/BaseUi.java
src/com/android/browser/BaseUi.java
+11
-11
src/com/android/browser/Controller.java
src/com/android/browser/Controller.java
+1
-1
src/com/android/browser/PageDialogsHandler.java
src/com/android/browser/PageDialogsHandler.java
+1
-1
src/com/android/browser/PreloadController.java
src/com/android/browser/PreloadController.java
+2
-2
src/com/android/browser/Tab.java
src/com/android/browser/Tab.java
+33
-25
src/com/android/browser/WebViewController.java
src/com/android/browser/WebViewController.java
+1
-1
No files found.
src/com/android/browser/BaseUi.java
View file @
ab448ac1
...
...
@@ -49,7 +49,7 @@ import android.widget.ImageButton;
import
android.widget.LinearLayout
;
import
android.widget.Toast
;
import
com.android.browser.Tab.
LockIcon
;
import
com.android.browser.Tab.
SecurityState
;
import
com.android.internal.view.menu.MenuBuilder
;
import
java.util.List
;
...
...
@@ -81,8 +81,8 @@ public abstract class BaseUi implements UI {
protected
Tab
mActiveTab
;
private
InputMethodManager
mInputManager
;
private
Drawable
m
Sec
LockIcon
;
private
Drawable
m
Mix
LockIcon
;
private
Drawable
mLockIcon
Secure
;
private
Drawable
mLockIcon
Mixed
;
protected
Drawable
mGenericFavicon
;
protected
FrameLayout
mContentView
;
...
...
@@ -115,8 +115,8 @@ public abstract class BaseUi implements UI {
Resources
res
=
mActivity
.
getResources
();
mInputManager
=
(
InputMethodManager
)
browser
.
getSystemService
(
Activity
.
INPUT_METHOD_SERVICE
);
m
Sec
LockIcon
=
res
.
getDrawable
(
R
.
drawable
.
ic_secure_holo_dark
);
m
Mix
LockIcon
=
res
.
getDrawable
(
R
.
drawable
.
ic_secure_partial_holo_dark
);
mLockIcon
Secure
=
res
.
getDrawable
(
R
.
drawable
.
ic_secure_holo_dark
);
mLockIcon
Mixed
=
res
.
getDrawable
(
R
.
drawable
.
ic_secure_partial_holo_dark
);
FrameLayout
frameLayout
=
(
FrameLayout
)
mActivity
.
getWindow
()
.
getDecorView
().
findViewById
(
android
.
R
.
id
.
content
);
...
...
@@ -590,19 +590,19 @@ public abstract class BaseUi implements UI {
*/
protected
void
updateLockIconToLatest
(
Tab
t
)
{
if
(
t
!=
null
&&
t
.
inForeground
())
{
updateLockIconImage
(
t
.
get
LockIconTyp
e
());
updateLockIconImage
(
t
.
get
SecurityStat
e
());
}
}
/**
* Updates the lock-icon image in the title-bar.
*/
private
void
updateLockIconImage
(
LockIcon
lockIconTyp
e
)
{
private
void
updateLockIconImage
(
SecurityState
securityStat
e
)
{
Drawable
d
=
null
;
if
(
lockIconType
==
LockIcon
.
LOCK_ICON
_SECURE
)
{
d
=
m
Sec
LockIcon
;
}
else
if
(
lockIconType
==
LockIcon
.
LOCK_ICON
_MIXED
)
{
d
=
m
Mix
LockIcon
;
if
(
securityState
==
SecurityState
.
SECURITY_STATE
_SECURE
)
{
d
=
mLockIcon
Secure
;
}
else
if
(
securityState
==
SecurityState
.
SECURITY_STATE
_MIXED
)
{
d
=
mLockIcon
Mixed
;
}
mNavigationBar
.
setLock
(
d
);
}
...
...
This diff is collapsed.
Click to expand it.
src/com/android/browser/Controller.java
View file @
ab448ac1
...
...
@@ -880,7 +880,7 @@ public class Controller
}
@Override
public
void
onUpdated
LockIcon
(
Tab
tab
)
{
public
void
onUpdated
SecurityState
(
Tab
tab
)
{
mUi
.
onTabDataChanged
(
tab
);
}
...
...
This diff is collapsed.
Click to expand it.
src/com/android/browser/PageDialogsHandler.java
View file @
ab448ac1
...
...
@@ -98,7 +98,7 @@ public class PageDialogsHandler {
mHttpAuthenticationDialog
.
setCancelListener
(
new
HttpAuthenticationDialog
.
CancelListener
()
{
public
void
onCancel
()
{
handler
.
cancel
();
mController
.
onUpdated
LockIcon
(
tab
);
mController
.
onUpdated
SecurityState
(
tab
);
mHttpAuthenticationDialog
=
null
;
}
});
...
...
This diff is collapsed.
Click to expand it.
src/com/android/browser/PreloadController.java
View file @
ab448ac1
...
...
@@ -209,8 +209,8 @@ public class PreloadController implements WebViewController {
}
@Override
public
void
onUpdated
LockIcon
(
Tab
tab
)
{
if
(
LOGD_ENABLED
)
Log
.
d
(
LOGTAG
,
"onUpdated
LockIcon
()"
);
public
void
onUpdated
SecurityState
(
Tab
tab
)
{
if
(
LOGD_ENABLED
)
Log
.
d
(
LOGTAG
,
"onUpdated
SecurityState
()"
);
}
@Override
...
...
This diff is collapsed.
Click to expand it.
src/com/android/browser/Tab.java
View file @
ab448ac1
...
...
@@ -112,10 +112,17 @@ class Tab implements PictureListener {
sAlphaPaint
.
setColor
(
Color
.
TRANSPARENT
);
}
public
enum
LockIcon
{
LOCK_ICON_UNSECURE
,
LOCK_ICON_SECURE
,
LOCK_ICON_MIXED
,
public
enum
SecurityState
{
// The page does not use SSL.
SECURITY_STATE_NOT_SECURE
,
// The page uses SSL, the certificate is good and all elements are secure.
SECURITY_STATE_SECURE
,
// The page uses SSL and the certificate is good, but some elements are insecure.
SECURITY_STATE_MIXED
,
// TODO: Add SECURITY_STATE_BAD_CERTIFICATE
// See http://b/5403366
// The page uses SSL but there is a problem with the certificate.
//SECURITY_STATE_BAD_CERTIFICATE,
}
Context
mContext
;
...
...
@@ -198,7 +205,7 @@ class Tab implements PictureListener {
String
mUrl
;
String
mOriginalUrl
;
String
mTitle
;
LockIcon
mLockIcon
;
SecurityState
mSecurityState
;
Bitmap
mFavicon
;
boolean
mIsBookmarkedSite
=
false
;
boolean
mIncognito
=
false
;
...
...
@@ -213,7 +220,7 @@ class Tab implements PictureListener {
mTitle
=
c
.
getString
(
R
.
string
.
new_tab
);
}
mFavicon
=
null
;
m
LockIcon
=
LockIcon
.
LOCK_ICON_UN
SECURE
;
m
SecurityState
=
SecurityState
.
SECURITY_STATE_NOT_
SECURE
;
}
PageState
(
Context
c
,
boolean
incognito
,
String
url
,
Bitmap
favicon
)
{
...
...
@@ -221,9 +228,9 @@ class Tab implements PictureListener {
mOriginalUrl
=
mUrl
=
url
;
mTitle
=
null
;
if
(
URLUtil
.
isHttpsUrl
(
url
))
{
m
LockIcon
=
LockIcon
.
LOCK_ICON
_SECURE
;
m
SecurityState
=
SecurityState
.
SECURITY_STATE
_SECURE
;
}
else
{
m
LockIcon
=
LockIcon
.
LOCK_ICON_UN
SECURE
;
m
SecurityState
=
SecurityState
.
SECURITY_STATE_NOT_
SECURE
;
}
mFavicon
=
favicon
;
}
...
...
@@ -640,21 +647,22 @@ class Tab implements PictureListener {
}
/**
* Updates the lock icon. This method is called when we discover another
* resource to be loaded for this page (for example, javascript). While
* we update the icon type, we do not update the lock icon itself until
* we are done loading, it is slightly more secure this way.
* Updates the security state. This method is called when we discover
* another resource to be loaded for this page (for example,
* javascript). While we update the security state, we do not update
* the lock icon until we are done loading, as it is slightly more
* secure this way.
*/
@Override
public
void
onLoadResource
(
WebView
view
,
String
url
)
{
if
(
url
!=
null
&&
url
.
length
()
>
0
)
{
// It is only if the page claims to be secure that we may have
// to update the
lock
:
if
(
mCurrentState
.
m
LockIcon
==
LockIcon
.
LOCK_ICON
_SECURE
)
{
// If NOT a 'safe' url, change the
lock
to mixed content!
// to update the
security state
:
if
(
mCurrentState
.
m
SecurityState
==
SecurityState
.
SECURITY_STATE
_SECURE
)
{
// If NOT a 'safe' url, change the
state
to mixed content!
if
(!(
URLUtil
.
isHttpsUrl
(
url
)
||
URLUtil
.
isDataUrl
(
url
)
||
URLUtil
.
isAboutUrl
(
url
)))
{
mCurrentState
.
m
LockIcon
=
LockIcon
.
LOCK_ICON
_MIXED
;
mCurrentState
.
m
SecurityState
=
SecurityState
.
SECURITY_STATE
_MIXED
;
}
}
}
...
...
@@ -755,7 +763,7 @@ class Tab implements PictureListener {
final
SslErrorHandler
handler
,
final
SslError
error
)
{
if
(!
mInForeground
)
{
handler
.
cancel
();
set
LockIconType
(
LockIcon
.
LOCK_ICON_UN
SECURE
);
set
SecurityState
(
SecurityState
.
SECURITY_STATE_NOT_
SECURE
);
return
;
}
if
(
mSettings
.
showSecurityWarnings
())
{
...
...
@@ -793,7 +801,7 @@ class Tab implements PictureListener {
@Override
public
void
onCancel
(
DialogInterface
dialog
)
{
handler
.
cancel
();
set
LockIconType
(
LockIcon
.
LOCK_ICON_UN
SECURE
);
set
SecurityState
(
SecurityState
.
SECURITY_STATE_NOT_
SECURE
);
mWebViewController
.
onUserCanceledSsl
(
Tab
.
this
);
}
})
...
...
@@ -900,7 +908,7 @@ class Tab implements PictureListener {
if
(!
URLUtil
.
isHttpsUrl
(
mCurrentState
.
mUrl
))
{
// In case we stop when loading an HTTPS page from an HTTP page
// but before a provisional load occurred
mCurrentState
.
m
LockIcon
=
LockIcon
.
LOCK_ICON_UN
SECURE
;
mCurrentState
.
m
SecurityState
=
SecurityState
.
SECURITY_STATE_NOT_
SECURE
;
}
mCurrentState
.
mIncognito
=
view
.
isPrivateBrowsingEnabled
();
}
...
...
@@ -1881,16 +1889,16 @@ class Tab implements PictureListener {
return
mErrorConsole
;
}
private
void
set
LockIconType
(
LockIcon
icon
)
{
mCurrentState
.
m
LockIcon
=
icon
;
mWebViewController
.
onUpdated
LockIcon
(
this
);
private
void
set
SecurityState
(
SecurityState
securityState
)
{
mCurrentState
.
m
SecurityState
=
securityState
;
mWebViewController
.
onUpdated
SecurityState
(
this
);
}
/**
* @return The tab's
lock icon typ
e.
* @return The tab's
security stat
e.
*/
LockIcon
getLockIconTyp
e
()
{
return
mCurrentState
.
m
LockIcon
;
SecurityState
getSecurityStat
e
()
{
return
mCurrentState
.
m
SecurityState
;
}
int
getLoadProgress
()
{
...
...
This diff is collapsed.
Click to expand it.
src/com/android/browser/WebViewController.java
View file @
ab448ac1
...
...
@@ -95,7 +95,7 @@ public interface WebViewController {
boolean
shouldShowErrorConsole
();
void
onUpdated
LockIcon
(
Tab
tab
);
void
onUpdated
SecurityState
(
Tab
tab
);
void
openFileChooser
(
ValueCallback
<
Uri
>
uploadMsg
,
String
acceptType
);
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment