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

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

Issue 1269083005: [Android] Reland CommandLine reset listeners. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 4 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
« no previous file with comments | « base/android/java/src/org/chromium/base/CommandLine.java ('k') | no next file » | 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/util/FeatureUtilities.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/util/FeatureUtilities.java b/chrome/android/java/src/org/chromium/chrome/browser/util/FeatureUtilities.java
index 112ab3cd6ff88984bb598ec5d2fec0fa99ea0597..b32c299cf10aec82394ebcbaf4f97c3cef09a69e 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/util/FeatureUtilities.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/util/FeatureUtilities.java
@@ -33,7 +33,8 @@ public class FeatureUtilities {
private static Boolean sHasGoogleAccountAuthenticator;
private static Boolean sHasRecognitionIntentHandler;
private static Boolean sDocumentModeDisabled;
- private static Boolean sCustomTabVisible;
+ /** Used to track if cached command line flags should be refreshed. */
+ private static CommandLine.ResetListener sResetListener = null;
/**
* Determines whether or not the {@link RecognizerIntent#ACTION_WEB_SEARCH} {@link Intent}
@@ -98,6 +99,7 @@ public class FeatureUtilities {
*/
public static boolean isDocumentMode(Context context) {
if (sDocumentModeDisabled == null && CommandLine.isInitialized()) {
+ initResetListener();
sDocumentModeDisabled = CommandLine.getInstance().hasSwitch(
ChromeSwitches.DISABLE_DOCUMENT_MODE);
}
@@ -130,7 +132,6 @@ public class FeatureUtilities {
* @param visible Whether a custom tab is visible.
*/
public static void setCustomTabVisible(boolean visible) {
- sCustomTabVisible = visible;
nativeSetCustomTabVisible(visible);
}
@@ -138,10 +139,19 @@ public class FeatureUtilities {
* @return Whether a custom tab is visible.
*/
public static boolean getCustomTabVisible() {
- if (sCustomTabVisible == null) {
- sCustomTabVisible = nativeGetCustomTabVisible();
- }
- return sCustomTabVisible;
+ return nativeGetCustomTabVisible();
+ }
+
+ private static void initResetListener() {
+ if (sResetListener != null) return;
+
+ sResetListener = new CommandLine.ResetListener() {
+ @Override
+ public void onCommandLineReset() {
+ sDocumentModeDisabled = null;
+ }
+ };
+ CommandLine.addResetListener(sResetListener);
}
private static native void nativeSetDocumentModeEnabled(boolean enabled);
« no previous file with comments | « base/android/java/src/org/chromium/base/CommandLine.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698