Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1366)

Side by Side Diff: chrome/android/java/src/org/chromium/chrome/browser/ChromeActivity.java

Issue 1386403003: Resize only the virtual viewport when the OSK triggers a resize. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: s/InsetConsumerView/InsetObserverView Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | chrome/android/java/src/org/chromium/chrome/browser/ChromeSwitches.java » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 InsetObserverView mInsetObserverView;
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
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 doesn't consume the insets.
361 rootView.setFitsSystemWindows(false);
362
363 // Add a custom view right after the root view that stores the insets to access later.
364 // ContentViewCore needs the insets to determine the portion of the scre en obscured by
365 // non-content displaying things such as the OSK.
366 mInsetObserverView = InsetObserverView.create(this);
367 rootView.addView(mInsetObserverView, 0);
357 } 368 }
358 369
359 /** 370 /**
360 * Constructs {@link ToolbarManager} and the handler necessary for controlli ng the menu on the 371 * 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. 372 * {@link Toolbar}. Extending classes can override this call to avoid creati ng the toolbar.
362 */ 373 */
363 protected void initializeToolbar() { 374 protected void initializeToolbar() {
364 final View controlContainer = findViewById(R.id.control_container); 375 final View controlContainer = findViewById(R.id.control_container);
365 assert controlContainer != null; 376 assert controlContainer != null;
366 ToolbarControlContainer toolbarContainer = (ToolbarControlContainer) con trolContainer; 377 ToolbarControlContainer toolbarContainer = (ToolbarControlContainer) con trolContainer;
(...skipping 685 matching lines...) Expand 10 before | Expand all | Expand 10 after
1052 1063
1053 /** 1064 /**
1054 * {@link TabModelSelector} no longer implements TabModel. Use getTabModelS elector() or 1065 * {@link TabModelSelector} no longer implements TabModel. Use getTabModelS elector() or
1055 * getCurrentTabModel() depending on your needs. 1066 * getCurrentTabModel() depending on your needs.
1056 * @return The {@link TabModelSelector}, possibly null. 1067 * @return The {@link TabModelSelector}, possibly null.
1057 */ 1068 */
1058 public TabModelSelector getTabModelSelector() { 1069 public TabModelSelector getTabModelSelector() {
1059 return mTabModelSelector; 1070 return mTabModelSelector;
1060 } 1071 }
1061 1072
1073 /**
1074 * Returns the {@link InsetObserverView} that has the current system window
1075 * insets information.
1076 * @return The {@link InsetObserverView}, possibly null.
1077 */
1078 public InsetObserverView getInsetObserverView() {
1079 return mInsetObserverView;
1080 }
1081
1062 @Override 1082 @Override
1063 public TabCreatorManager.TabCreator getTabCreator(boolean incognito) { 1083 public TabCreatorManager.TabCreator getTabCreator(boolean incognito) {
1064 return incognito ? mIncognitoTabCreator : mRegularTabCreator; 1084 return incognito ? mIncognitoTabCreator : mRegularTabCreator;
1065 } 1085 }
1066 1086
1067 /** 1087 /**
1068 * Sets the {@link ChromeTabCreator}s owned by this {@link ChromeActivity}. 1088 * Sets the {@link ChromeTabCreator}s owned by this {@link ChromeActivity}.
1069 * @param regularTabCreator A {@link ChromeTabCreator} instance. 1089 * @param regularTabCreator A {@link ChromeTabCreator} instance.
1070 */ 1090 */
1071 public void setTabCreators(TabCreatorManager.TabCreator regularTabCreator, 1091 public void setTabCreators(TabCreatorManager.TabCreator regularTabCreator,
(...skipping 536 matching lines...) Expand 10 before | Expand all | Expand 10 after
1608 public static int getThemeId() { 1628 public static int getThemeId() {
1609 boolean useLowEndTheme = 1629 boolean useLowEndTheme =
1610 SysUtils.isLowEndDevice() && Build.VERSION.SDK_INT >= Build.VERS ION_CODES.LOLLIPOP; 1630 SysUtils.isLowEndDevice() && Build.VERSION.SDK_INT >= Build.VERS ION_CODES.LOLLIPOP;
1611 return (useLowEndTheme ? R.style.MainTheme_LowEnd : R.style.MainTheme); 1631 return (useLowEndTheme ? R.style.MainTheme_LowEnd : R.style.MainTheme);
1612 } 1632 }
1613 1633
1614 private void setLowEndTheme() { 1634 private void setLowEndTheme() {
1615 if (getThemeId() == R.style.MainTheme_LowEnd) setTheme(R.style.MainTheme _LowEnd); 1635 if (getThemeId() == R.style.MainTheme_LowEnd) setTheme(R.style.MainTheme _LowEnd);
1616 } 1636 }
1617 } 1637 }
OLDNEW
« no previous file with comments | « no previous file | chrome/android/java/src/org/chromium/chrome/browser/ChromeSwitches.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698