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 5db7fba026575fab99d2ead1347a0cfe64f3e1ea..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,6 +33,8 @@ |
private static Boolean sHasGoogleAccountAuthenticator; |
private static Boolean sHasRecognitionIntentHandler; |
private static Boolean sDocumentModeDisabled; |
+ /** 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} |
@@ -97,6 +99,7 @@ private static boolean hasSyncPermissions(Context context) { |
*/ |
public static boolean isDocumentMode(Context context) { |
if (sDocumentModeDisabled == null && CommandLine.isInitialized()) { |
+ initResetListener(); |
sDocumentModeDisabled = CommandLine.getInstance().hasSwitch( |
ChromeSwitches.DISABLE_DOCUMENT_MODE); |
} |
@@ -139,6 +142,18 @@ public static boolean getCustomTabVisible() { |
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); |
private static native void nativeSetCustomTabVisible(boolean visible); |
private static native boolean nativeGetCustomTabVisible(); |