| 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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 import org.chromium.chrome.browser.compositor.layouts.eventfilter.EventFilter; | 54 import org.chromium.chrome.browser.compositor.layouts.eventfilter.EventFilter; |
| 55 import org.chromium.chrome.browser.compositor.layouts.phone.StackLayout; | 55 import org.chromium.chrome.browser.compositor.layouts.phone.StackLayout; |
| 56 import org.chromium.chrome.browser.cookies.CookiesFetcher; | 56 import org.chromium.chrome.browser.cookies.CookiesFetcher; |
| 57 import org.chromium.chrome.browser.device.DeviceClassManager; | 57 import org.chromium.chrome.browser.device.DeviceClassManager; |
| 58 import org.chromium.chrome.browser.document.ChromeLauncherActivity; | 58 import org.chromium.chrome.browser.document.ChromeLauncherActivity; |
| 59 import org.chromium.chrome.browser.download.DownloadUtils; | 59 import org.chromium.chrome.browser.download.DownloadUtils; |
| 60 import org.chromium.chrome.browser.firstrun.FirstRunActivity; | 60 import org.chromium.chrome.browser.firstrun.FirstRunActivity; |
| 61 import org.chromium.chrome.browser.firstrun.FirstRunFlowSequencer; | 61 import org.chromium.chrome.browser.firstrun.FirstRunFlowSequencer; |
| 62 import org.chromium.chrome.browser.firstrun.FirstRunSignInProcessor; | 62 import org.chromium.chrome.browser.firstrun.FirstRunSignInProcessor; |
| 63 import org.chromium.chrome.browser.firstrun.FirstRunStatus; | 63 import org.chromium.chrome.browser.firstrun.FirstRunStatus; |
| 64 import org.chromium.chrome.browser.fullscreen.ChromeFullscreenManager; |
| 64 import org.chromium.chrome.browser.incognito.IncognitoNotificationManager; | 65 import org.chromium.chrome.browser.incognito.IncognitoNotificationManager; |
| 65 import org.chromium.chrome.browser.infobar.DataReductionPromoInfoBar; | 66 import org.chromium.chrome.browser.infobar.DataReductionPromoInfoBar; |
| 66 import org.chromium.chrome.browser.locale.LocaleManager; | 67 import org.chromium.chrome.browser.locale.LocaleManager; |
| 67 import org.chromium.chrome.browser.metrics.ActivityStopMetrics; | 68 import org.chromium.chrome.browser.metrics.ActivityStopMetrics; |
| 68 import org.chromium.chrome.browser.metrics.LaunchMetrics; | 69 import org.chromium.chrome.browser.metrics.LaunchMetrics; |
| 69 import org.chromium.chrome.browser.metrics.StartupMetrics; | 70 import org.chromium.chrome.browser.metrics.StartupMetrics; |
| 70 import org.chromium.chrome.browser.metrics.UmaUtils; | 71 import org.chromium.chrome.browser.metrics.UmaUtils; |
| 71 import org.chromium.chrome.browser.multiwindow.MultiWindowUtils; | 72 import org.chromium.chrome.browser.multiwindow.MultiWindowUtils; |
| 72 import org.chromium.chrome.browser.ntp.NativePageAssassin; | 73 import org.chromium.chrome.browser.ntp.NativePageAssassin; |
| 73 import org.chromium.chrome.browser.ntp.NewTabPageUma; | 74 import org.chromium.chrome.browser.ntp.NewTabPageUma; |
| (...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 542 | 543 |
| 543 mUndoBarPopupController.initialize(); | 544 mUndoBarPopupController.initialize(); |
| 544 | 545 |
| 545 // Adjust the content container if we're not entering fullscreen mod
e. | 546 // Adjust the content container if we're not entering fullscreen mod
e. |
| 546 if (getFullscreenManager() == null) { | 547 if (getFullscreenManager() == null) { |
| 547 float controlHeight = getResources().getDimension(R.dimen.contro
l_container_height); | 548 float controlHeight = getResources().getDimension(R.dimen.contro
l_container_height); |
| 548 ((FrameLayout.LayoutParams) mContentContainer.getLayoutParams())
.topMargin = | 549 ((FrameLayout.LayoutParams) mContentContainer.getLayoutParams())
.topMargin = |
| 549 (int) controlHeight; | 550 (int) controlHeight; |
| 550 } | 551 } |
| 551 | 552 |
| 552 // Bootstrap the first tab as it may have been created before initia
lizing the | |
| 553 // fullscreen manager. | |
| 554 if (mTabModelSelectorImpl != null && mTabModelSelectorImpl.getCurren
tTab() != null | |
| 555 && getFullscreenManager() != null) { | |
| 556 getFullscreenManager().setTab(mTabModelSelectorImpl.getCurrentTa
b()); | |
| 557 } | |
| 558 | |
| 559 mFindToolbarManager = new FindToolbarManager(this, | 553 mFindToolbarManager = new FindToolbarManager(this, |
| 560 getToolbarManager().getActionModeController().getActionModeC
allback()); | 554 getToolbarManager().getActionModeController().getActionModeC
allback()); |
| 561 if (getContextualSearchManager() != null) { | 555 if (getContextualSearchManager() != null) { |
| 562 getContextualSearchManager().setFindToolbarManager(mFindToolbarM
anager); | 556 getContextualSearchManager().setFindToolbarManager(mFindToolbarM
anager); |
| 563 } | 557 } |
| 564 | 558 |
| 565 OnClickListener tabSwitcherClickHandler = new OnClickListener() { | 559 OnClickListener tabSwitcherClickHandler = new OnClickListener() { |
| 566 @Override | 560 @Override |
| 567 public void onClick(View v) { | 561 public void onClick(View v) { |
| 568 if (getFullscreenManager() != null | 562 if (getFullscreenManager() != null |
| (...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1037 AutocompleteController.nativePrefetchZeroSuggestResults(); | 1031 AutocompleteController.nativePrefetchZeroSuggestResults(); |
| 1038 } | 1032 } |
| 1039 }); | 1033 }); |
| 1040 } | 1034 } |
| 1041 | 1035 |
| 1042 private void createTabModelSelectorImpl(Bundle savedInstanceState) { | 1036 private void createTabModelSelectorImpl(Bundle savedInstanceState) { |
| 1043 // We determine the model as soon as possible so every systems get initi
alized coherently. | 1037 // We determine the model as soon as possible so every systems get initi
alized coherently. |
| 1044 boolean startIncognito = savedInstanceState != null | 1038 boolean startIncognito = savedInstanceState != null |
| 1045 && savedInstanceState.getBoolean("is_incognito_selected", false)
; | 1039 && savedInstanceState.getBoolean("is_incognito_selected", false)
; |
| 1046 int index = savedInstanceState != null ? savedInstanceState.getInt(WINDO
W_INDEX, 0) : 0; | 1040 int index = savedInstanceState != null ? savedInstanceState.getInt(WINDO
W_INDEX, 0) : 0; |
| 1041 |
| 1047 mTabModelSelectorImpl = (TabModelSelectorImpl) | 1042 mTabModelSelectorImpl = (TabModelSelectorImpl) |
| 1048 TabWindowManager.getInstance().requestSelector(this, index); | 1043 TabWindowManager.getInstance().requestSelector(this, this, getFu
llscreenManager(), |
| 1044 index); |
| 1049 if (mTabModelSelectorImpl == null) { | 1045 if (mTabModelSelectorImpl == null) { |
| 1050 Toast.makeText(this, getString(R.string.unsupported_number_of_window
s), | 1046 Toast.makeText(this, getString(R.string.unsupported_number_of_window
s), |
| 1051 Toast.LENGTH_LONG).show(); | 1047 Toast.LENGTH_LONG).show(); |
| 1052 finish(); | 1048 finish(); |
| 1053 return; | 1049 return; |
| 1054 } | 1050 } |
| 1055 setTabCreators( | 1051 setTabCreators( |
| 1056 new TabbedModeTabCreator(this, getWindowAndroid(), false), | 1052 new TabbedModeTabCreator(this, getWindowAndroid(), false), |
| 1057 new TabbedModeTabCreator(this, getWindowAndroid(), true)); | 1053 new TabbedModeTabCreator(this, getWindowAndroid(), true)); |
| 1058 mTabModelSelectorTabObserver = new TabModelSelectorTabObserver(mTabModel
SelectorImpl) { | 1054 mTabModelSelectorTabObserver = new TabModelSelectorTabObserver(mTabModel
SelectorImpl) { |
| (...skipping 581 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1640 method.invoke(getSystemService(clazz), | 1636 method.invoke(getSystemService(clazz), |
| 1641 isIncognito ? "new-incognito-tab-shortcut" : "new-tab-shortc
ut"); | 1637 isIncognito ? "new-incognito-tab-shortcut" : "new-tab-shortc
ut"); |
| 1642 } catch (Exception e) { | 1638 } catch (Exception e) { |
| 1643 e.printStackTrace(); | 1639 e.printStackTrace(); |
| 1644 } | 1640 } |
| 1645 } | 1641 } |
| 1646 | 1642 |
| 1647 public VrShellDelegate getVrShellDelegate() { | 1643 public VrShellDelegate getVrShellDelegate() { |
| 1648 return mVrShellDelegate; | 1644 return mVrShellDelegate; |
| 1649 } | 1645 } |
| 1646 |
| 1647 @Override |
| 1648 protected ChromeFullscreenManager createFullscreenManager() { |
| 1649 return new ChromeFullscreenManager(this, |
| 1650 (ToolbarControlContainer) findViewById(R.id.control_container), |
| 1651 getControlContainerHeightResource(), true); |
| 1652 } |
| 1650 } | 1653 } |
| OLD | NEW |