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

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

Issue 1100283002: Add connection info popup within Page Info on Android. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Review comments Created 5 years, 8 months 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
Index: chrome/android/java/src/org/chromium/chrome/browser/WebsiteSettingsPopup.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/WebsiteSettingsPopup.java b/chrome/android/java/src/org/chromium/chrome/browser/WebsiteSettingsPopup.java
index 599420e66c5c93ccda9ed5e96fe0f6aaaff0a705..897a48138dfc2e7a58ad19036c6761e5ab74a91a 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/WebsiteSettingsPopup.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/WebsiteSettingsPopup.java
@@ -15,6 +15,7 @@ import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.text.Layout;
import android.text.Spannable;
+import android.text.SpannableString;
import android.text.SpannableStringBuilder;
import android.text.style.ForegroundColorSpan;
import android.text.style.StyleSpan;
@@ -383,6 +384,7 @@ public class WebsiteSettingsPopup implements OnClickListener, OnItemSelectedList
// Set the URL connection message now, and the URL after layout (so it
// can calculate its ideal height).
mUrlConnectionMessage.setText(getUrlConnectionMessage());
+ if (isConnectionDetailsLinkVisible()) mUrlConnectionMessage.setOnClickListener(this);
}
/**
@@ -454,6 +456,14 @@ public class WebsiteSettingsPopup implements OnClickListener, OnItemSelectedList
}
/**
+ * Whether to show a 'Details' link to the connection info popup. The link is only shown for
+ * HTTPS connections.
+ */
+ private boolean isConnectionDetailsLinkVisible() {
+ return !mIsInternalPage && mSecurityLevel != ToolbarModelSecurityLevel.NONE;
+ }
+
+ /**
* Gets the styled connection message to display below the URL.
*/
private Spannable getUrlConnectionMessage() {
@@ -488,6 +498,18 @@ public class WebsiteSettingsPopup implements OnClickListener, OnItemSelectedList
messageBuilder.setSpan(boldSpan, 0, leadingText.length(),
Spannable.SPAN_INCLUSIVE_EXCLUSIVE);
}
+
+ if (isConnectionDetailsLinkVisible()) {
+ messageBuilder.append(" ");
+ SpannableString detailsText = new SpannableString(
+ mContext.getResources().getString(R.string.page_info_details_link));
+ final ForegroundColorSpan blueSpan = new ForegroundColorSpan(
+ mContext.getResources().getColor(R.color.website_settings_popup_text_link));
+ detailsText.setSpan(
+ blueSpan, 0, detailsText.length(), Spannable.SPAN_INCLUSIVE_EXCLUSIVE);
+ messageBuilder.append(detailsText);
+ }
+
return messageBuilder;
}
@@ -609,6 +631,19 @@ public class WebsiteSettingsPopup implements OnClickListener, OnItemSelectedList
} else if (view == mUrlTitle) {
// Expand/collapse the displayed URL title.
mUrlTitle.toggleTruncation();
+ } else if (view == mUrlConnectionMessage) {
+ if (DeviceFormFactor.isTablet(mContext)) {
+ ConnectionInfoPopup.show(mContext, mWebContents);
+ } else {
+ // Delay while the WebsiteSettingsPopup closes.
+ mContainer.postDelayed(new Runnable() {
+ @Override
+ public void run() {
+ ConnectionInfoPopup.show(mContext, mWebContents);
+ }
+ }, FADE_DURATION + CLOSE_CLEANUP_DELAY);
+ }
+ mDialog.dismiss();
}
}

Powered by Google App Engine
This is Rietveld 408576698