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 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 private CompositorViewHolder mCompositorViewHolder; | 228 private CompositorViewHolder mCompositorViewHolder; |
229 private InsetObserverView mInsetObserverView; | 229 private InsetObserverView mInsetObserverView; |
230 private ContextualSearchManager mContextualSearchManager; | 230 private ContextualSearchManager mContextualSearchManager; |
231 private ReaderModeManager mReaderModeManager; | 231 private ReaderModeManager mReaderModeManager; |
232 private SnackbarManager mSnackbarManager; | 232 private SnackbarManager mSnackbarManager; |
233 private DataUseSnackbarController mDataUseSnackbarController; | 233 private DataUseSnackbarController mDataUseSnackbarController; |
234 private DataReductionPromoSnackbarController mDataReductionPromoSnackbarCont
roller; | 234 private DataReductionPromoSnackbarController mDataReductionPromoSnackbarCont
roller; |
235 private AppMenuPropertiesDelegate mAppMenuPropertiesDelegate; | 235 private AppMenuPropertiesDelegate mAppMenuPropertiesDelegate; |
236 private AppMenuHandler mAppMenuHandler; | 236 private AppMenuHandler mAppMenuHandler; |
237 private ToolbarManager mToolbarManager; | 237 private ToolbarManager mToolbarManager; |
| 238 private BottomSheet mBottomSheet; |
238 | 239 |
239 // Time in ms that it took took us to inflate the initial layout | 240 // Time in ms that it took took us to inflate the initial layout |
240 private long mInflateInitialLayoutDurationMs; | 241 private long mInflateInitialLayoutDurationMs; |
241 | 242 |
242 private int mScreenWidthDp; | 243 private int mScreenWidthDp; |
243 private Runnable mRecordMultiWindowModeScreenWidthRunnable; | 244 private Runnable mRecordMultiWindowModeScreenWidthRunnable; |
244 | 245 |
245 private AssistStatusHandler mAssistStatusHandler; | 246 private AssistStatusHandler mAssistStatusHandler; |
246 | 247 |
247 // A set of views obscuring all tabs. When this set is nonempty, | 248 // A set of views obscuring all tabs. When this set is nonempty, |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
382 } | 383 } |
383 | 384 |
384 // It cannot be assumed that the result of toolbarContainerStub.
inflate() will be | 385 // It cannot be assumed that the result of toolbarContainerStub.
inflate() will be |
385 // the control container since it may be wrapped in another view
. | 386 // the control container since it may be wrapped in another view
. |
386 ControlContainer controlContainer = | 387 ControlContainer controlContainer = |
387 (ControlContainer) findViewById(R.id.control_container); | 388 (ControlContainer) findViewById(R.id.control_container); |
388 | 389 |
389 // Get a handle to the bottom sheet if using the bottom control
container. | 390 // Get a handle to the bottom sheet if using the bottom control
container. |
390 if (controlContainerLayoutId == R.layout.bottom_control_containe
r) { | 391 if (controlContainerLayoutId == R.layout.bottom_control_containe
r) { |
391 View coordinator = findViewById(R.id.coordinator); | 392 View coordinator = findViewById(R.id.coordinator); |
392 BottomSheet bottomSheet = (BottomSheet) findViewById(R.id.bo
ttom_sheet); | 393 mBottomSheet = (BottomSheet) findViewById(R.id.bottom_sheet)
; |
393 bottomSheet.init(coordinator, controlContainer.getView()); | 394 mBottomSheet.init(coordinator, controlContainer.getView()); |
394 } | 395 } |
395 | 396 |
396 // Inflate the correct toolbar layout for the device. | 397 // Inflate the correct toolbar layout for the device. |
397 int toolbarLayoutId = getToolbarLayoutId(); | 398 int toolbarLayoutId = getToolbarLayoutId(); |
398 if (toolbarLayoutId != NO_TOOLBAR_LAYOUT && controlContainer !=
null) { | 399 if (toolbarLayoutId != NO_TOOLBAR_LAYOUT && controlContainer !=
null) { |
399 controlContainer.initWithToolbar(toolbarLayoutId); | 400 controlContainer.initWithToolbar(toolbarLayoutId); |
400 } | 401 } |
401 } finally { | 402 } finally { |
402 StrictMode.setThreadPolicy(oldPolicy); | 403 StrictMode.setThreadPolicy(oldPolicy); |
403 } | 404 } |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
580 } | 581 } |
581 | 582 |
582 /** | 583 /** |
583 * @return The resource id for the menu to use in {@link AppMenu}. Default i
s R.menu.main_menu. | 584 * @return The resource id for the menu to use in {@link AppMenu}. Default i
s R.menu.main_menu. |
584 */ | 585 */ |
585 protected int getAppMenuLayoutId() { | 586 protected int getAppMenuLayoutId() { |
586 return R.menu.main_menu; | 587 return R.menu.main_menu; |
587 } | 588 } |
588 | 589 |
589 /** | 590 /** |
| 591 * Get the Chrome Home bottom sheet if it exists. |
| 592 * @return The bottom sheet or null. |
| 593 */ |
| 594 public BottomSheet getBottomSheet() { |
| 595 return mBottomSheet; |
| 596 } |
| 597 |
| 598 /** |
590 * @return {@link AppMenuPropertiesDelegate} instance that the {@link AppMen
uHandler} | 599 * @return {@link AppMenuPropertiesDelegate} instance that the {@link AppMen
uHandler} |
591 * should be using in this activity. | 600 * should be using in this activity. |
592 */ | 601 */ |
593 protected AppMenuPropertiesDelegate createAppMenuPropertiesDelegate() { | 602 protected AppMenuPropertiesDelegate createAppMenuPropertiesDelegate() { |
594 return new AppMenuPropertiesDelegate(this); | 603 return new AppMenuPropertiesDelegate(this); |
595 } | 604 } |
596 | 605 |
597 /** | 606 /** |
598 * @return The assist handler for this activity. | 607 * @return The assist handler for this activity. |
599 */ | 608 */ |
(...skipping 1355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1955 "Android.MultiWindowMode.IsTabletScreenWidthBelow600", | 1964 "Android.MultiWindowMode.IsTabletScreenWidthBelow600", |
1956 mScreenWidthDp < DeviceFormFactor.MINIMUM_TABLET_WIDTH_DP); | 1965 mScreenWidthDp < DeviceFormFactor.MINIMUM_TABLET_WIDTH_DP); |
1957 | 1966 |
1958 if (mScreenWidthDp < DeviceFormFactor.MINIMUM_TABLET_WIDTH_DP) { | 1967 if (mScreenWidthDp < DeviceFormFactor.MINIMUM_TABLET_WIDTH_DP) { |
1959 RecordHistogram.recordLinearCountHistogram( | 1968 RecordHistogram.recordLinearCountHistogram( |
1960 "Android.MultiWindowMode.TabletScreenWidth", mScreenWidthDp,
1, | 1969 "Android.MultiWindowMode.TabletScreenWidth", mScreenWidthDp,
1, |
1961 DeviceFormFactor.MINIMUM_TABLET_WIDTH_DP, 50); | 1970 DeviceFormFactor.MINIMUM_TABLET_WIDTH_DP, 50); |
1962 } | 1971 } |
1963 } | 1972 } |
1964 } | 1973 } |
OLD | NEW |