| 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.app.Notification; | 8 import android.app.Notification; |
| 9 import android.content.Context; | 9 import android.content.Context; |
| 10 import android.content.Intent; | 10 import android.content.Intent; |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 import org.chromium.chrome.browser.tab.Tab; | 59 import org.chromium.chrome.browser.tab.Tab; |
| 60 import org.chromium.chrome.browser.tabmodel.document.ActivityDelegateImpl; | 60 import org.chromium.chrome.browser.tabmodel.document.ActivityDelegateImpl; |
| 61 import org.chromium.chrome.browser.tabmodel.document.DocumentTabModelSelector; | 61 import org.chromium.chrome.browser.tabmodel.document.DocumentTabModelSelector; |
| 62 import org.chromium.chrome.browser.tabmodel.document.StorageDelegate; | 62 import org.chromium.chrome.browser.tabmodel.document.StorageDelegate; |
| 63 import org.chromium.chrome.browser.tabmodel.document.TabDelegate; | 63 import org.chromium.chrome.browser.tabmodel.document.TabDelegate; |
| 64 import org.chromium.chrome.browser.webapps.ChromeShortcutManager; | 64 import org.chromium.chrome.browser.webapps.ChromeShortcutManager; |
| 65 import org.chromium.chrome.browser.webapps.GooglePlayWebApkInstallDelegate; | 65 import org.chromium.chrome.browser.webapps.GooglePlayWebApkInstallDelegate; |
| 66 import org.chromium.components.signin.AccountManagerDelegate; | 66 import org.chromium.components.signin.AccountManagerDelegate; |
| 67 import org.chromium.components.signin.SystemAccountManagerDelegate; | 67 import org.chromium.components.signin.SystemAccountManagerDelegate; |
| 68 import org.chromium.content.app.ContentApplication; | 68 import org.chromium.content.app.ContentApplication; |
| 69 import org.chromium.content.browser.ChildProcessCreationParams; | |
| 70 import org.chromium.policy.AppRestrictionsProvider; | 69 import org.chromium.policy.AppRestrictionsProvider; |
| 71 import org.chromium.policy.CombinedPolicyProvider; | 70 import org.chromium.policy.CombinedPolicyProvider; |
| 72 | 71 |
| 73 /** | 72 /** |
| 74 * 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 |
| 75 * chrome layer. | 74 * chrome layer. |
| 76 */ | 75 */ |
| 77 @MainDex | 76 @MainDex |
| 78 public class ChromeApplication extends ContentApplication { | 77 public class ChromeApplication extends ContentApplication { |
| 79 public static final String COMMAND_LINE_FILE = "chrome-command-line"; | 78 public static final String COMMAND_LINE_FILE = "chrome-command-line"; |
| 80 | 79 |
| 81 private static final String TAG = "ChromiumApplication"; | 80 private static final String TAG = "ChromiumApplication"; |
| 82 private static final String PREF_BOOT_TIMESTAMP = | 81 private static final String PREF_BOOT_TIMESTAMP = |
| 83 "com.google.android.apps.chrome.ChromeMobileApplication.BOOT_TIMESTA
MP"; | 82 "com.google.android.apps.chrome.ChromeMobileApplication.BOOT_TIMESTA
MP"; |
| 84 private static final long BOOT_TIMESTAMP_MARGIN_MS = 1000; | 83 private static final long BOOT_TIMESTAMP_MARGIN_MS = 1000; |
| 85 | 84 |
| 86 private static DocumentTabModelSelector sDocumentTabModelSelector; | 85 private static DocumentTabModelSelector sDocumentTabModelSelector; |
| 87 | 86 |
| 88 @Override | 87 @Override |
| 89 protected void attachBaseContext(Context base) { | 88 protected void attachBaseContext(Context base) { |
| 90 super.attachBaseContext(base); | 89 super.attachBaseContext(base); |
| 91 ContextUtils.initApplicationContext(this); | 90 ContextUtils.initApplicationContext(this); |
| 92 } | 91 } |
| 93 | 92 |
| 94 /** | 93 /** |
| 95 * This is called during early initialization in order to set up ChildProces
sLauncher | |
| 96 * for certain Chrome packaging configurations | |
| 97 */ | |
| 98 public ChildProcessCreationParams getChildProcessCreationParams() { | |
| 99 return null; | |
| 100 } | |
| 101 | |
| 102 /** | |
| 103 * This is called once per ChromeApplication instance, which get created per
process | 94 * This is called once per ChromeApplication instance, which get created per
process |
| 104 * (browser OR renderer). Don't stick anything in here that shouldn't be ca
lled multiple times | 95 * (browser OR renderer). Don't stick anything in here that shouldn't be ca
lled multiple times |
| 105 * during Chrome's lifetime. | 96 * during Chrome's lifetime. |
| 106 */ | 97 */ |
| 107 @Override | 98 @Override |
| 108 public void onCreate() { | 99 public void onCreate() { |
| 109 UmaUtils.recordMainEntryPointTime(); | 100 UmaUtils.recordMainEntryPointTime(); |
| 110 initCommandLine(); | 101 initCommandLine(); |
| 111 TraceEvent.maybeEnableEarlyTracing(); | 102 TraceEvent.maybeEnableEarlyTracing(); |
| 112 TraceEvent.begin("ChromeApplication.onCreate"); | 103 TraceEvent.begin("ChromeApplication.onCreate"); |
| (...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 455 * @param notification The {@link Notification} to show. | 446 * @param notification The {@link Notification} to show. |
| 456 */ | 447 */ |
| 457 @SuppressWarnings("Unused") | 448 @SuppressWarnings("Unused") |
| 458 public void startServiceWithNotification( | 449 public void startServiceWithNotification( |
| 459 Intent intent, int notificationId, Notification notification) { | 450 Intent intent, int notificationId, Notification notification) { |
| 460 // TODO(dtrainor): Eventually make sure the service gets put into the fo
reground with | 451 // TODO(dtrainor): Eventually make sure the service gets put into the fo
reground with |
| 461 // {@link android.app.Service#startForeground(int, Notification)}. | 452 // {@link android.app.Service#startForeground(int, Notification)}. |
| 462 startService(intent); | 453 startService(intent); |
| 463 } | 454 } |
| 464 } | 455 } |
| OLD | NEW |