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 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
198 // We have to instantiate the TouchExplorationStateChangeListner object in t he code. | 198 // We have to instantiate the TouchExplorationStateChangeListner object in t he code. |
199 @SuppressLint("NewApi") | 199 @SuppressLint("NewApi") |
200 private TouchExplorationStateChangeListener mTouchExplorationStateChangeList ener; | 200 private TouchExplorationStateChangeListener mTouchExplorationStateChangeList ener; |
201 | 201 |
202 // Observes when sync becomes ready to create the mContextReporter. | 202 // Observes when sync becomes ready to create the mContextReporter. |
203 private ProfileSyncService.SyncStateChangedListener mSyncStateChangedListene r; | 203 private ProfileSyncService.SyncStateChangedListener mSyncStateChangedListene r; |
204 | 204 |
205 private ActivityWindowAndroid mWindowAndroid; | 205 private ActivityWindowAndroid mWindowAndroid; |
206 private ChromeFullscreenManager mFullscreenManager; | 206 private ChromeFullscreenManager mFullscreenManager; |
207 private CompositorViewHolder mCompositorViewHolder; | 207 private CompositorViewHolder mCompositorViewHolder; |
208 private InsetConsumerView mInsetConsumerView; | |
208 private ContextualSearchManager mContextualSearchManager; | 209 private ContextualSearchManager mContextualSearchManager; |
209 private ReaderModeManager mReaderModeManager; | 210 private ReaderModeManager mReaderModeManager; |
210 private SnackbarManager mSnackbarManager; | 211 private SnackbarManager mSnackbarManager; |
211 private DataUseSnackbarController mDataUseSnackbarController; | 212 private DataUseSnackbarController mDataUseSnackbarController; |
212 private AppMenuPropertiesDelegate mAppMenuPropertiesDelegate; | 213 private AppMenuPropertiesDelegate mAppMenuPropertiesDelegate; |
213 private AppMenuHandler mAppMenuHandler; | 214 private AppMenuHandler mAppMenuHandler; |
214 private ToolbarManager mToolbarManager; | 215 private ToolbarManager mToolbarManager; |
215 private BookmarkModelObserver mBookmarkObserver; | 216 private BookmarkModelObserver mBookmarkObserver; |
216 | 217 |
217 // Time in ms that it took took us to inflate the initial layout | 218 // Time in ms that it took took us to inflate the initial layout |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
345 } | 346 } |
346 } | 347 } |
347 TraceEvent.end("onCreate->setContentView()"); | 348 TraceEvent.end("onCreate->setContentView()"); |
348 mInflateInitialLayoutDurationMs = SystemClock.elapsedRealtime() - begin; | 349 mInflateInitialLayoutDurationMs = SystemClock.elapsedRealtime() - begin; |
349 | 350 |
350 // Set the status bar color to black by default. This is an optimization for | 351 // Set the status bar color to black by default. This is an optimization for |
351 // Chrome not to draw under status and navigation bars when we use the d efault | 352 // Chrome not to draw under status and navigation bars when we use the d efault |
352 // black status bar | 353 // black status bar |
353 ApiCompatibilityUtils.setStatusBarColor(getWindow(), Color.BLACK); | 354 ApiCompatibilityUtils.setStatusBarColor(getWindow(), Color.BLACK); |
354 | 355 |
356 ViewGroup rootView = (ViewGroup) getWindow().getDecorView().getRootView( ); | |
355 mCompositorViewHolder = (CompositorViewHolder) findViewById(R.id.composi tor_view_holder); | 357 mCompositorViewHolder = (CompositorViewHolder) findViewById(R.id.composi tor_view_holder); |
356 mCompositorViewHolder.setRootView(getWindow().getDecorView().getRootView ()); | 358 mCompositorViewHolder.setRootView(rootView); |
359 | |
360 // Setting fitsSystemWindows to false ensures that the root view | |
361 // doesn't consume the insets. | |
362 rootView.setFitsSystemWindows(false); | |
Ted C
2016/03/14 22:53:06
It would be nice to guard these lines with ChromeS
ymalik
2016/03/15 16:23:26
I like the idea of rolling the inset logic out now
| |
363 | |
364 // Add a custom view right after the root view that stores the insets | |
365 // to access later. ContentViewCore needs the insets to determine the | |
366 // portion of the screen obscured by non-content displaying things | |
367 // such as the OSK. | |
368 mInsetConsumerView = InsetConsumerView.create(this); | |
369 rootView.addView(mInsetConsumerView, 0); | |
357 } | 370 } |
358 | 371 |
359 /** | 372 /** |
360 * Constructs {@link ToolbarManager} and the handler necessary for controlli ng the menu on the | 373 * Constructs {@link ToolbarManager} and the handler necessary for controlli ng the menu on the |
361 * {@link Toolbar}. Extending classes can override this call to avoid creati ng the toolbar. | 374 * {@link Toolbar}. Extending classes can override this call to avoid creati ng the toolbar. |
362 */ | 375 */ |
363 protected void initializeToolbar() { | 376 protected void initializeToolbar() { |
364 final View controlContainer = findViewById(R.id.control_container); | 377 final View controlContainer = findViewById(R.id.control_container); |
365 assert controlContainer != null; | 378 assert controlContainer != null; |
366 ToolbarControlContainer toolbarContainer = (ToolbarControlContainer) con trolContainer; | 379 ToolbarControlContainer toolbarContainer = (ToolbarControlContainer) con trolContainer; |
(...skipping 685 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1052 | 1065 |
1053 /** | 1066 /** |
1054 * {@link TabModelSelector} no longer implements TabModel. Use getTabModelS elector() or | 1067 * {@link TabModelSelector} no longer implements TabModel. Use getTabModelS elector() or |
1055 * getCurrentTabModel() depending on your needs. | 1068 * getCurrentTabModel() depending on your needs. |
1056 * @return The {@link TabModelSelector}, possibly null. | 1069 * @return The {@link TabModelSelector}, possibly null. |
1057 */ | 1070 */ |
1058 public TabModelSelector getTabModelSelector() { | 1071 public TabModelSelector getTabModelSelector() { |
1059 return mTabModelSelector; | 1072 return mTabModelSelector; |
1060 } | 1073 } |
1061 | 1074 |
1075 /** | |
1076 * Returns the {@link InsetConsumerView} that has the current system window | |
1077 * insets information. | |
1078 * @return The {@link InsetConsumerView}, possibly null. | |
1079 */ | |
1080 public InsetConsumerView getInsetConsumerView() { | |
1081 return mInsetConsumerView; | |
1082 } | |
1083 | |
1062 @Override | 1084 @Override |
1063 public TabCreatorManager.TabCreator getTabCreator(boolean incognito) { | 1085 public TabCreatorManager.TabCreator getTabCreator(boolean incognito) { |
1064 return incognito ? mIncognitoTabCreator : mRegularTabCreator; | 1086 return incognito ? mIncognitoTabCreator : mRegularTabCreator; |
1065 } | 1087 } |
1066 | 1088 |
1067 /** | 1089 /** |
1068 * Sets the {@link ChromeTabCreator}s owned by this {@link ChromeActivity}. | 1090 * Sets the {@link ChromeTabCreator}s owned by this {@link ChromeActivity}. |
1069 * @param regularTabCreator A {@link ChromeTabCreator} instance. | 1091 * @param regularTabCreator A {@link ChromeTabCreator} instance. |
1070 */ | 1092 */ |
1071 public void setTabCreators(TabCreatorManager.TabCreator regularTabCreator, | 1093 public void setTabCreators(TabCreatorManager.TabCreator regularTabCreator, |
(...skipping 536 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1608 public static int getThemeId() { | 1630 public static int getThemeId() { |
1609 boolean useLowEndTheme = | 1631 boolean useLowEndTheme = |
1610 SysUtils.isLowEndDevice() && Build.VERSION.SDK_INT >= Build.VERS ION_CODES.LOLLIPOP; | 1632 SysUtils.isLowEndDevice() && Build.VERSION.SDK_INT >= Build.VERS ION_CODES.LOLLIPOP; |
1611 return (useLowEndTheme ? R.style.MainTheme_LowEnd : R.style.MainTheme); | 1633 return (useLowEndTheme ? R.style.MainTheme_LowEnd : R.style.MainTheme); |
1612 } | 1634 } |
1613 | 1635 |
1614 private void setLowEndTheme() { | 1636 private void setLowEndTheme() { |
1615 if (getThemeId() == R.style.MainTheme_LowEnd) setTheme(R.style.MainTheme _LowEnd); | 1637 if (getThemeId() == R.style.MainTheme_LowEnd) setTheme(R.style.MainTheme _LowEnd); |
1616 } | 1638 } |
1617 } | 1639 } |
OLD | NEW |