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

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

Issue 2365653007: [Contextual Search] Exclude suppressed taps from aggregate suppression heuristics logging (Closed)
Patch Set: Fix punctuation Created 4 years, 2 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 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 /** 7 /**
8 * Implements the policy that a Tap relatively far away from an existing Context ual Search 8 * Implements the policy that a Tap relatively far away from an existing Context ual Search
9 * selection should just dismiss our UX. When a Tap is close by, we assume the user must have 9 * selection should just dismiss our UX. When a Tap is close by, we assume the user must have
10 * missed the original intended target so we reselect based on the new Tap locat ion. 10 * missed the original intended target so we reselect based on the new Tap locat ion.
(...skipping 13 matching lines...) Expand all
24 * @param y The y coordinate of the tap gesture. 24 * @param y The y coordinate of the tap gesture.
25 */ 25 */
26 TapFarFromPreviousSuppression(ContextualSearchSelectionController controller , 26 TapFarFromPreviousSuppression(ContextualSearchSelectionController controller ,
27 ContextualSearchTapState previousTapState, int x, int y) { 27 ContextualSearchTapState previousTapState, int x, int y) {
28 mPxToDp = controller.getPxToDp(); 28 mPxToDp = controller.getPxToDp();
29 mPreviousTapState = previousTapState; 29 mPreviousTapState = previousTapState;
30 mShouldHandleTap = shouldHandleTap(x, y); 30 mShouldHandleTap = shouldHandleTap(x, y);
31 } 31 }
32 32
33 @Override 33 @Override
34 protected boolean isConditionSatisfied() { 34 protected boolean isConditionSatisfiedAndEnabled() {
35 return !mShouldHandleTap; 35 return !mShouldHandleTap;
36 } 36 }
37 37
38 @Override 38 @Override
39 protected boolean shouldAggregateLogForTapSuppression() { 39 protected boolean shouldAggregateLogForTapSuppression() {
40 return false; 40 return false;
41 } 41 }
42 42
43 @Override 43 @Override
44 protected boolean isConditionSatisfiedForAggregateLogging() { 44 protected boolean isConditionSatisfiedForAggregateLogging() {
(...skipping 13 matching lines...) Expand all
58 * Determines whether a tap at the given coordinates is considered "close" t o the previous 58 * Determines whether a tap at the given coordinates is considered "close" t o the previous
59 * tap. 59 * tap.
60 */ 60 */
61 private boolean wasTapCloseToPreviousTap(int x, int y) { 61 private boolean wasTapCloseToPreviousTap(int x, int y) {
62 float deltaXDp = (mPreviousTapState.getX() - x) * mPxToDp; 62 float deltaXDp = (mPreviousTapState.getX() - x) * mPxToDp;
63 float deltaYDp = (mPreviousTapState.getY() - y) * mPxToDp; 63 float deltaYDp = (mPreviousTapState.getY() - y) * mPxToDp;
64 float distanceSquaredDp = deltaXDp * deltaXDp + deltaYDp * deltaYDp; 64 float distanceSquaredDp = deltaXDp * deltaXDp + deltaYDp * deltaYDp;
65 return distanceSquaredDp <= RETAP_DISTANCE_SQUARED_DP; 65 return distanceSquaredDp <= RETAP_DISTANCE_SQUARED_DP;
66 } 66 }
67 } 67 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698