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

Side by Side Diff: chrome/android/java/src/org/chromium/chrome/browser/ChromeApplication.java

Issue 1658723007: Prototype handling of Intents in Custom Tabs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Moved preference code Created 4 years, 10 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 unified diff | Download patch
« no previous file with comments | « no previous file | chrome/android/java/src/org/chromium/chrome/browser/ChromeSwitches.java » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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;
11 import android.os.Bundle; 11 import android.os.Bundle;
12 import android.os.Handler; 12 import android.os.Handler;
13 import android.os.Looper; 13 import android.os.Looper;
14 import android.os.SystemClock; 14 import android.os.SystemClock;
15 import android.preference.PreferenceManager; 15 import android.preference.PreferenceManager;
16 import android.provider.Settings; 16 import android.provider.Settings;
17 import android.util.Log; 17 import android.util.Log;
18 import android.view.View; 18 import android.view.View;
19 19
20 import com.google.ipc.invalidation.external.client.android.service.AndroidLogger ; 20 import com.google.ipc.invalidation.external.client.android.service.AndroidLogger ;
21 21
22 import org.chromium.base.ActivityState; 22 import org.chromium.base.ActivityState;
23 import org.chromium.base.ApiCompatibilityUtils; 23 import org.chromium.base.ApiCompatibilityUtils;
24 import org.chromium.base.ApplicationState; 24 import org.chromium.base.ApplicationState;
25 import org.chromium.base.ApplicationStatus; 25 import org.chromium.base.ApplicationStatus;
26 import org.chromium.base.ApplicationStatus.ApplicationStateListener; 26 import org.chromium.base.ApplicationStatus.ApplicationStateListener;
27 import org.chromium.base.BuildInfo; 27 import org.chromium.base.BuildInfo;
28 import org.chromium.base.CommandLine;
28 import org.chromium.base.CommandLineInitUtil; 29 import org.chromium.base.CommandLineInitUtil;
29 import org.chromium.base.PathUtils; 30 import org.chromium.base.PathUtils;
30 import org.chromium.base.ResourceExtractor; 31 import org.chromium.base.ResourceExtractor;
31 import org.chromium.base.ThreadUtils; 32 import org.chromium.base.ThreadUtils;
32 import org.chromium.base.TraceEvent; 33 import org.chromium.base.TraceEvent;
33 import org.chromium.base.VisibleForTesting; 34 import org.chromium.base.VisibleForTesting;
34 import org.chromium.base.annotations.CalledByNative; 35 import org.chromium.base.annotations.CalledByNative;
35 import org.chromium.base.annotations.SuppressFBWarnings; 36 import org.chromium.base.annotations.SuppressFBWarnings;
36 import org.chromium.base.library_loader.ProcessInitException; 37 import org.chromium.base.library_loader.ProcessInitException;
37 import org.chromium.base.metrics.RecordHistogram; 38 import org.chromium.base.metrics.RecordHistogram;
(...skipping 20 matching lines...) Expand all
58 import org.chromium.chrome.browser.metrics.VariationsSession; 59 import org.chromium.chrome.browser.metrics.VariationsSession;
59 import org.chromium.chrome.browser.multiwindow.MultiWindowUtils; 60 import org.chromium.chrome.browser.multiwindow.MultiWindowUtils;
60 import org.chromium.chrome.browser.net.qualityprovider.ExternalEstimateProviderA ndroid; 61 import org.chromium.chrome.browser.net.qualityprovider.ExternalEstimateProviderA ndroid;
61 import org.chromium.chrome.browser.net.spdyproxy.DataReductionProxySettings; 62 import org.chromium.chrome.browser.net.spdyproxy.DataReductionProxySettings;
62 import org.chromium.chrome.browser.notifications.NotificationUIManager; 63 import org.chromium.chrome.browser.notifications.NotificationUIManager;
63 import org.chromium.chrome.browser.omaha.RequestGenerator; 64 import org.chromium.chrome.browser.omaha.RequestGenerator;
64 import org.chromium.chrome.browser.partnercustomizations.PartnerBrowserCustomiza tions; 65 import org.chromium.chrome.browser.partnercustomizations.PartnerBrowserCustomiza tions;
65 import org.chromium.chrome.browser.physicalweb.PhysicalWebBleClient; 66 import org.chromium.chrome.browser.physicalweb.PhysicalWebBleClient;
66 import org.chromium.chrome.browser.policy.PolicyAuditor; 67 import org.chromium.chrome.browser.policy.PolicyAuditor;
67 import org.chromium.chrome.browser.preferences.AccessibilityPreferences; 68 import org.chromium.chrome.browser.preferences.AccessibilityPreferences;
69 import org.chromium.chrome.browser.preferences.ChromePreferenceManager;
68 import org.chromium.chrome.browser.preferences.LocationSettings; 70 import org.chromium.chrome.browser.preferences.LocationSettings;
69 import org.chromium.chrome.browser.preferences.PrefServiceBridge; 71 import org.chromium.chrome.browser.preferences.PrefServiceBridge;
70 import org.chromium.chrome.browser.preferences.Preferences; 72 import org.chromium.chrome.browser.preferences.Preferences;
71 import org.chromium.chrome.browser.preferences.PreferencesLauncher; 73 import org.chromium.chrome.browser.preferences.PreferencesLauncher;
72 import org.chromium.chrome.browser.preferences.autofill.AutofillPreferences; 74 import org.chromium.chrome.browser.preferences.autofill.AutofillPreferences;
73 import org.chromium.chrome.browser.preferences.password.SavePasswordsPreferences ; 75 import org.chromium.chrome.browser.preferences.password.SavePasswordsPreferences ;
74 import org.chromium.chrome.browser.preferences.privacy.PrivacyPreferences; 76 import org.chromium.chrome.browser.preferences.privacy.PrivacyPreferences;
75 import org.chromium.chrome.browser.preferences.website.SingleWebsitePreferences; 77 import org.chromium.chrome.browser.preferences.website.SingleWebsitePreferences;
76 import org.chromium.chrome.browser.printing.PrintingControllerFactory; 78 import org.chromium.chrome.browser.printing.PrintingControllerFactory;
77 import org.chromium.chrome.browser.rlz.RevenueStats; 79 import org.chromium.chrome.browser.rlz.RevenueStats;
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 private static final String TAG = "ChromiumApplication"; 119 private static final String TAG = "ChromiumApplication";
118 private static final String PREF_BOOT_TIMESTAMP = 120 private static final String PREF_BOOT_TIMESTAMP =
119 "com.google.android.apps.chrome.ChromeMobileApplication.BOOT_TIMESTA MP"; 121 "com.google.android.apps.chrome.ChromeMobileApplication.BOOT_TIMESTA MP";
120 private static final long BOOT_TIMESTAMP_MARGIN_MS = 1000; 122 private static final long BOOT_TIMESTAMP_MARGIN_MS = 1000;
121 private static final String PREF_LOCALE = "locale"; 123 private static final String PREF_LOCALE = "locale";
122 private static final float FLOAT_EPSILON = 0.001f; 124 private static final float FLOAT_EPSILON = 0.001f;
123 private static final String PRIVATE_DATA_DIRECTORY_SUFFIX = "chrome"; 125 private static final String PRIVATE_DATA_DIRECTORY_SUFFIX = "chrome";
124 private static final String DEV_TOOLS_SERVER_SOCKET_PREFIX = "chrome"; 126 private static final String DEV_TOOLS_SERVER_SOCKET_PREFIX = "chrome";
125 private static final String SESSIONS_UUID_PREF_KEY = "chromium.sync.sessions .id"; 127 private static final String SESSIONS_UUID_PREF_KEY = "chromium.sync.sessions .id";
126 128
129 private static boolean sIsFinishedCachingNativeFlags;
127 private static DocumentTabModelSelector sDocumentTabModelSelector; 130 private static DocumentTabModelSelector sDocumentTabModelSelector;
128 131
129 /** 132 /**
130 * This class allows pausing scripts & network connections when we 133 * This class allows pausing scripts & network connections when we
131 * go to the background and resume when we are back in foreground again. 134 * 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 135 * 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. 136 * the native side by subscribing to the system monitor events.
134 */ 137 */
135 private static class BackgroundProcessing { 138 private static class BackgroundProcessing {
136 private class SuspendRunnable implements Runnable { 139 private class SuspendRunnable implements Runnable {
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 * onForegroundSessionEnd() is called, to handle changing top-level Chrome a ctivities in one 244 * onForegroundSessionEnd() is called, to handle changing top-level Chrome a ctivities in one
242 * foreground session. 245 * foreground session.
243 */ 246 */
244 public void onStartWithNative() { 247 public void onStartWithNative() {
245 if (mIsStarted) return; 248 if (mIsStarted) return;
246 mIsStarted = true; 249 mIsStarted = true;
247 250
248 assert mIsProcessInitialized; 251 assert mIsProcessInitialized;
249 252
250 onForegroundSessionStart(); 253 onForegroundSessionStart();
254 cacheNativeFlags();
251 } 255 }
252 256
253 /** 257 /**
254 * Called when a top-level Chrome activity (ChromeTabbedActivity, Fullscreen Activity) is 258 * 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 259 * 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 260 * (see onStart()), that is, when correct activity calls startActivity() for another Chrome
257 * activity. 261 * activity.
258 */ 262 */
259 private void onForegroundSessionStart() { 263 private void onForegroundSessionStart() {
260 ChildProcessLauncher.onBroughtToForeground(); 264 ChildProcessLauncher.onBroughtToForeground();
(...skipping 581 matching lines...) Expand 10 before | Expand all | Expand 10 after
842 * period of time. 846 * period of time.
843 */ 847 */
844 private void updatePasswordEchoState() { 848 private void updatePasswordEchoState() {
845 boolean systemEnabled = Settings.System.getInt( 849 boolean systemEnabled = Settings.System.getInt(
846 getApplicationContext().getContentResolver(), 850 getApplicationContext().getContentResolver(),
847 Settings.System.TEXT_SHOW_PASSWORD, 1) == 1; 851 Settings.System.TEXT_SHOW_PASSWORD, 1) == 1;
848 if (PrefServiceBridge.getInstance().getPasswordEchoEnabled() == systemEn abled) return; 852 if (PrefServiceBridge.getInstance().getPasswordEchoEnabled() == systemEn abled) return;
849 853
850 PrefServiceBridge.getInstance().setPasswordEchoEnabled(systemEnabled); 854 PrefServiceBridge.getInstance().setPasswordEchoEnabled(systemEnabled);
851 } 855 }
856
857 /**
858 * Caches flags that are needed by Activities that launch before the native library is loaded
859 * and stores them in SharedPreferences. Because of when this function is ca lled, the browser
Ian Wen 2016/02/02 01:24:37 Remove "of"?
gone 2016/02/02 01:59:42 Reworded it.
860 * will need to be restarted before they take effect.
861 */
862 private void cacheNativeFlags() {
863 if (sIsFinishedCachingNativeFlags) return;
864
865 boolean isHerbEnabled =
866 CommandLine.getInstance().hasSwitch(ChromeSwitches.ENABLE_HERB_P ROTOTYPE);
867 ChromePreferenceManager.getInstance(this).setIsHerbEnabled(isHerbEnabled );
868 sIsFinishedCachingNativeFlags = true;
869 }
852 } 870 }
OLDNEW
« no previous file with comments | « no previous file | chrome/android/java/src/org/chromium/chrome/browser/ChromeSwitches.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698