OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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.contextualsearch; | 5 package org.chromium.chrome.browser.contextualsearch; |
6 | 6 |
7 import org.chromium.chrome.browser.ChromeActivity; | 7 import org.chromium.chrome.browser.ChromeActivity; |
8 import org.chromium.chrome.browser.fullscreen.ChromeFullscreenManager; | 8 import org.chromium.chrome.browser.fullscreen.ChromeFullscreenManager; |
9 import org.chromium.chrome.browser.tab.Tab; | 9 import org.chromium.chrome.browser.tab.Tab; |
10 | 10 |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 return true; | 59 return true; |
60 } | 60 } |
61 | 61 |
62 @Override | 62 @Override |
63 protected boolean isConditionSatisfiedForAggregateLogging() { | 63 protected boolean isConditionSatisfiedForAggregateLogging() { |
64 return !mIsEnabled && mIsConditionSatisfied; | 64 return !mIsEnabled && mIsConditionSatisfied; |
65 } | 65 } |
66 | 66 |
67 @Override | 67 @Override |
68 protected void logRankerTapSuppression(ContextualSearchRankerLogger logger)
{ | 68 protected void logRankerTapSuppression(ContextualSearchRankerLogger logger)
{ |
69 logger.log(ContextualSearchRankerLogger.Feature.WAS_SCREEN_BOTTOM, mIsCo
nditionSatisfied); | 69 logger.logFeature( |
| 70 ContextualSearchRankerLogger.Feature.WAS_SCREEN_BOTTOM, mIsCondi
tionSatisfied); |
70 } | 71 } |
71 | 72 |
72 /** | 73 /** |
73 * @return The height of the content view area of the base page in pixels, o
r 0 if the | 74 * @return The height of the content view area of the base page in pixels, o
r 0 if the |
74 * Height cannot be reliably obtained. | 75 * Height cannot be reliably obtained. |
75 */ | 76 */ |
76 private float getContentHeightPx() { | 77 private float getContentHeightPx() { |
77 Tab currentTab = mActivity.getActivityTab(); | 78 Tab currentTab = mActivity.getActivityTab(); |
78 ChromeFullscreenManager fullscreenManager = mActivity.getFullscreenManag
er(); | 79 ChromeFullscreenManager fullscreenManager = mActivity.getFullscreenManag
er(); |
79 if (fullscreenManager == null || currentTab == null) return 0.f; | 80 if (fullscreenManager == null || currentTab == null) return 0.f; |
(...skipping 18 matching lines...) Expand all Loading... |
98 | 99 |
99 // First check vertical overlap. | 100 // First check vertical overlap. |
100 // TODO(donnd): Ask the panel whether the bar overlaps! | 101 // TODO(donnd): Ask the panel whether the bar overlaps! |
101 float barHeightDp = 56; // DPs | 102 float barHeightDp = 56; // DPs |
102 float yDp = y * mPxToDp; | 103 float yDp = y * mPxToDp; |
103 float contentHeightDp = contentHeightPx * mPxToDp; | 104 float contentHeightDp = contentHeightPx * mPxToDp; |
104 | 105 |
105 return yDp >= (contentHeightDp - barHeightDp); | 106 return yDp >= (contentHeightDp - barHeightDp); |
106 } | 107 } |
107 } | 108 } |
OLD | NEW |