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.annotation.TargetApi; | 7 import android.annotation.TargetApi; |
8 import android.app.Activity; | 8 import android.app.Activity; |
9 import android.app.ActivityManager; | 9 import android.app.ActivityManager; |
10 import android.content.Context; | 10 import android.content.Context; |
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
354 | 354 |
355 super.finishNativeInitialization(); | 355 super.finishNativeInitialization(); |
356 } finally { | 356 } finally { |
357 TraceEvent.end("ChromeTabbedActivity.finishNativeInitialization"); | 357 TraceEvent.end("ChromeTabbedActivity.finishNativeInitialization"); |
358 } | 358 } |
359 } | 359 } |
360 | 360 |
361 @Override | 361 @Override |
362 public void onResumeWithNative() { | 362 public void onResumeWithNative() { |
363 super.onResumeWithNative(); | 363 super.onResumeWithNative(); |
364 | |
364 CookiesFetcher.restoreCookies(this); | 365 CookiesFetcher.restoreCookies(this); |
365 StartupMetrics.getInstance().recordHistogram(false); | 366 StartupMetrics.getInstance().recordHistogram(false); |
366 | 367 |
367 if (FeatureUtilities.isTabModelMergingEnabled()) { | 368 if (FeatureUtilities.isTabModelMergingEnabled()) { |
368 boolean inMultiWindowMode = MultiWindowUtils.getInstance().isInMulti WindowMode(this); | 369 boolean inMultiWindowMode = MultiWindowUtils.getInstance().isInMulti WindowMode(this); |
369 // Merge tabs if the activity is not in multi-window mode and mMerge TabsOnResume is true | 370 // Merge tabs if the activity is not in multi-window mode and mMerge TabsOnResume is true |
370 // or unset because the activity is just starting or was destroyed. | 371 // or unset because the activity is just starting or was destroyed. |
371 if (!inMultiWindowMode && (mMergeTabsOnResume == null || mMergeTabsO nResume)) { | 372 if (!inMultiWindowMode && (mMergeTabsOnResume == null || mMergeTabsO nResume)) { |
372 maybeMergeTabs(); | 373 maybeMergeTabs(); |
373 } | 374 } |
374 mMergeTabsOnResume = false; | 375 mMergeTabsOnResume = false; |
375 } | 376 } |
376 if (mVrShellDelegate.isInVR()) mVrShellDelegate.resumeVR(); | 377 if (mVrShellDelegate.isInVR()) mVrShellDelegate.resumeVR(); |
378 | |
379 mLocaleManager.setSnackbarManager(getSnackbarManager()); | |
Maria
2016/10/05 17:36:40
Your comment about onStart happening after onStart
| |
380 mLocaleManager.startObservingPhoneChanges(); | |
377 } | 381 } |
378 | 382 |
379 @Override | 383 @Override |
380 public void onPauseWithNative() { | 384 public void onPauseWithNative() { |
381 mTabModelSelectorImpl.commitAllTabClosures(); | 385 mTabModelSelectorImpl.commitAllTabClosures(); |
382 CookiesFetcher.persistCookies(this); | 386 CookiesFetcher.persistCookies(this); |
383 if (mVrShellDelegate.isInVR()) mVrShellDelegate.pauseVR(); | 387 if (mVrShellDelegate.isInVR()) mVrShellDelegate.pauseVR(); |
388 | |
389 mLocaleManager.setSnackbarManager(null); | |
390 mLocaleManager.stopObservingPhoneChanges(); | |
391 | |
384 super.onPauseWithNative(); | 392 super.onPauseWithNative(); |
385 } | 393 } |
386 | 394 |
387 @Override | 395 @Override |
388 public void onStopWithNative() { | 396 public void onStopWithNative() { |
389 super.onStopWithNative(); | 397 super.onStopWithNative(); |
390 | 398 |
391 if (getActivityTab() != null) getActivityTab().setIsAllowedToReturnToExt ernalApp(false); | 399 if (getActivityTab() != null) getActivityTab().setIsAllowedToReturnToExt ernalApp(false); |
392 | 400 |
393 mTabModelSelectorImpl.saveState(); | 401 mTabModelSelectorImpl.saveState(); |
394 StartupMetrics.getInstance().recordHistogram(true); | 402 StartupMetrics.getInstance().recordHistogram(true); |
395 mActivityStopMetrics.onStopWithNative(this); | 403 mActivityStopMetrics.onStopWithNative(this); |
396 | |
397 mLocaleManager.stopObservingPhoneChanges(); | |
398 } | 404 } |
399 | 405 |
400 @Override | 406 @Override |
401 public void onStart() { | 407 public void onStart() { |
402 super.onStart(); | 408 super.onStart(); |
403 StartupMetrics.getInstance().updateIntent(getIntent()); | 409 StartupMetrics.getInstance().updateIntent(getIntent()); |
404 } | 410 } |
405 | 411 |
406 @Override | 412 @Override |
407 public void onStartWithNative() { | 413 public void onStartWithNative() { |
408 super.onStartWithNative(); | 414 super.onStartWithNative(); |
409 // If we don't have a current tab, show the overview mode. | 415 // If we don't have a current tab, show the overview mode. |
410 if (getActivityTab() == null) mLayoutManager.showOverview(false); | 416 if (getActivityTab() == null) mLayoutManager.showOverview(false); |
411 | 417 |
412 mLocaleManager.startObservingPhoneChanges(); | |
413 | |
414 resetSavedInstanceState(); | 418 resetSavedInstanceState(); |
415 } | 419 } |
416 | 420 |
417 @Override | 421 @Override |
418 public void onNewIntentWithNative(Intent intent) { | 422 public void onNewIntentWithNative(Intent intent) { |
419 try { | 423 try { |
420 TraceEvent.begin("ChromeTabbedActivity.onNewIntentWithNative"); | 424 TraceEvent.begin("ChromeTabbedActivity.onNewIntentWithNative"); |
421 | 425 |
422 super.onNewIntentWithNative(intent); | 426 super.onNewIntentWithNative(intent); |
423 if (CommandLine.getInstance().hasSwitch(ContentSwitches.ENABLE_TEST_ INTENTS)) { | 427 if (CommandLine.getInstance().hasSwitch(ContentSwitches.ENABLE_TEST_ INTENTS)) { |
(...skipping 1132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1556 // TODO(mthiesse): Toggle toolbar overlay, popups, etc. | 1560 // TODO(mthiesse): Toggle toolbar overlay, popups, etc. |
1557 public void setUIVisibilityForVR(int visibility) { | 1561 public void setUIVisibilityForVR(int visibility) { |
1558 mControlContainer.setVisibility(visibility); | 1562 mControlContainer.setVisibility(visibility); |
1559 getCompositorViewHolder().getSurfaceView().setVisibility(visibility); | 1563 getCompositorViewHolder().getSurfaceView().setVisibility(visibility); |
1560 getCompositorViewHolder().setVisibility(visibility); | 1564 getCompositorViewHolder().setVisibility(visibility); |
1561 | 1565 |
1562 // Enter HTML5 fullscreen to ensure the texture fills the entire composi ted surface. | 1566 // Enter HTML5 fullscreen to ensure the texture fills the entire composi ted surface. |
1563 getFullscreenManager().setPersistentFullscreenMode(visibility == View.GO NE); | 1567 getFullscreenManager().setPersistentFullscreenMode(visibility == View.GO NE); |
1564 } | 1568 } |
1565 } | 1569 } |
OLD | NEW |