| 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; |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 199 } | 199 } |
| 200 | 200 |
| 201 /** | 201 /** |
| 202 * This is called once per ChromeApplication instance, which get created per
process | 202 * This is called once per ChromeApplication instance, which get created per
process |
| 203 * (browser OR renderer). Don't stick anything in here that shouldn't be ca
lled multiple times | 203 * (browser OR renderer). Don't stick anything in here that shouldn't be ca
lled multiple times |
| 204 * during Chrome's lifetime. | 204 * during Chrome's lifetime. |
| 205 */ | 205 */ |
| 206 @Override | 206 @Override |
| 207 public void onCreate() { | 207 public void onCreate() { |
| 208 UmaUtils.recordMainEntryPointTime(); | 208 UmaUtils.recordMainEntryPointTime(); |
| 209 initCommandLine(); |
| 210 TraceEvent.maybeEnableEarlyTracing(); |
| 211 TraceEvent.begin("ChromeApplication.onCreate"); |
| 212 |
| 209 super.onCreate(); | 213 super.onCreate(); |
| 210 ContextUtils.initApplicationContext(this); | 214 ContextUtils.initApplicationContext(this); |
| 211 | 215 |
| 212 UiUtils.setKeyboardShowingDelegate(new UiUtils.KeyboardShowingDelegate()
{ | 216 UiUtils.setKeyboardShowingDelegate(new UiUtils.KeyboardShowingDelegate()
{ |
| 213 @Override | 217 @Override |
| 214 public boolean disableKeyboardCheck(Context context, View view) { | 218 public boolean disableKeyboardCheck(Context context, View view) { |
| 215 Activity activity = null; | 219 Activity activity = null; |
| 216 if (context instanceof Activity) { | 220 if (context instanceof Activity) { |
| 217 activity = (Activity) context; | 221 activity = (Activity) context; |
| 218 } else if (view != null && view.getContext() instanceof Activity
) { | 222 } else if (view != null && view.getContext() instanceof Activity
) { |
| (...skipping 18 matching lines...) Expand all Loading... |
| 237 | 241 |
| 238 // Set minimum Tango log level. This sets an in-memory static field, and
needs to be | 242 // Set minimum Tango log level. This sets an in-memory static field, and
needs to be |
| 239 // set in the ApplicationContext instead of an activity, since Tango can
be woken up | 243 // set in the ApplicationContext instead of an activity, since Tango can
be woken up |
| 240 // by the system directly though messages from GCM. | 244 // by the system directly though messages from GCM. |
| 241 AndroidLogger.setMinimumAndroidLogLevel(Log.WARN); | 245 AndroidLogger.setMinimumAndroidLogLevel(Log.WARN); |
| 242 | 246 |
| 243 // Set up the identification generator for sync. The ID is actually gene
rated | 247 // Set up the identification generator for sync. The ID is actually gene
rated |
| 244 // in the SyncController constructor. | 248 // in the SyncController constructor. |
| 245 UniqueIdentificationGeneratorFactory.registerGenerator(SyncController.GE
NERATOR_ID, | 249 UniqueIdentificationGeneratorFactory.registerGenerator(SyncController.GE
NERATOR_ID, |
| 246 new UuidBasedUniqueIdentificationGenerator(this, SESSIONS_UUID_P
REF_KEY), false); | 250 new UuidBasedUniqueIdentificationGenerator(this, SESSIONS_UUID_P
REF_KEY), false); |
| 251 TraceEvent.end("ChromeApplication.onCreate"); |
| 247 } | 252 } |
| 248 | 253 |
| 249 /** | 254 /** |
| 250 * Each top-level activity (ChromeTabbedActivity, FullscreenActivity) should
call this during | 255 * Each top-level activity (ChromeTabbedActivity, FullscreenActivity) should
call this during |
| 251 * its onStart phase. When called for the first time, this marks the beginni
ng of a foreground | 256 * its onStart phase. When called for the first time, this marks the beginni
ng of a foreground |
| 252 * session and calls onForegroundSessionStart(). Subsequent calls are noops
until | 257 * session and calls onForegroundSessionStart(). Subsequent calls are noops
until |
| 253 * onForegroundSessionEnd() is called, to handle changing top-level Chrome a
ctivities in one | 258 * onForegroundSessionEnd() is called, to handle changing top-level Chrome a
ctivities in one |
| 254 * foreground session. | 259 * foreground session. |
| 255 */ | 260 */ |
| 256 public void onStartWithNative() { | 261 public void onStartWithNative() { |
| (...skipping 600 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 857 * Caches flags that are needed by Activities that launch before the native
library is loaded | 862 * Caches flags that are needed by Activities that launch before the native
library is loaded |
| 858 * and stores them in SharedPreferences. Because this function is called dur
ing launch after the | 863 * and stores them in SharedPreferences. Because this function is called dur
ing launch after the |
| 859 * library has loaded, they won't affect the next launch until Chrome is res
tarted. | 864 * library has loaded, they won't affect the next launch until Chrome is res
tarted. |
| 860 */ | 865 */ |
| 861 private void cacheNativeFlags() { | 866 private void cacheNativeFlags() { |
| 862 if (sIsFinishedCachingNativeFlags) return; | 867 if (sIsFinishedCachingNativeFlags) return; |
| 863 FeatureUtilities.cacheNativeFlags(this); | 868 FeatureUtilities.cacheNativeFlags(this); |
| 864 sIsFinishedCachingNativeFlags = true; | 869 sIsFinishedCachingNativeFlags = true; |
| 865 } | 870 } |
| 866 } | 871 } |
| OLD | NEW |