OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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.content.Context; | 7 import android.content.Context; |
8 import android.content.SharedPreferences; | 8 import android.content.SharedPreferences; |
9 import android.os.AsyncTask; | 9 import android.os.AsyncTask; |
10 import android.os.Looper; | 10 import android.os.Looper; |
(...skipping 14 matching lines...) Expand all Loading... |
25 import org.chromium.base.VisibleForTesting; | 25 import org.chromium.base.VisibleForTesting; |
26 import org.chromium.base.metrics.RecordHistogram; | 26 import org.chromium.base.metrics.RecordHistogram; |
27 import org.chromium.chrome.browser.bookmarkswidget.BookmarkWidgetProvider; | 27 import org.chromium.chrome.browser.bookmarkswidget.BookmarkWidgetProvider; |
28 import org.chromium.chrome.browser.crash.LogcatExtractionRunnable; | 28 import org.chromium.chrome.browser.crash.LogcatExtractionRunnable; |
29 import org.chromium.chrome.browser.crash.MinidumpUploadService; | 29 import org.chromium.chrome.browser.crash.MinidumpUploadService; |
30 import org.chromium.chrome.browser.init.ProcessInitializationHandler; | 30 import org.chromium.chrome.browser.init.ProcessInitializationHandler; |
31 import org.chromium.chrome.browser.locale.LocaleManager; | 31 import org.chromium.chrome.browser.locale.LocaleManager; |
32 import org.chromium.chrome.browser.media.MediaCaptureNotificationService; | 32 import org.chromium.chrome.browser.media.MediaCaptureNotificationService; |
33 import org.chromium.chrome.browser.metrics.LaunchMetrics; | 33 import org.chromium.chrome.browser.metrics.LaunchMetrics; |
34 import org.chromium.chrome.browser.metrics.UmaUtils; | 34 import org.chromium.chrome.browser.metrics.UmaUtils; |
| 35 import org.chromium.chrome.browser.notifications.ChannelsUpdater; |
35 import org.chromium.chrome.browser.ntp.NewTabPage; | 36 import org.chromium.chrome.browser.ntp.NewTabPage; |
36 import org.chromium.chrome.browser.offlinepages.OfflinePageUtils; | 37 import org.chromium.chrome.browser.offlinepages.OfflinePageUtils; |
37 import org.chromium.chrome.browser.partnerbookmarks.PartnerBookmarksShim; | 38 import org.chromium.chrome.browser.partnerbookmarks.PartnerBookmarksShim; |
38 import org.chromium.chrome.browser.partnercustomizations.HomepageManager; | 39 import org.chromium.chrome.browser.partnercustomizations.HomepageManager; |
39 import org.chromium.chrome.browser.partnercustomizations.PartnerBrowserCustomiza
tions; | 40 import org.chromium.chrome.browser.partnercustomizations.PartnerBrowserCustomiza
tions; |
40 import org.chromium.chrome.browser.physicalweb.PhysicalWeb; | 41 import org.chromium.chrome.browser.physicalweb.PhysicalWeb; |
41 import org.chromium.chrome.browser.precache.PrecacheLauncher; | 42 import org.chromium.chrome.browser.precache.PrecacheLauncher; |
42 import org.chromium.chrome.browser.preferences.ChromePreferenceManager; | 43 import org.chromium.chrome.browser.preferences.ChromePreferenceManager; |
43 import org.chromium.chrome.browser.share.ShareHelper; | 44 import org.chromium.chrome.browser.share.ShareHelper; |
44 import org.chromium.chrome.browser.webapps.ChromeWebApkHost; | 45 import org.chromium.chrome.browser.webapps.ChromeWebApkHost; |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 } | 194 } |
194 }); | 195 }); |
195 | 196 |
196 PartnerBookmarksShim.kickOffReading(mAppContext); | 197 PartnerBookmarksShim.kickOffReading(mAppContext); |
197 | 198 |
198 PowerMonitor.create(); | 199 PowerMonitor.create(); |
199 | 200 |
200 ShareHelper.clearSharedImages(); | 201 ShareHelper.clearSharedImages(); |
201 | 202 |
202 OfflinePageUtils.clearSharedOfflineFiles(mAppContext); | 203 OfflinePageUtils.clearSharedOfflineFiles(mAppContext); |
| 204 |
| 205 if (ChannelsUpdater.getInstance().shouldUpdateChannels()) { |
| 206 initChannelsAsync(); |
| 207 } |
203 } | 208 } |
204 }); | 209 }); |
205 | 210 |
206 mDeferredTasks.add(new Runnable() { | 211 mDeferredTasks.add(new Runnable() { |
207 @Override | 212 @Override |
208 public void run() { | 213 public void run() { |
209 // Clear any media notifications that existed when Chrome was la
st killed. | 214 // Clear any media notifications that existed when Chrome was la
st killed. |
210 MediaCaptureNotificationService.clearMediaNotifications(mAppCont
ext); | 215 MediaCaptureNotificationService.clearMediaNotifications(mAppCont
ext); |
211 | 216 |
212 startModerateBindingManagementIfNeeded(); | 217 startModerateBindingManagementIfNeeded(); |
(...skipping 29 matching lines...) Expand all Loading... |
242 @Override | 247 @Override |
243 public void run() { | 248 public void run() { |
244 // Record the saved restore state in a histogram | 249 // Record the saved restore state in a histogram |
245 ChromeBackupAgent.recordRestoreHistogram(); | 250 ChromeBackupAgent.recordRestoreHistogram(); |
246 } | 251 } |
247 }); | 252 }); |
248 | 253 |
249 ProcessInitializationHandler.getInstance().initializeDeferredStartupTask
s(); | 254 ProcessInitializationHandler.getInstance().initializeDeferredStartupTask
s(); |
250 } | 255 } |
251 | 256 |
| 257 private void initChannelsAsync() { |
| 258 new AsyncTask<Void, Void, Void>() { |
| 259 @Override |
| 260 protected Void doInBackground(Void... params) { |
| 261 ChannelsUpdater.getInstance().updateChannels(); |
| 262 return null; |
| 263 } |
| 264 |
| 265 } |
| 266 .executeOnExecutor(AsyncTask.SERIAL_EXECUTOR); |
| 267 } |
| 268 |
252 private void initAsyncDiskTask() { | 269 private void initAsyncDiskTask() { |
253 new AsyncTask<Void, Void, Void>() { | 270 new AsyncTask<Void, Void, Void>() { |
254 /** | 271 /** |
255 * The threshold after which it's no longer appropriate to try to at
tach logcat output | 272 * The threshold after which it's no longer appropriate to try to at
tach logcat output |
256 * to a minidump file. | 273 * to a minidump file. |
257 * Note: This threshold of 12 hours was chosen fairly imprecisely, b
ased on the | 274 * Note: This threshold of 12 hours was chosen fairly imprecisely, b
ased on the |
258 * following intuition: On the one hand, Chrome can only access its
own logcat output, | 275 * following intuition: On the one hand, Chrome can only access its
own logcat output, |
259 * so the most recent lines should be relevant when available. On a
typical device, | 276 * so the most recent lines should be relevant when available. On a
typical device, |
260 * multiple hours of logcat output are available. On the other hand,
it's important to | 277 * multiple hours of logcat output are available. On the other hand,
it's important to |
261 * provide an escape hatch in case the logcat extraction code itself
crashes, as | 278 * provide an escape hatch in case the logcat extraction code itself
crashes, as |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
457 } | 474 } |
458 | 475 |
459 /** | 476 /** |
460 * @return Whether deferred startup has been completed. | 477 * @return Whether deferred startup has been completed. |
461 */ | 478 */ |
462 @VisibleForTesting | 479 @VisibleForTesting |
463 public boolean isDeferredStartupCompleteForApp() { | 480 public boolean isDeferredStartupCompleteForApp() { |
464 return mDeferredStartupCompletedForApp; | 481 return mDeferredStartupCompletedForApp; |
465 } | 482 } |
466 } | 483 } |
OLD | NEW |