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

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

Issue 2596973002: [Android] Update CCT/Herb menu item (Closed)
Patch Set: Update based on Ted's comments. Created 3 years, 11 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/appmenu/AppMenuPropertiesDelegate.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/appmenu/AppMenuPropertiesDelegate.java b/chrome/android/java/src/org/chromium/chrome/browser/appmenu/AppMenuPropertiesDelegate.java
index 6d0529a89bc7aecefc991494bf7f4ee2538ba244..63345c8f4f7f7e0c39a7cfee16588078b2dcbfa5 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/appmenu/AppMenuPropertiesDelegate.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/appmenu/AppMenuPropertiesDelegate.java
@@ -179,11 +179,7 @@ public class AppMenuPropertiesDelegate {
// Hide request desktop site on all chrome:// pages except for the NTP. Check request
// desktop site if it's activated on this page.
MenuItem requestItem = menu.findItem(R.id.request_desktop_site_id);
- requestItem.setVisible(!isChromeScheme || currentTab.isNativePage());
- requestItem.setChecked(currentTab.getUseDesktopUserAgent());
- requestItem.setTitleCondensed(requestItem.isChecked()
- ? mActivity.getString(R.string.menu_request_desktop_site_on)
- : mActivity.getString(R.string.menu_request_desktop_site_off));
+ updateRequestDesktopSiteMenuItem(requestItem, currentTab, isChromeScheme);
// Only display reader mode settings menu option if the current page is in reader mode.
menu.findItem(R.id.reader_mode_prefs_id)
@@ -292,4 +288,21 @@ public class AppMenuPropertiesDelegate {
bookmarkMenuItem.setTitleCondensed(null);
}
}
+
+ /**
+ * Updates the request desktop site item's visibility
+ *
+ * @param requstMenuItem {@link MenuItem} for request desktop site.
+ * @param currentTab Current tab being displayed.
+ * @param isChromeScheme whether the url being displayed starts with chrome:// or
+ * chrome-native://.
+ */
+ protected void updateRequestDesktopSiteMenuItem(
+ MenuItem requstMenuItem, Tab currentTab, boolean isChromeScheme) {
Ted C 2017/01/05 21:30:20 Also, I would recalculate isChromeSheme within thi
+ requstMenuItem.setVisible(!isChromeScheme || currentTab.isNativePage());
+ requstMenuItem.setChecked(currentTab.getUseDesktopUserAgent());
+ requstMenuItem.setTitleCondensed(requstMenuItem.isChecked()
+ ? mActivity.getString(R.string.menu_request_desktop_site_on)
Ted C 2017/01/05 21:30:20 nit: indented too much (should be 8 from the start
+ : mActivity.getString(R.string.menu_request_desktop_site_off));
+ }
}

Powered by Google App Engine
This is Rietveld 408576698