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; |
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.CommandLineInitUtil; |
28 import org.chromium.base.PathUtils; | 29 import org.chromium.base.PathUtils; |
29 import org.chromium.base.ResourceExtractor; | 30 import org.chromium.base.ResourceExtractor; |
30 import org.chromium.base.ThreadUtils; | 31 import org.chromium.base.ThreadUtils; |
31 import org.chromium.base.TraceEvent; | 32 import org.chromium.base.TraceEvent; |
32 import org.chromium.base.VisibleForTesting; | 33 import org.chromium.base.VisibleForTesting; |
33 import org.chromium.base.annotations.CalledByNative; | 34 import org.chromium.base.annotations.CalledByNative; |
34 import org.chromium.base.annotations.SuppressFBWarnings; | 35 import org.chromium.base.annotations.SuppressFBWarnings; |
35 import org.chromium.base.library_loader.LibraryLoader; | 36 import org.chromium.base.library_loader.LibraryLoader; |
36 import org.chromium.base.library_loader.LibraryProcessType; | 37 import org.chromium.base.library_loader.LibraryProcessType; |
37 import org.chromium.base.library_loader.ProcessInitException; | 38 import org.chromium.base.library_loader.ProcessInitException; |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 import org.chromium.ui.base.ResourceBundle; | 108 import org.chromium.ui.base.ResourceBundle; |
108 | 109 |
109 import java.lang.ref.WeakReference; | 110 import java.lang.ref.WeakReference; |
110 import java.util.Locale; | 111 import java.util.Locale; |
111 | 112 |
112 /** | 113 /** |
113 * Basic application functionality that should be shared among all browser appli
cations that use | 114 * Basic application functionality that should be shared among all browser appli
cations that use |
114 * chrome layer. | 115 * chrome layer. |
115 */ | 116 */ |
116 public class ChromeApplication extends ContentApplication { | 117 public class ChromeApplication extends ContentApplication { |
| 118 public static final String COMMAND_LINE_FILE = "chrome-command-line"; |
117 | 119 |
118 private static final String TAG = "ChromiumApplication"; | 120 private static final String TAG = "ChromiumApplication"; |
119 private static final String PREF_BOOT_TIMESTAMP = | 121 private static final String PREF_BOOT_TIMESTAMP = |
120 "com.google.android.apps.chrome.ChromeMobileApplication.BOOT_TIMESTA
MP"; | 122 "com.google.android.apps.chrome.ChromeMobileApplication.BOOT_TIMESTA
MP"; |
121 private static final long BOOT_TIMESTAMP_MARGIN_MS = 1000; | 123 private static final long BOOT_TIMESTAMP_MARGIN_MS = 1000; |
122 private static final String PREF_LOCALE = "locale"; | 124 private static final String PREF_LOCALE = "locale"; |
123 private static final float FLOAT_EPSILON = 0.001f; | 125 private static final float FLOAT_EPSILON = 0.001f; |
124 private static final String PRIVATE_DATA_DIRECTORY_SUFFIX = "chrome"; | 126 private static final String PRIVATE_DATA_DIRECTORY_SUFFIX = "chrome"; |
125 private static final String DEV_TOOLS_SERVER_SOCKET_PREFIX = "chrome"; | 127 private static final String DEV_TOOLS_SERVER_SOCKET_PREFIX = "chrome"; |
126 private static final String SESSIONS_UUID_PREF_KEY = "chromium.sync.sessions
.id"; | 128 private static final String SESSIONS_UUID_PREF_KEY = "chromium.sync.sessions
.id"; |
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
478 removeSessionCookies(); | 480 removeSessionCookies(); |
479 ApplicationStatus.registerApplicationStateListener(createApplicationStat
eListener()); | 481 ApplicationStatus.registerApplicationStateListener(createApplicationStat
eListener()); |
480 AppBannerManager.setAppDetailsDelegate(createAppDetailsDelegate()); | 482 AppBannerManager.setAppDetailsDelegate(createAppDetailsDelegate()); |
481 mChromeLifetimeController = new ChromeLifetimeController(this); | 483 mChromeLifetimeController = new ChromeLifetimeController(this); |
482 | 484 |
483 PrefServiceBridge.getInstance().migratePreferences(this); | 485 PrefServiceBridge.getInstance().migratePreferences(this); |
484 } | 486 } |
485 | 487 |
486 @Override | 488 @Override |
487 public void initCommandLine() { | 489 public void initCommandLine() { |
488 ChromeCommandLineInitUtil.initChromeCommandLine(this); | 490 CommandLineInitUtil.initCommandLine(this, COMMAND_LINE_FILE); |
489 } | 491 } |
490 | 492 |
491 /** | 493 /** |
492 * Start the browser process asynchronously. This will set up a queue of UI | 494 * Start the browser process asynchronously. This will set up a queue of UI |
493 * thread tasks to initialize the browser process. | 495 * thread tasks to initialize the browser process. |
494 * | 496 * |
495 * Note that this can only be called on the UI thread. | 497 * Note that this can only be called on the UI thread. |
496 * | 498 * |
497 * @param callback the callback to be called when browser startup is complet
e. | 499 * @param callback the callback to be called when browser startup is complet
e. |
498 * @throws ProcessInitException | 500 * @throws ProcessInitException |
(...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
892 */ | 894 */ |
893 private void updatePasswordEchoState() { | 895 private void updatePasswordEchoState() { |
894 boolean systemEnabled = Settings.System.getInt( | 896 boolean systemEnabled = Settings.System.getInt( |
895 getApplicationContext().getContentResolver(), | 897 getApplicationContext().getContentResolver(), |
896 Settings.System.TEXT_SHOW_PASSWORD, 1) == 1; | 898 Settings.System.TEXT_SHOW_PASSWORD, 1) == 1; |
897 if (PrefServiceBridge.getInstance().getPasswordEchoEnabled() == systemEn
abled) return; | 899 if (PrefServiceBridge.getInstance().getPasswordEchoEnabled() == systemEn
abled) return; |
898 | 900 |
899 PrefServiceBridge.getInstance().setPasswordEchoEnabled(systemEnabled); | 901 PrefServiceBridge.getInstance().setPasswordEchoEnabled(systemEnabled); |
900 } | 902 } |
901 } | 903 } |
OLD | NEW |