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.compositor.bottombar; | 5 package org.chromium.chrome.browser.compositor.bottombar; |
6 | 6 |
7 import android.app.Activity; | 7 import android.app.Activity; |
8 import android.content.Context; | 8 import android.content.Context; |
9 import android.view.View; | 9 import android.view.View; |
10 import android.view.View.MeasureSpec; | 10 import android.view.View.MeasureSpec; |
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
274 return PanelPriority.MEDIUM; | 274 return PanelPriority.MEDIUM; |
275 } | 275 } |
276 | 276 |
277 /** | 277 /** |
278 * @return True if a panel can be suppressed. This should be overridden by e ach panel. | 278 * @return True if a panel can be suppressed. This should be overridden by e ach panel. |
279 */ | 279 */ |
280 public boolean canBeSuppressed() { | 280 public boolean canBeSuppressed() { |
281 return false; | 281 return false; |
282 } | 282 } |
283 | 283 |
284 @Override | 284 /** |
285 * @return The absolute amount in DP that the top controls have shifted off screen. | |
286 */ | |
285 protected float getTopControlsOffsetDp() { | 287 protected float getTopControlsOffsetDp() { |
286 if (mActivity == null || mActivity.getFullscreenManager() == null) retur n 0.0f; | 288 if (mActivity == null || mActivity.getFullscreenManager() == null) retur n 0.0f; |
287 return -mActivity.getFullscreenManager().getControlOffset() * mPxToDp; | 289 return -mActivity.getFullscreenManager().getControlOffset() * mPxToDp; |
288 } | 290 } |
289 | 291 |
290 /** | 292 /** |
291 * Set the visibility of the base page text selection controls. | 293 * Set the visibility of the base page text selection controls. |
292 * TODO(mdjones): This should be replaced be focusing the panel's ContentVie wCore. | 294 * TODO(mdjones): This should be replaced be focusing the panel's ContentVie wCore. |
293 * @param visible If the text controls are visible. | 295 * @param visible If the text controls are visible. |
294 */ | 296 */ |
(...skipping 496 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
791 | 793 |
792 @Override | 794 @Override |
793 public EventFilter getEventFilter() { | 795 public EventFilter getEventFilter() { |
794 return mEventFilter; | 796 return mEventFilter; |
795 } | 797 } |
796 | 798 |
797 @Override | 799 @Override |
798 public void onSizeChanged(float width, float height, float visibleViewportOf fsetY, | 800 public void onSizeChanged(float width, float height, float visibleViewportOf fsetY, |
799 int orientation) { | 801 int orientation) { |
800 resizePanelContentViewCore(width, height); | 802 resizePanelContentViewCore(width, height); |
801 onSizeChanged(width, height); | 803 onSizeChanged(width, height, visibleViewportOffsetY); |
802 } | 804 } |
803 | 805 |
804 /** | 806 /** |
805 * Resize the panel's ContentViewCore manually since it is not attached to t he view hierarchy. | 807 * Resize the panel's ContentViewCore manually since it is not attached to t he view hierarchy. |
806 * TODO(mdjones): Remove the need for this method by supporting multiple Con tentViewCores | 808 * TODO(mdjones): Remove the need for this method by supporting multiple Con tentViewCores |
807 * existing simultaneously in the view hierarchy. | 809 * existing simultaneously in the view hierarchy. |
808 * @param width The new width in dp. | 810 * @param width The new width in dp. |
809 * @param height The new height in dp. | 811 * @param height The new height in dp. |
810 */ | 812 */ |
811 private void resizePanelContentViewCore(float width, float height) { | 813 private void resizePanelContentViewCore(float width, float height) { |
812 if (!isShowing()) return; | 814 if (!isShowing()) return; |
813 ContentViewCore panelContent = getContentViewCore(); | 815 ContentViewCore panelContent = getContentViewCore(); |
814 if (panelContent != null) { | 816 if (panelContent != null) { |
815 // Take the height of the toolbar into consideration. | 817 // Take the height of the toolbar into consideration. |
Donn Denman
2016/06/23 23:47:00
Remove this line?
mdjones
2016/06/24 01:30:25
Done.
| |
816 int toolbarHeightPx = getTopControlsOffsetDp() > 0 | |
817 ? 0 : (int) (getToolbarHeight() / mPxToDp); | |
818 panelContent.onSizeChanged((int) (width / mPxToDp), | 818 panelContent.onSizeChanged((int) (width / mPxToDp), |
819 (int) (height / mPxToDp) + toolbarHeightPx, panelContent.get ViewportWidthPix(), | 819 (int) (height / mPxToDp), panelContent.getViewportWidthPix() , |
820 panelContent.getViewportHeightPix()); | 820 panelContent.getViewportHeightPix()); |
821 panelContent.onPhysicalBackingSizeChanged( | 821 panelContent.onPhysicalBackingSizeChanged( |
822 (int) (width / mPxToDp), (int) (height / mPxToDp)); | 822 (int) (width / mPxToDp), (int) (height / mPxToDp)); |
823 } | 823 } |
824 } | 824 } |
825 | 825 |
826 @Override | 826 @Override |
827 public void getVirtualViews(List<VirtualView> views) { | 827 public void getVirtualViews(List<VirtualView> views) { |
828 // TODO(mdjones): Add views for accessibility. | 828 // TODO(mdjones): Add views for accessibility. |
829 } | 829 } |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
894 | 894 |
895 @Override | 895 @Override |
896 public void tabPageLoadFinished(int id, boolean incognito) {} | 896 public void tabPageLoadFinished(int id, boolean incognito) {} |
897 | 897 |
898 @Override | 898 @Override |
899 public void tabLoadStarted(int id, boolean incognito) {} | 899 public void tabLoadStarted(int id, boolean incognito) {} |
900 | 900 |
901 @Override | 901 @Override |
902 public void tabLoadFinished(int id, boolean incognito) {} | 902 public void tabLoadFinished(int id, boolean incognito) {} |
903 } | 903 } |
OLD | NEW |