OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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; | 5 package org.chromium.chrome.browser; |
6 | 6 |
7 import android.app.Activity; | 7 import android.app.Activity; |
8 import android.content.Context; | 8 import android.content.Context; |
9 import android.content.Intent; | 9 import android.content.Intent; |
10 import android.content.SharedPreferences; | 10 import android.content.SharedPreferences; |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
58 import org.chromium.chrome.browser.metrics.VariationsSession; | 58 import org.chromium.chrome.browser.metrics.VariationsSession; |
59 import org.chromium.chrome.browser.multiwindow.MultiWindowUtils; | 59 import org.chromium.chrome.browser.multiwindow.MultiWindowUtils; |
60 import org.chromium.chrome.browser.net.qualityprovider.ExternalEstimateProviderA ndroid; | 60 import org.chromium.chrome.browser.net.qualityprovider.ExternalEstimateProviderA ndroid; |
61 import org.chromium.chrome.browser.net.spdyproxy.DataReductionProxySettings; | 61 import org.chromium.chrome.browser.net.spdyproxy.DataReductionProxySettings; |
62 import org.chromium.chrome.browser.notifications.NotificationUIManager; | 62 import org.chromium.chrome.browser.notifications.NotificationUIManager; |
63 import org.chromium.chrome.browser.omaha.RequestGenerator; | 63 import org.chromium.chrome.browser.omaha.RequestGenerator; |
64 import org.chromium.chrome.browser.partnercustomizations.PartnerBrowserCustomiza tions; | 64 import org.chromium.chrome.browser.partnercustomizations.PartnerBrowserCustomiza tions; |
65 import org.chromium.chrome.browser.physicalweb.PhysicalWebBleClient; | 65 import org.chromium.chrome.browser.physicalweb.PhysicalWebBleClient; |
66 import org.chromium.chrome.browser.policy.PolicyAuditor; | 66 import org.chromium.chrome.browser.policy.PolicyAuditor; |
67 import org.chromium.chrome.browser.preferences.AccessibilityPreferences; | 67 import org.chromium.chrome.browser.preferences.AccessibilityPreferences; |
68 import org.chromium.chrome.browser.preferences.ChromePreferenceManager; | |
68 import org.chromium.chrome.browser.preferences.LocationSettings; | 69 import org.chromium.chrome.browser.preferences.LocationSettings; |
69 import org.chromium.chrome.browser.preferences.PrefServiceBridge; | 70 import org.chromium.chrome.browser.preferences.PrefServiceBridge; |
70 import org.chromium.chrome.browser.preferences.Preferences; | 71 import org.chromium.chrome.browser.preferences.Preferences; |
71 import org.chromium.chrome.browser.preferences.PreferencesLauncher; | 72 import org.chromium.chrome.browser.preferences.PreferencesLauncher; |
72 import org.chromium.chrome.browser.preferences.autofill.AutofillPreferences; | 73 import org.chromium.chrome.browser.preferences.autofill.AutofillPreferences; |
73 import org.chromium.chrome.browser.preferences.password.SavePasswordsPreferences ; | 74 import org.chromium.chrome.browser.preferences.password.SavePasswordsPreferences ; |
74 import org.chromium.chrome.browser.preferences.privacy.PrivacyPreferences; | 75 import org.chromium.chrome.browser.preferences.privacy.PrivacyPreferences; |
75 import org.chromium.chrome.browser.preferences.website.SingleWebsitePreferences; | 76 import org.chromium.chrome.browser.preferences.website.SingleWebsitePreferences; |
76 import org.chromium.chrome.browser.printing.PrintingControllerFactory; | 77 import org.chromium.chrome.browser.printing.PrintingControllerFactory; |
77 import org.chromium.chrome.browser.rlz.RevenueStats; | 78 import org.chromium.chrome.browser.rlz.RevenueStats; |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
117 private static final String TAG = "ChromiumApplication"; | 118 private static final String TAG = "ChromiumApplication"; |
118 private static final String PREF_BOOT_TIMESTAMP = | 119 private static final String PREF_BOOT_TIMESTAMP = |
119 "com.google.android.apps.chrome.ChromeMobileApplication.BOOT_TIMESTA MP"; | 120 "com.google.android.apps.chrome.ChromeMobileApplication.BOOT_TIMESTA MP"; |
120 private static final long BOOT_TIMESTAMP_MARGIN_MS = 1000; | 121 private static final long BOOT_TIMESTAMP_MARGIN_MS = 1000; |
121 private static final String PREF_LOCALE = "locale"; | 122 private static final String PREF_LOCALE = "locale"; |
122 private static final float FLOAT_EPSILON = 0.001f; | 123 private static final float FLOAT_EPSILON = 0.001f; |
123 private static final String PRIVATE_DATA_DIRECTORY_SUFFIX = "chrome"; | 124 private static final String PRIVATE_DATA_DIRECTORY_SUFFIX = "chrome"; |
124 private static final String DEV_TOOLS_SERVER_SOCKET_PREFIX = "chrome"; | 125 private static final String DEV_TOOLS_SERVER_SOCKET_PREFIX = "chrome"; |
125 private static final String SESSIONS_UUID_PREF_KEY = "chromium.sync.sessions .id"; | 126 private static final String SESSIONS_UUID_PREF_KEY = "chromium.sync.sessions .id"; |
126 | 127 |
128 private static boolean sIsFinishedCachingNativeFlags; | |
127 private static DocumentTabModelSelector sDocumentTabModelSelector; | 129 private static DocumentTabModelSelector sDocumentTabModelSelector; |
128 | 130 |
129 /** | 131 /** |
130 * This class allows pausing scripts & network connections when we | 132 * This class allows pausing scripts & network connections when we |
131 * go to the background and resume when we are back in foreground again. | 133 * go to the background and resume when we are back in foreground again. |
132 * TODO(pliard): Get rid of this class once JavaScript timers toggling is do ne directly on | 134 * TODO(pliard): Get rid of this class once JavaScript timers toggling is do ne directly on |
133 * the native side by subscribing to the system monitor events. | 135 * the native side by subscribing to the system monitor events. |
134 */ | 136 */ |
135 private static class BackgroundProcessing { | 137 private static class BackgroundProcessing { |
136 private class SuspendRunnable implements Runnable { | 138 private class SuspendRunnable implements Runnable { |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
241 * onForegroundSessionEnd() is called, to handle changing top-level Chrome a ctivities in one | 243 * onForegroundSessionEnd() is called, to handle changing top-level Chrome a ctivities in one |
242 * foreground session. | 244 * foreground session. |
243 */ | 245 */ |
244 public void onStartWithNative() { | 246 public void onStartWithNative() { |
245 if (mIsStarted) return; | 247 if (mIsStarted) return; |
246 mIsStarted = true; | 248 mIsStarted = true; |
247 | 249 |
248 assert mIsProcessInitialized; | 250 assert mIsProcessInitialized; |
249 | 251 |
250 onForegroundSessionStart(); | 252 onForegroundSessionStart(); |
253 cacheNativeFlags(); | |
251 } | 254 } |
252 | 255 |
253 /** | 256 /** |
254 * Called when a top-level Chrome activity (ChromeTabbedActivity, Fullscreen Activity) is | 257 * Called when a top-level Chrome activity (ChromeTabbedActivity, Fullscreen Activity) is |
255 * started in foreground. It will not be called again when other Chrome acti vities take over | 258 * started in foreground. It will not be called again when other Chrome acti vities take over |
256 * (see onStart()), that is, when correct activity calls startActivity() for another Chrome | 259 * (see onStart()), that is, when correct activity calls startActivity() for another Chrome |
257 * activity. | 260 * activity. |
258 */ | 261 */ |
259 private void onForegroundSessionStart() { | 262 private void onForegroundSessionStart() { |
260 ChildProcessLauncher.onBroughtToForeground(); | 263 ChildProcessLauncher.onBroughtToForeground(); |
(...skipping 581 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
842 * period of time. | 845 * period of time. |
843 */ | 846 */ |
844 private void updatePasswordEchoState() { | 847 private void updatePasswordEchoState() { |
845 boolean systemEnabled = Settings.System.getInt( | 848 boolean systemEnabled = Settings.System.getInt( |
846 getApplicationContext().getContentResolver(), | 849 getApplicationContext().getContentResolver(), |
847 Settings.System.TEXT_SHOW_PASSWORD, 1) == 1; | 850 Settings.System.TEXT_SHOW_PASSWORD, 1) == 1; |
848 if (PrefServiceBridge.getInstance().getPasswordEchoEnabled() == systemEn abled) return; | 851 if (PrefServiceBridge.getInstance().getPasswordEchoEnabled() == systemEn abled) return; |
849 | 852 |
850 PrefServiceBridge.getInstance().setPasswordEchoEnabled(systemEnabled); | 853 PrefServiceBridge.getInstance().setPasswordEchoEnabled(systemEnabled); |
851 } | 854 } |
855 | |
856 /** | |
857 * Caches flags that are needed by Activities that launch before the native library is loaded | |
858 * and stores them in SharedPreferences. Because this function is called dur ing launch after the | |
859 * library has loaded, they won't affect the next launch until Chrome is res tarted. | |
gone
2016/02/02 01:59:42
Ted: I didn't make this function cause a reboot be
Ted C
2016/02/02 21:22:46
We might want to put a temporary toast in here tel
| |
860 */ | |
861 private void cacheNativeFlags() { | |
862 if (sIsFinishedCachingNativeFlags) return; | |
863 | |
864 ChromePreferenceManager.getInstance(this).cacheHerbFlavor(); | |
865 sIsFinishedCachingNativeFlags = true; | |
866 } | |
852 } | 867 } |
OLD | NEW |