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