| 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.Handler; | 11 import android.os.Handler; |
| 12 import android.os.Looper; | 12 import android.os.Looper; |
| 13 import android.os.SystemClock; | 13 import android.os.SystemClock; |
| 14 import android.util.Log; | 14 import android.util.Log; |
| 15 | 15 |
| 16 import org.chromium.base.ActivityState; | 16 import org.chromium.base.ActivityState; |
| 17 import org.chromium.base.ApiCompatibilityUtils; | 17 import org.chromium.base.ApiCompatibilityUtils; |
| 18 import org.chromium.base.ApplicationStatus; | 18 import org.chromium.base.ApplicationStatus; |
| 19 import org.chromium.base.CommandLineInitUtil; | 19 import org.chromium.base.CommandLineInitUtil; |
| 20 import org.chromium.base.ContextUtils; | 20 import org.chromium.base.ContextUtils; |
| 21 import org.chromium.base.ResourceExtractor; | |
| 22 import org.chromium.base.ThreadUtils; | 21 import org.chromium.base.ThreadUtils; |
| 23 import org.chromium.base.TraceEvent; | 22 import org.chromium.base.TraceEvent; |
| 24 import org.chromium.base.annotations.CalledByNative; | 23 import org.chromium.base.annotations.CalledByNative; |
| 25 import org.chromium.base.annotations.SuppressFBWarnings; | 24 import org.chromium.base.annotations.SuppressFBWarnings; |
| 26 import org.chromium.base.library_loader.ProcessInitException; | 25 import org.chromium.base.library_loader.ProcessInitException; |
| 27 import org.chromium.chrome.R; | |
| 28 import org.chromium.chrome.browser.banners.AppDetailsDelegate; | 26 import org.chromium.chrome.browser.banners.AppDetailsDelegate; |
| 29 import org.chromium.chrome.browser.customtabs.CustomTabsConnection; | 27 import org.chromium.chrome.browser.customtabs.CustomTabsConnection; |
| 30 import org.chromium.chrome.browser.datausage.ExternalDataUseObserver; | 28 import org.chromium.chrome.browser.datausage.ExternalDataUseObserver; |
| 31 import org.chromium.chrome.browser.document.DocumentActivity; | 29 import org.chromium.chrome.browser.document.DocumentActivity; |
| 32 import org.chromium.chrome.browser.document.IncognitoDocumentActivity; | 30 import org.chromium.chrome.browser.document.IncognitoDocumentActivity; |
| 33 import org.chromium.chrome.browser.externalauth.ExternalAuthUtils; | 31 import org.chromium.chrome.browser.externalauth.ExternalAuthUtils; |
| 34 import org.chromium.chrome.browser.feedback.EmptyFeedbackReporter; | 32 import org.chromium.chrome.browser.feedback.EmptyFeedbackReporter; |
| 35 import org.chromium.chrome.browser.feedback.FeedbackReporter; | 33 import org.chromium.chrome.browser.feedback.FeedbackReporter; |
| 36 import org.chromium.chrome.browser.gsa.GSAHelper; | 34 import org.chromium.chrome.browser.gsa.GSAHelper; |
| 37 import org.chromium.chrome.browser.help.HelpAndFeedback; | 35 import org.chromium.chrome.browser.help.HelpAndFeedback; |
| (...skipping 25 matching lines...) Expand all Loading... |
| 63 import org.chromium.chrome.browser.tabmodel.document.DocumentTabModelSelector; | 61 import org.chromium.chrome.browser.tabmodel.document.DocumentTabModelSelector; |
| 64 import org.chromium.chrome.browser.tabmodel.document.StorageDelegate; | 62 import org.chromium.chrome.browser.tabmodel.document.StorageDelegate; |
| 65 import org.chromium.chrome.browser.tabmodel.document.TabDelegate; | 63 import org.chromium.chrome.browser.tabmodel.document.TabDelegate; |
| 66 import org.chromium.components.signin.AccountManagerDelegate; | 64 import org.chromium.components.signin.AccountManagerDelegate; |
| 67 import org.chromium.components.signin.SystemAccountManagerDelegate; | 65 import org.chromium.components.signin.SystemAccountManagerDelegate; |
| 68 import org.chromium.content.app.ContentApplication; | 66 import org.chromium.content.app.ContentApplication; |
| 69 import org.chromium.content.browser.ChildProcessCreationParams; | 67 import org.chromium.content.browser.ChildProcessCreationParams; |
| 70 import org.chromium.policy.AppRestrictionsProvider; | 68 import org.chromium.policy.AppRestrictionsProvider; |
| 71 import org.chromium.policy.CombinedPolicyProvider; | 69 import org.chromium.policy.CombinedPolicyProvider; |
| 72 import org.chromium.printing.PrintingController; | 70 import org.chromium.printing.PrintingController; |
| 73 import org.chromium.ui.base.ResourceBundle; | |
| 74 | 71 |
| 75 /** | 72 /** |
| 76 * Basic application functionality that should be shared among all browser appli
cations that use | 73 * Basic application functionality that should be shared among all browser appli
cations that use |
| 77 * chrome layer. | 74 * chrome layer. |
| 78 */ | 75 */ |
| 79 public class ChromeApplication extends ContentApplication { | 76 public class ChromeApplication extends ContentApplication { |
| 80 public static final String COMMAND_LINE_FILE = "chrome-command-line"; | 77 public static final String COMMAND_LINE_FILE = "chrome-command-line"; |
| 81 | 78 |
| 82 private static final String TAG = "ChromiumApplication"; | 79 private static final String TAG = "ChromiumApplication"; |
| 83 private static final String PREF_BOOT_TIMESTAMP = | 80 private static final String PREF_BOOT_TIMESTAMP = |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 AutofillPreferences.class.getName()); | 151 AutofillPreferences.class.getName()); |
| 155 } | 152 } |
| 156 | 153 |
| 157 @CalledByNative | 154 @CalledByNative |
| 158 protected void showPasswordSettings() { | 155 protected void showPasswordSettings() { |
| 159 PreferencesLauncher.launchSettingsPage(this, | 156 PreferencesLauncher.launchSettingsPage(this, |
| 160 SavePasswordsPreferences.class.getName()); | 157 SavePasswordsPreferences.class.getName()); |
| 161 } | 158 } |
| 162 | 159 |
| 163 @Override | 160 @Override |
| 164 protected void initializeLibraryDependencies() { | |
| 165 // The ResourceExtractor is only needed by the browser process, but this
will have no | |
| 166 // impact on the renderer process construction. | |
| 167 ResourceBundle.initializeLocalePaks(this, R.array.locale_paks); | |
| 168 ResourceExtractor.setResourcesToExtract(ResourceBundle.getActiveLocaleRe
sources()); | |
| 169 } | |
| 170 | |
| 171 @Override | |
| 172 public void initCommandLine() { | 161 public void initCommandLine() { |
| 173 CommandLineInitUtil.initCommandLine(this, COMMAND_LINE_FILE); | 162 CommandLineInitUtil.initCommandLine(this, COMMAND_LINE_FILE); |
| 174 } | 163 } |
| 175 | 164 |
| 176 /** | 165 /** |
| 177 * Shows an error dialog following a startup error, and then exits the appli
cation. | 166 * Shows an error dialog following a startup error, and then exits the appli
cation. |
| 178 * @param e The exception reported by Chrome initialization. | 167 * @param e The exception reported by Chrome initialization. |
| 179 */ | 168 */ |
| 180 public static void reportStartupErrorAndExit(final ProcessInitException e) { | 169 public static void reportStartupErrorAndExit(final ProcessInitException e) { |
| 181 Activity activity = ApplicationStatus.getLastTrackedFocusedActivity(); | 170 Activity activity = ApplicationStatus.getLastTrackedFocusedActivity(); |
| (...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 444 } | 433 } |
| 445 | 434 |
| 446 /** | 435 /** |
| 447 * Creates a new {@link AccountManagerDelegate}. | 436 * Creates a new {@link AccountManagerDelegate}. |
| 448 * @return the created {@link AccountManagerDelegate}. | 437 * @return the created {@link AccountManagerDelegate}. |
| 449 */ | 438 */ |
| 450 public AccountManagerDelegate createAccountManagerDelegate() { | 439 public AccountManagerDelegate createAccountManagerDelegate() { |
| 451 return new SystemAccountManagerDelegate(this); | 440 return new SystemAccountManagerDelegate(this); |
| 452 } | 441 } |
| 453 } | 442 } |
| OLD | NEW |