Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2483)

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/pageinfo/WebsiteSettingsPopup.java

Issue 2476533002: Android: Remove unnecessary members from WebsiteSettingsPopup (Closed)
Patch Set: Null check Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/android/java/src/org/chromium/chrome/browser/ssl/SecurityStateModel.java » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/android/java/src/org/chromium/chrome/browser/pageinfo/WebsiteSettingsPopup.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/pageinfo/WebsiteSettingsPopup.java b/chrome/android/java/src/org/chromium/chrome/browser/pageinfo/WebsiteSettingsPopup.java
index 9f0cc2b6cfb9994d62c56c92d9ebf09122dc07d0..743555e94cba9078d60baeb7afe5b4dc3abaebfd 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/pageinfo/WebsiteSettingsPopup.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/pageinfo/WebsiteSettingsPopup.java
@@ -66,7 +66,6 @@ import org.chromium.chrome.browser.ssl.SecurityStateModel;
import org.chromium.chrome.browser.tab.Tab;
import org.chromium.chrome.browser.util.UrlUtilities;
import org.chromium.components.location.LocationUtils;
-import org.chromium.components.security_state.ConnectionSecurityLevel;
import org.chromium.content.browser.ContentViewCore;
import org.chromium.content_public.browser.WebContents;
import org.chromium.content_public.browser.WebContentsObserver;
@@ -286,12 +285,6 @@ public class WebsiteSettingsPopup implements OnClickListener {
// The security level of the page (a valid ConnectionSecurityLevel).
private int mSecurityLevel;
- // Whether the security level of the page was downgraded due to SHA-1.
- private boolean mDeprecatedSHA1Present;
-
- // Whether the security level of the page was downgraded due to passive mixed content.
- private boolean mPassiveMixedContentPresent;
-
// Permissions available to be displayed in mPermissionsList.
private List<PageInfoPermissionEntry> mDisplayedPermissions;
@@ -380,6 +373,45 @@ public class WebsiteSettingsPopup implements OnClickListener {
// Hide the permissions list for sites with no permissions.
setVisibilityOfPermissionsList(false);
+ // Work out the URL and connection message and status visibility.
+ mFullUrl = mWebContents.getVisibleUrl();
+ if (isShowingOfflinePage()) {
+ mFullUrl = OfflinePageUtils.stripSchemeFromOnlineUrl(mFullUrl);
+ }
+
+ try {
+ mParsedUrl = new URI(mFullUrl);
+ mIsInternalPage = UrlUtilities.isInternalScheme(mParsedUrl);
+ } catch (URISyntaxException e) {
+ mParsedUrl = null;
+ mIsInternalPage = false;
+ }
+ mSecurityLevel = SecurityStateModel.getSecurityLevelForWebContents(mWebContents);
+
+ SpannableStringBuilder urlBuilder = new SpannableStringBuilder(mFullUrl);
+ OmniboxUrlEmphasizer.emphasizeUrl(urlBuilder, mContext.getResources(), mProfile,
+ mSecurityLevel, mIsInternalPage, true, true);
+ mUrlTitle.setText(urlBuilder);
+
+ if (mParsedUrl == null || mParsedUrl.getScheme() == null
+ || !(mParsedUrl.getScheme().equals("http")
+ || mParsedUrl.getScheme().equals("https"))) {
+ mSiteSettingsButton.setVisibility(View.GONE);
+ }
+
+ if (isShowingOfflinePage()) {
+ boolean isConnected = OfflinePageUtils.isConnected();
+ RecordHistogram.recordBooleanHistogram(
+ "OfflinePages.WebsiteSettings.OpenOnlineButtonVisible", isConnected);
+ if (!isConnected) mOpenOnlineButton.setVisibility(View.GONE);
+ } else {
+ mOpenOnlineButton.setVisibility(View.GONE);
+ }
+
+ mInstantAppIntent = mIsInternalPage ? null
+ : InstantAppsHandler.getInstance().getInstantAppIntentForUrl(mFullUrl);
+ if (mInstantAppIntent == null) mInstantAppButton.setVisibility(View.GONE);
+
// Create the dialog.
mDialog = new Dialog(mContext) {
private void superDismiss() {
@@ -457,47 +489,6 @@ public class WebsiteSettingsPopup implements OnClickListener {
}
});
- // Work out the URL and connection message and status visibility.
- mFullUrl = mWebContents.getVisibleUrl();
- if (isShowingOfflinePage()) {
- mFullUrl = OfflinePageUtils.stripSchemeFromOnlineUrl(mFullUrl);
- }
-
- try {
- mParsedUrl = new URI(mFullUrl);
- mIsInternalPage = UrlUtilities.isInternalScheme(mParsedUrl);
- } catch (URISyntaxException e) {
- mParsedUrl = null;
- mIsInternalPage = false;
- }
- mSecurityLevel = SecurityStateModel.getSecurityLevelForWebContents(mWebContents);
- mDeprecatedSHA1Present = SecurityStateModel.isDeprecatedSHA1Present(mWebContents);
- mPassiveMixedContentPresent = SecurityStateModel.isPassiveMixedContentPresent(mWebContents);
-
- SpannableStringBuilder urlBuilder = new SpannableStringBuilder(mFullUrl);
- OmniboxUrlEmphasizer.emphasizeUrl(urlBuilder, mContext.getResources(), mProfile,
- mSecurityLevel, mIsInternalPage, true, true);
- mUrlTitle.setText(urlBuilder);
-
- if (mParsedUrl == null || mParsedUrl.getScheme() == null
- || !(mParsedUrl.getScheme().equals("http")
- || mParsedUrl.getScheme().equals("https"))) {
- mSiteSettingsButton.setVisibility(View.GONE);
- }
-
- if (isShowingOfflinePage()) {
- boolean isConnected = OfflinePageUtils.isConnected();
- RecordHistogram.recordBooleanHistogram(
- "OfflinePages.WebsiteSettings.OpenOnlineButtonVisible", isConnected);
- if (!isConnected) mOpenOnlineButton.setVisibility(View.GONE);
- } else {
- mOpenOnlineButton.setVisibility(View.GONE);
- }
-
- mInstantAppIntent = mIsInternalPage ? null
- : InstantAppsHandler.getInstance().getInstantAppIntentForUrl(mFullUrl);
- if (mInstantAppIntent == null) mInstantAppButton.setVisibility(View.GONE);
-
showDialog();
}
@@ -530,11 +521,8 @@ public class WebsiteSettingsPopup implements OnClickListener {
* HTTPS connections.
*/
private boolean isConnectionDetailsLinkVisible() {
- // TODO(tsergeant): If this logic gets any more complicated from additional deprecations,
- // change it to use something like |SchemeIsCryptographic|.
- return mContentPublisher == null && !mIsInternalPage
- && (mSecurityLevel != ConnectionSecurityLevel.NONE || mPassiveMixedContentPresent
- || mDeprecatedSHA1Present);
+ return mContentPublisher == null && !isShowingOfflinePage() && mParsedUrl != null
+ && mParsedUrl.getScheme() != null && mParsedUrl.getScheme().equals("https");
}
private boolean hasAndroidPermission(int contentSettingType) {
« no previous file with comments | « no previous file | chrome/android/java/src/org/chromium/chrome/browser/ssl/SecurityStateModel.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698