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

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

Issue 1254973003: Add a way to reset cached command line arguments (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Replace separate notify method call with posting a new message Created 5 years, 5 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/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();

Powered by Google App Engine
This is Rietveld 408576698