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

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: rebase master Inset handling logic Created 4 years, 11 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
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 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 // We have to instantiate the TouchExplorationStateChangeListner object in t he code. 197 // We have to instantiate the TouchExplorationStateChangeListner object in t he code.
198 @SuppressLint("NewApi") 198 @SuppressLint("NewApi")
199 private TouchExplorationStateChangeListener mTouchExplorationStateChangeList ener; 199 private TouchExplorationStateChangeListener mTouchExplorationStateChangeList ener;
200 200
201 // Observes when sync becomes ready to create the mContextReporter. 201 // Observes when sync becomes ready to create the mContextReporter.
202 private ProfileSyncService.SyncStateChangedListener mSyncStateChangedListene r; 202 private ProfileSyncService.SyncStateChangedListener mSyncStateChangedListene r;
203 203
204 private ActivityWindowAndroid mWindowAndroid; 204 private ActivityWindowAndroid mWindowAndroid;
205 private ChromeFullscreenManager mFullscreenManager; 205 private ChromeFullscreenManager mFullscreenManager;
206 private CompositorViewHolder mCompositorViewHolder; 206 private CompositorViewHolder mCompositorViewHolder;
207 private InsetConsumerView mInsetConsumerView;
207 private ContextualSearchManager mContextualSearchManager; 208 private ContextualSearchManager mContextualSearchManager;
208 private ReaderModeManager mReaderModeManager; 209 private ReaderModeManager mReaderModeManager;
209 private SnackbarManager mSnackbarManager; 210 private SnackbarManager mSnackbarManager;
210 private DataUseSnackbarController mDataUseSnackbarController; 211 private DataUseSnackbarController mDataUseSnackbarController;
211 private AppMenuPropertiesDelegate mAppMenuPropertiesDelegate; 212 private AppMenuPropertiesDelegate mAppMenuPropertiesDelegate;
212 private AppMenuHandler mAppMenuHandler; 213 private AppMenuHandler mAppMenuHandler;
213 private ToolbarManager mToolbarManager; 214 private ToolbarManager mToolbarManager;
214 private BookmarkModelObserver mBookmarkObserver; 215 private BookmarkModelObserver mBookmarkObserver;
215 216
216 // Time in ms that it took took us to inflate the initial layout 217 // Time in ms that it took took us to inflate the initial layout
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
336 TraceEvent.end("onCreate->setContentView()"); 337 TraceEvent.end("onCreate->setContentView()");
337 mInflateInitialLayoutDurationMs = SystemClock.elapsedRealtime() - begin; 338 mInflateInitialLayoutDurationMs = SystemClock.elapsedRealtime() - begin;
338 339
339 // Set the status bar color to black by default. This is an optimization for 340 // Set the status bar color to black by default. This is an optimization for
340 // Chrome not to draw under status and navigation bars when we use the d efault 341 // Chrome not to draw under status and navigation bars when we use the d efault
341 // black status bar 342 // black status bar
342 ApiCompatibilityUtils.setStatusBarColor(getWindow(), Color.BLACK); 343 ApiCompatibilityUtils.setStatusBarColor(getWindow(), Color.BLACK);
343 344
344 mCompositorViewHolder = (CompositorViewHolder) findViewById(R.id.composi tor_view_holder); 345 mCompositorViewHolder = (CompositorViewHolder) findViewById(R.id.composi tor_view_holder);
345 mCompositorViewHolder.setRootView(getWindow().getDecorView().getRootView ()); 346 mCompositorViewHolder.setRootView(getWindow().getDecorView().getRootView ());
347
348 // Setting fitsSystemWindows to false ensures that the parent views in
349 // the View hierarchy don't consume the insets. ContentViewCore needs
350 // the insets to determine the portion of the screen obscured by
351 // non-content displaying things such as the OSK.
352 View parent = mCompositorViewHolder;
353 while (parent.getParent() != null && parent.getParent() instanceof View) {
aelias_OOO_until_Jul13 2016/01/28 05:04:55 This can be simplified to: for (View parent = mCo
ymalik 2016/02/11 01:06:22 We don't check here if the actual parent of the vi
aelias_OOO_until_Jul13 2016/02/24 02:43:58 OK, I stand corrected. Anyway, at least please de
ymalik 2016/03/03 02:10:17 Done.
354 parent = (View) parent.getParent();
355 parent.setFitsSystemWindows(false);
356 }
357 // InsetConsumerView consumes the insets instead, so that the actual
358 // value of the insets can be stored.
359 mInsetConsumerView = (InsetConsumerView) findViewById(R.id.inset_consume r_view);
360 if (mInsetConsumerView != null) {
361 mInsetConsumerView.setFitsSystemWindows(true);
aelias_OOO_until_Jul13 2016/01/28 05:04:55 The Android docs on this method says "Note that if
bokan 2016/01/28 15:53:41 I think you need to set it since the override of f
aelias_OOO_until_Jul13 2016/02/24 02:43:58 How about simply not calling super.fitSystemWindow
ymalik 2016/03/03 02:10:17 super.fitSystemWindows is what actually applies th
362 mInsetConsumerView.setTabModelSelector(getTabModelSelector());
363 }
346 } 364 }
347 365
348 /** 366 /**
349 * Constructs {@link ToolbarManager} and the handler necessary for controlli ng the menu on the 367 * Constructs {@link ToolbarManager} and the handler necessary for controlli ng the menu on the
350 * {@link Toolbar}. Extending classes can override this call to avoid creati ng the toolbar. 368 * {@link Toolbar}. Extending classes can override this call to avoid creati ng the toolbar.
351 */ 369 */
352 protected void initializeToolbar() { 370 protected void initializeToolbar() {
353 final View controlContainer = findViewById(R.id.control_container); 371 final View controlContainer = findViewById(R.id.control_container);
354 assert controlContainer != null; 372 assert controlContainer != null;
355 ToolbarControlContainer toolbarContainer = (ToolbarControlContainer) con trolContainer; 373 ToolbarControlContainer toolbarContainer = (ToolbarControlContainer) con trolContainer;
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
515 533
516 ControlContainer controlContainer = 534 ControlContainer controlContainer =
517 (ControlContainer) findViewById(R.id.control_container); 535 (ControlContainer) findViewById(R.id.control_container);
518 controlContainer.getToolbarResourceAdapter().invalidate(null); 536 controlContainer.getToolbarResourceAdapter().invalidate(null);
519 } 537 }
520 }; 538 };
521 539
522 if (mAssistStatusHandler != null) { 540 if (mAssistStatusHandler != null) {
523 mAssistStatusHandler.setTabModelSelector(tabModelSelector); 541 mAssistStatusHandler.setTabModelSelector(tabModelSelector);
524 } 542 }
543
544 if (mInsetConsumerView != null) {
545 mInsetConsumerView.setTabModelSelector(tabModelSelector);
546 }
525 } 547 }
526 548
527 @Override 549 @Override
528 public void onStartWithNative() { 550 public void onStartWithNative() {
529 super.onStartWithNative(); 551 super.onStartWithNative();
530 UpdateMenuItemHelper.getInstance().onStart(); 552 UpdateMenuItemHelper.getInstance().onStart();
531 getChromeApplication().onStartWithNative(); 553 getChromeApplication().onStartWithNative();
532 FeatureUtilities.setDocumentModeEnabled(FeatureUtilities.isDocumentMode( this)); 554 FeatureUtilities.setDocumentModeEnabled(FeatureUtilities.isDocumentMode( this));
533 WarmupManager.getInstance().clearWebContentsIfNecessary(); 555 WarmupManager.getInstance().clearWebContentsIfNecessary();
534 556
(...skipping 1052 matching lines...) Expand 10 before | Expand all | Expand 10 after
1587 public static int getThemeId() { 1609 public static int getThemeId() {
1588 boolean useLowEndTheme = 1610 boolean useLowEndTheme =
1589 SysUtils.isLowEndDevice() && Build.VERSION.SDK_INT >= Build.VERS ION_CODES.LOLLIPOP; 1611 SysUtils.isLowEndDevice() && Build.VERSION.SDK_INT >= Build.VERS ION_CODES.LOLLIPOP;
1590 return (useLowEndTheme ? R.style.MainTheme_LowEnd : R.style.MainTheme); 1612 return (useLowEndTheme ? R.style.MainTheme_LowEnd : R.style.MainTheme);
1591 } 1613 }
1592 1614
1593 private void setLowEndTheme() { 1615 private void setLowEndTheme() {
1594 if (getThemeId() == R.style.MainTheme_LowEnd) setTheme(R.style.MainTheme _LowEnd); 1616 if (getThemeId() == R.style.MainTheme_LowEnd) setTheme(R.style.MainTheme _LowEnd);
1595 } 1617 }
1596 } 1618 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698