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 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
234 } | 234 } |
235 } | 235 } |
236 | 236 |
237 @Override | 237 @Override |
238 public void initializeCompositor() { | 238 public void initializeCompositor() { |
239 try { | 239 try { |
240 TraceEvent.begin("ChromeTabbedActivity.initializeCompositor"); | 240 TraceEvent.begin("ChromeTabbedActivity.initializeCompositor"); |
241 super.initializeCompositor(); | 241 super.initializeCompositor(); |
242 | 242 |
243 mTabModelSelectorImpl.onNativeLibraryReady(getTabContentManager()); | 243 mTabModelSelectorImpl.onNativeLibraryReady(getTabContentManager()); |
| 244 mVrShellDelegate.onNativeLibraryReady(); |
244 | 245 |
245 mTabModelObserver = new EmptyTabModelObserver() { | 246 mTabModelObserver = new EmptyTabModelObserver() { |
246 @Override | 247 @Override |
247 public void didCloseTab(int tabId, boolean incognito) { | 248 public void didCloseTab(int tabId, boolean incognito) { |
248 closeIfNoTabsAndHomepageEnabled(false); | 249 closeIfNoTabsAndHomepageEnabled(false); |
249 } | 250 } |
250 | 251 |
251 @Override | 252 @Override |
252 public void tabPendingClosure(Tab tab) { | 253 public void tabPendingClosure(Tab tab) { |
253 closeIfNoTabsAndHomepageEnabled(true); | 254 closeIfNoTabsAndHomepageEnabled(true); |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
410 @Override | 411 @Override |
411 public void onNewIntentWithNative(Intent intent) { | 412 public void onNewIntentWithNative(Intent intent) { |
412 try { | 413 try { |
413 TraceEvent.begin("ChromeTabbedActivity.onNewIntentWithNative"); | 414 TraceEvent.begin("ChromeTabbedActivity.onNewIntentWithNative"); |
414 | 415 |
415 super.onNewIntentWithNative(intent); | 416 super.onNewIntentWithNative(intent); |
416 if (CommandLine.getInstance().hasSwitch(ContentSwitches.ENABLE_TEST_
INTENTS)) { | 417 if (CommandLine.getInstance().hasSwitch(ContentSwitches.ENABLE_TEST_
INTENTS)) { |
417 handleDebugIntent(intent); | 418 handleDebugIntent(intent); |
418 } | 419 } |
419 if (!mVrShellDelegate.isInVR() && mVrShellDelegate.isVrIntent(intent
)) { | 420 if (!mVrShellDelegate.isInVR() && mVrShellDelegate.isVrIntent(intent
)) { |
420 mVrShellDelegate.enterVRIfNecessary(); | 421 mVrShellDelegate.enterVRIfNecessary(false); |
421 } | 422 } |
422 } finally { | 423 } finally { |
423 TraceEvent.end("ChromeTabbedActivity.onNewIntentWithNative"); | 424 TraceEvent.end("ChromeTabbedActivity.onNewIntentWithNative"); |
424 } | 425 } |
425 } | 426 } |
426 | 427 |
427 @Override | 428 @Override |
428 public ChromeTabCreator getTabCreator(boolean incognito) { | 429 public ChromeTabCreator getTabCreator(boolean incognito) { |
429 TabCreator tabCreator = super.getTabCreator(incognito); | 430 TabCreator tabCreator = super.getTabCreator(incognito); |
430 assert tabCreator instanceof ChromeTabCreator; | 431 assert tabCreator instanceof ChromeTabCreator; |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
599 // away in Recents. http://crbug.com/626629 | 600 // away in Recents. http://crbug.com/626629 |
600 boolean ignoreIncognitoFiles = !hadCipherData; | 601 boolean ignoreIncognitoFiles = !hadCipherData; |
601 mTabModelSelectorImpl.loadState(ignoreIncognitoFiles); | 602 mTabModelSelectorImpl.loadState(ignoreIncognitoFiles); |
602 } | 603 } |
603 | 604 |
604 mIntentWithEffect = false; | 605 mIntentWithEffect = false; |
605 if ((mIsOnFirstRun || getSavedInstanceState() == null) && intent !=
null) { | 606 if ((mIsOnFirstRun || getSavedInstanceState() == null) && intent !=
null) { |
606 if (mVrShellDelegate.isVrIntent(intent)) { | 607 if (mVrShellDelegate.isVrIntent(intent)) { |
607 // TODO(mthiesse): Improve startup when started from a VR in
tent. Right now | 608 // TODO(mthiesse): Improve startup when started from a VR in
tent. Right now |
608 // we launch out of VR, partially load out of VR, then switc
h into VR. | 609 // we launch out of VR, partially load out of VR, then switc
h into VR. |
609 mVrShellDelegate.enterVRIfNecessary(); | 610 mVrShellDelegate.enterVRIfNecessary(false); |
610 } else if (!mIntentHandler.shouldIgnoreIntent(ChromeTabbedActivi
ty.this, intent)) { | 611 } else if (!mIntentHandler.shouldIgnoreIntent(ChromeTabbedActivi
ty.this, intent)) { |
611 mIntentWithEffect = mIntentHandler.onNewIntent(ChromeTabbedA
ctivity.this, | 612 mIntentWithEffect = mIntentHandler.onNewIntent(ChromeTabbedA
ctivity.this, |
612 intent); | 613 intent); |
613 } | 614 } |
614 } | 615 } |
615 | 616 |
616 mCreatedTabOnStartup = getCurrentTabModel().getCount() > 0 | 617 mCreatedTabOnStartup = getCurrentTabModel().getCount() > 0 |
617 || mTabModelSelectorImpl.getRestoredTabCount() > 0 | 618 || mTabModelSelectorImpl.getRestoredTabCount() > 0 |
618 || mIntentWithEffect; | 619 || mIntentWithEffect; |
619 | 620 |
(...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1131 getToolbarManager().setUrlBarFocus(true); | 1132 getToolbarManager().setUrlBarFocus(true); |
1132 } | 1133 } |
1133 } else if (id == R.id.downloads_menu_id) { | 1134 } else if (id == R.id.downloads_menu_id) { |
1134 DownloadUtils.showDownloadManager(this, currentTab); | 1135 DownloadUtils.showDownloadManager(this, currentTab); |
1135 RecordUserAction.record("MobileMenuDownloadManager"); | 1136 RecordUserAction.record("MobileMenuDownloadManager"); |
1136 } else if (id == R.id.open_recently_closed_tab) { | 1137 } else if (id == R.id.open_recently_closed_tab) { |
1137 TabModel currentModel = mTabModelSelectorImpl.getCurrentModel(); | 1138 TabModel currentModel = mTabModelSelectorImpl.getCurrentModel(); |
1138 if (!currentModel.isIncognito()) currentModel.openMostRecentlyClosed
Tab(); | 1139 if (!currentModel.isIncognito()) currentModel.openMostRecentlyClosed
Tab(); |
1139 RecordUserAction.record("MobileTabClosedUndoShortCut"); | 1140 RecordUserAction.record("MobileTabClosedUndoShortCut"); |
1140 } else if (id == R.id.enter_vr_id) { | 1141 } else if (id == R.id.enter_vr_id) { |
1141 mVrShellDelegate.enterVRIfNecessary(); | 1142 mVrShellDelegate.enterVRIfNecessary(false); |
1142 } else { | 1143 } else { |
1143 return super.onMenuOrKeyboardAction(id, fromMenu); | 1144 return super.onMenuOrKeyboardAction(id, fromMenu); |
1144 } | 1145 } |
1145 return true; | 1146 return true; |
1146 } | 1147 } |
1147 | 1148 |
1148 private void recordBackPressedUma(String logMessage, @BackPressedResult int
action) { | 1149 private void recordBackPressedUma(String logMessage, @BackPressedResult int
action) { |
1149 Log.i(TAG, "Back pressed: " + logMessage); | 1150 Log.i(TAG, "Back pressed: " + logMessage); |
1150 RecordHistogram.recordEnumeratedHistogram( | 1151 RecordHistogram.recordEnumeratedHistogram( |
1151 "Android.Activity.ChromeTabbedActivity.SystemBackAction", | 1152 "Android.Activity.ChromeTabbedActivity.SystemBackAction", |
(...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1603 return mVrShellDelegate.isVrShellEnabled(); | 1604 return mVrShellDelegate.isVrShellEnabled(); |
1604 } | 1605 } |
1605 | 1606 |
1606 // TODO(mthiesse): Toggle toolbar overlay, popups, etc. | 1607 // TODO(mthiesse): Toggle toolbar overlay, popups, etc. |
1607 public void setUIVisibilityForVR(int visibility) { | 1608 public void setUIVisibilityForVR(int visibility) { |
1608 mControlContainer.setVisibility(visibility); | 1609 mControlContainer.setVisibility(visibility); |
1609 getCompositorViewHolder().getSurfaceView().setVisibility(visibility); | 1610 getCompositorViewHolder().getSurfaceView().setVisibility(visibility); |
1610 getCompositorViewHolder().setVisibility(visibility); | 1611 getCompositorViewHolder().setVisibility(visibility); |
1611 } | 1612 } |
1612 } | 1613 } |
OLD | NEW |