| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 package org.chromium.chrome.browser.util; | 5 package org.chromium.chrome.browser.util; |
| 6 | 6 |
| 7 import android.annotation.SuppressLint; | 7 import android.annotation.SuppressLint; |
| 8 import android.annotation.TargetApi; | 8 import android.annotation.TargetApi; |
| 9 import android.content.Context; | 9 import android.content.Context; |
| 10 import android.content.Intent; | 10 import android.content.Intent; |
| 11 import android.content.pm.PackageManager; | 11 import android.content.pm.PackageManager; |
| 12 import android.content.pm.ResolveInfo; | 12 import android.content.pm.ResolveInfo; |
| 13 import android.os.Build; | 13 import android.os.Build; |
| 14 import android.os.Bundle; | 14 import android.os.Bundle; |
| 15 import android.os.StrictMode; | 15 import android.os.StrictMode; |
| 16 import android.os.UserManager; | 16 import android.os.UserManager; |
| 17 import android.speech.RecognizerIntent; | 17 import android.speech.RecognizerIntent; |
| 18 import android.text.TextUtils; | 18 import android.text.TextUtils; |
| 19 | 19 |
| 20 import org.chromium.base.CommandLine; | 20 import org.chromium.base.CommandLine; |
| 21 import org.chromium.base.ContextUtils; | 21 import org.chromium.base.ContextUtils; |
| 22 import org.chromium.base.FieldTrialList; | 22 import org.chromium.base.FieldTrialList; |
| 23 import org.chromium.base.Log; | 23 import org.chromium.base.Log; |
| 24 import org.chromium.base.ThreadUtils; | 24 import org.chromium.base.ThreadUtils; |
| 25 import org.chromium.base.VisibleForTesting; | 25 import org.chromium.base.VisibleForTesting; |
| 26 import org.chromium.chrome.browser.ApplicationLifetime; | 26 import org.chromium.chrome.browser.ApplicationLifetime; |
| 27 import org.chromium.chrome.browser.ChromeFeatureList; | 27 import org.chromium.chrome.browser.ChromeFeatureList; |
| 28 import org.chromium.chrome.browser.ChromeSwitches; | 28 import org.chromium.chrome.browser.ChromeSwitches; |
| 29 import org.chromium.chrome.browser.firstrun.FirstRunGlueImpl; | 29 import org.chromium.chrome.browser.firstrun.FirstRunGlueImpl; |
| 30 import org.chromium.chrome.browser.omnibox.UrlBarFieldTrial; |
| 30 import org.chromium.chrome.browser.preferences.ChromePreferenceManager; | 31 import org.chromium.chrome.browser.preferences.ChromePreferenceManager; |
| 31 import org.chromium.chrome.browser.tabmodel.DocumentModeAssassin; | 32 import org.chromium.chrome.browser.tabmodel.DocumentModeAssassin; |
| 32 import org.chromium.chrome.browser.webapps.ChromeWebApkHost; | 33 import org.chromium.chrome.browser.webapps.ChromeWebApkHost; |
| 33 import org.chromium.components.signin.AccountManagerHelper; | 34 import org.chromium.components.signin.AccountManagerHelper; |
| 34 import org.chromium.ui.base.DeviceFormFactor; | 35 import org.chromium.ui.base.DeviceFormFactor; |
| 35 | 36 |
| 36 import java.util.List; | 37 import java.util.List; |
| 37 | 38 |
| 38 /** | 39 /** |
| 39 * A utility {@code class} meant to help determine whether or not certain featur
es are supported by | 40 * A utility {@code class} meant to help determine whether or not certain featur
es are supported by |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 181 } | 182 } |
| 182 | 183 |
| 183 /** | 184 /** |
| 184 * Caches flags that must take effect on startup but are set via native code
. | 185 * Caches flags that must take effect on startup but are set via native code
. |
| 185 */ | 186 */ |
| 186 public static void cacheNativeFlags() { | 187 public static void cacheNativeFlags() { |
| 187 cacheHerbFlavor(); | 188 cacheHerbFlavor(); |
| 188 ChromeWebApkHost.cacheEnabledStateForNextLaunch(); | 189 ChromeWebApkHost.cacheEnabledStateForNextLaunch(); |
| 189 cacheChromeHomeEnabled(); | 190 cacheChromeHomeEnabled(); |
| 190 FirstRunGlueImpl.cacheFirstRunPrefs(); | 191 FirstRunGlueImpl.cacheFirstRunPrefs(); |
| 192 UrlBarFieldTrial.cacheUrlBarHint(); |
| 191 } | 193 } |
| 192 | 194 |
| 193 /** | 195 /** |
| 194 * Caches which flavor of Herb the user prefers from native. | 196 * Caches which flavor of Herb the user prefers from native. |
| 195 */ | 197 */ |
| 196 private static void cacheHerbFlavor() { | 198 private static void cacheHerbFlavor() { |
| 197 Context context = ContextUtils.getApplicationContext(); | 199 Context context = ContextUtils.getApplicationContext(); |
| 198 if (isHerbDisallowed(context)) return; | 200 if (isHerbDisallowed(context)) return; |
| 199 | 201 |
| 200 String oldFlavor = getHerbFlavor(); | 202 String oldFlavor = getHerbFlavor(); |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 266 /** | 268 /** |
| 267 * @return Whether or not the expand button for Chrome Home is enabled. | 269 * @return Whether or not the expand button for Chrome Home is enabled. |
| 268 */ | 270 */ |
| 269 public static boolean isChromeHomeExpandButtonEnabled() { | 271 public static boolean isChromeHomeExpandButtonEnabled() { |
| 270 return ChromeFeatureList.isEnabled(ChromeFeatureList.CHROME_HOME_EXPAND_
BUTTON); | 272 return ChromeFeatureList.isEnabled(ChromeFeatureList.CHROME_HOME_EXPAND_
BUTTON); |
| 271 } | 273 } |
| 272 | 274 |
| 273 private static native void nativeSetCustomTabVisible(boolean visible); | 275 private static native void nativeSetCustomTabVisible(boolean visible); |
| 274 private static native void nativeSetIsInMultiWindowMode(boolean isInMultiWin
dowMode); | 276 private static native void nativeSetIsInMultiWindowMode(boolean isInMultiWin
dowMode); |
| 275 } | 277 } |
| OLD | NEW |