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.SuppressLint; | 7 import android.annotation.SuppressLint; |
8 import android.annotation.TargetApi; | 8 import android.annotation.TargetApi; |
9 import android.app.Activity; | 9 import android.app.Activity; |
10 import android.app.SearchManager; | 10 import android.app.SearchManager; |
(...skipping 749 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
760 setTabContentManager(new TabContentManager(this, getContentOffsetProvide
r(), | 760 setTabContentManager(new TabContentManager(this, getContentOffsetProvide
r(), |
761 DeviceClassManager.enableSnapshots())); | 761 DeviceClassManager.enableSnapshots())); |
762 mCompositorViewHolder.onNativeLibraryReady(getWindowAndroid(), getTabCon
tentManager()); | 762 mCompositorViewHolder.onNativeLibraryReady(getWindowAndroid(), getTabCon
tentManager()); |
763 | 763 |
764 if (isContextualSearchAllowed() && ContextualSearchFieldTrial.isEnabled(
)) { | 764 if (isContextualSearchAllowed() && ContextualSearchFieldTrial.isEnabled(
)) { |
765 mContextualSearchManager = new ContextualSearchManager(this, this); | 765 mContextualSearchManager = new ContextualSearchManager(this, this); |
766 } | 766 } |
767 | 767 |
768 if (ReaderModeManager.isEnabled(this)) { | 768 if (ReaderModeManager.isEnabled(this)) { |
769 mReaderModeManager = new ReaderModeManager(getTabModelSelector(), th
is); | 769 mReaderModeManager = new ReaderModeManager(getTabModelSelector(), th
is); |
770 if (mToolbarManager != null) { | |
771 mToolbarManager.addFindToolbarObserver( | |
772 mReaderModeManager.getFindToolbarObserver()); | |
773 } | |
774 } | 770 } |
775 | 771 |
776 TraceEvent.end("ChromeActivity:CompositorInitialization"); | 772 TraceEvent.end("ChromeActivity:CompositorInitialization"); |
777 } | 773 } |
778 | 774 |
779 @Override | 775 @Override |
780 public void onStartWithNative() { | 776 public void onStartWithNative() { |
781 assert mNativeInitialized : "onStartWithNative was called before native
was initialized."; | 777 assert mNativeInitialized : "onStartWithNative was called before native
was initialized."; |
782 | 778 |
783 super.onStartWithNative(); | 779 super.onStartWithNative(); |
(...skipping 552 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1336 * @return Whether the activity is in overview mode. | 1332 * @return Whether the activity is in overview mode. |
1337 */ | 1333 */ |
1338 public boolean isInOverviewMode() { | 1334 public boolean isInOverviewMode() { |
1339 return false; | 1335 return false; |
1340 } | 1336 } |
1341 | 1337 |
1342 /** | 1338 /** |
1343 * @return Whether the app menu should be shown. | 1339 * @return Whether the app menu should be shown. |
1344 */ | 1340 */ |
1345 public boolean shouldShowAppMenu() { | 1341 public boolean shouldShowAppMenu() { |
1346 // Do not show the menu if Contextual Search or Reader Mode panel is ope
ned. | 1342 // Do not show the menu if Contextual Search panel is opened. |
1347 // TODO(mdjones): This could potentially be handled by the OverlayPanelM
anager or as | 1343 if (mContextualSearchManager != null && mContextualSearchManager.isSearc
hPanelOpened()) { |
1348 // an event if the panels were SceneOverlays. | |
1349 if ((mContextualSearchManager != null && mContextualSearchManager.isSear
chPanelOpened()) | |
1350 || (mReaderModeManager != null && mReaderModeManager.isPanelOpen
ed())) { | |
1351 return false; | 1344 return false; |
1352 } | 1345 } |
1353 | 1346 |
1354 return true; | 1347 return true; |
1355 } | 1348 } |
1356 | 1349 |
1357 /** | 1350 /** |
1358 * Shows the app menu (if possible) for a key press on the keyboard with the
correct anchor view | 1351 * Shows the app menu (if possible) for a key press on the keyboard with the
correct anchor view |
1359 * chosen depending on device configuration and the visible menu button to th
e user. | 1352 * chosen depending on device configuration and the visible menu button to th
e user. |
1360 */ | 1353 */ |
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1641 mContextualSearchManager.setSearchContentViewDelegate(layoutManager)
; | 1634 mContextualSearchManager.setSearchContentViewDelegate(layoutManager)
; |
1642 } | 1635 } |
1643 | 1636 |
1644 layoutManager.addSceneChangeObserver(this); | 1637 layoutManager.addSceneChangeObserver(this); |
1645 mCompositorViewHolder.setLayoutManager(layoutManager); | 1638 mCompositorViewHolder.setLayoutManager(layoutManager); |
1646 mCompositorViewHolder.setFocusable(false); | 1639 mCompositorViewHolder.setFocusable(false); |
1647 mCompositorViewHolder.setControlContainer(controlContainer); | 1640 mCompositorViewHolder.setControlContainer(controlContainer); |
1648 mCompositorViewHolder.setFullscreenHandler(getFullscreenManager()); | 1641 mCompositorViewHolder.setFullscreenHandler(getFullscreenManager()); |
1649 mCompositorViewHolder.setUrlBar(urlBar); | 1642 mCompositorViewHolder.setUrlBar(urlBar); |
1650 mCompositorViewHolder.onFinishNativeInitialization(getTabModelSelector()
, this, | 1643 mCompositorViewHolder.onFinishNativeInitialization(getTabModelSelector()
, this, |
1651 getTabContentManager(), contentContainer, mContextualSearchManag
er, | 1644 getTabContentManager(), contentContainer, mContextualSearchManag
er); |
1652 mReaderModeManager); | |
1653 | 1645 |
1654 if (controlContainer != null | 1646 if (controlContainer != null |
1655 && DeviceClassManager.enableToolbarSwipe()) { | 1647 && DeviceClassManager.enableToolbarSwipe()) { |
1656 controlContainer.setSwipeHandler( | 1648 controlContainer.setSwipeHandler( |
1657 getCompositorViewHolder().getLayoutManager().getTopSwipeHand
ler()); | 1649 getCompositorViewHolder().getLayoutManager().getTopSwipeHand
ler()); |
1658 } | 1650 } |
1659 } | 1651 } |
1660 | 1652 |
1661 /** | 1653 /** |
1662 * Called when the back button is pressed. | 1654 * Called when the back button is pressed. |
(...skipping 558 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2221 return false; | 2213 return false; |
2222 } | 2214 } |
2223 | 2215 |
2224 /** | 2216 /** |
2225 * @return the reference pool for this activity. | 2217 * @return the reference pool for this activity. |
2226 */ | 2218 */ |
2227 public DiscardableReferencePool getReferencePool() { | 2219 public DiscardableReferencePool getReferencePool() { |
2228 return mReferencePool; | 2220 return mReferencePool; |
2229 } | 2221 } |
2230 } | 2222 } |
OLD | NEW |