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

Side by Side Diff: content/browser/renderer_host/tap_suppression_controller_aura.cc

Issue 11745006: Added TapSuppressionController params to gesture configurations (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #include "content/browser/renderer_host/tap_suppression_controller.h" 5 #include "content/browser/renderer_host/tap_suppression_controller.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/debug/trace_event.h" 8 #include "base/debug/trace_event.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/string_number_conversions.h" 10 #include "base/string_number_conversions.h"
11 #include "content/browser/renderer_host/render_widget_host_impl.h" 11 #include "content/browser/renderer_host/render_widget_host_impl.h"
12 #include "content/public/common/content_switches.h" 12 #include "content/public/common/content_switches.h"
13 #include "ui/base/gestures/gesture_configuration.h"
13 14
14 namespace { 15 namespace {
15 16
16 // Default maxium time between a mousedown/mouseup pair that is considered to
17 // be a suppressable tap.
18 static const int kMaxiumTapGapTimeMs = 200;
19
20 // Default maximum time between a GestureFlingCancel and a mousedown such that
21 // the mousedown is considered associated with the cancel event.
22 static const int kMaxiumCancelToDownTimeMs = 400;
23
24 // Sets |*value| to |switchKey| if it exists or sets it to |defaultValue|. 17 // Sets |*value| to |switchKey| if it exists or sets it to |defaultValue|.
25 static void GetFlingParamHelper(int* value, int defaultValue, 18 static void GetFlingParamHelper(int* value, int defaultValue,
26 const char switchKey[]) { 19 const char switchKey[]) {
mohsen 2013/01/03 15:20:28 The following change is to compute the parameter v
27 if (*value < 0) { 20 *value = defaultValue;
28 *value = defaultValue; 21 CommandLine* command_line = CommandLine::ForCurrentProcess();
mohsen 2013/01/03 15:20:28 Currently the values can be set in command line, t
rjkroege 2013/01/03 22:42:49 remove in this CL -- which admits some simplificat
29 CommandLine* command_line = CommandLine::ForCurrentProcess(); 22 std::string command_line_param =
30 std::string command_line_param = 23 command_line->GetSwitchValueASCII(switchKey);
31 command_line->GetSwitchValueASCII(switchKey); 24 if (!command_line_param.empty()) {
32 if (!command_line_param.empty()) { 25 int v;
33 int v; 26 if (base::StringToInt(command_line_param, &v))
34 if (base::StringToInt(command_line_param, &v)) 27 *value = static_cast<int>(v);
35 *value = static_cast<int>(v);
36 }
37 DCHECK_GT(*value, 0);
38 } 28 }
39 } 29 }
40 30
41 static int GetMaxiumTapGapTimeMs() { 31 static int GetMaxiumTapGapTimeMs() {
42 static int maximum_tap_gap_time_ms = -1; 32 int maximum_tap_gap_time_ms = -1;
43 GetFlingParamHelper(&maximum_tap_gap_time_ms, 33 GetFlingParamHelper(&maximum_tap_gap_time_ms,
44 kMaxiumTapGapTimeMs, 34 ui::GestureConfiguration::fling_max_tap_gap_time_in_ms(),
45 switches::kFlingTapSuppressMaxGap); 35 switches::kFlingTapSuppressMaxGap);
46 return maximum_tap_gap_time_ms; 36 return maximum_tap_gap_time_ms;
47 } 37 }
48 38
49 static int GetMaxiumCancelToDownTimeMs() { 39 static int GetMaxiumCancelToDownTimeMs() {
50 static int maximum_cancel_to_down_time_ms = -1; 40 int maximum_cancel_to_down_time_ms = -1;
51 GetFlingParamHelper(&maximum_cancel_to_down_time_ms, 41 GetFlingParamHelper(
52 kMaxiumCancelToDownTimeMs, 42 &maximum_cancel_to_down_time_ms,
53 switches::kFlingTapSuppressMaxDown); 43 ui::GestureConfiguration::fling_max_cancel_to_down_time_in_ms(),
44 switches::kFlingTapSuppressMaxDown);
54 return maximum_cancel_to_down_time_ms; 45 return maximum_cancel_to_down_time_ms;
55 } 46 }
56 47
57 } // namespace 48 } // namespace
58 49
59 namespace content { 50 namespace content {
60 51
61 TapSuppressionController::TapSuppressionController(RenderWidgetHostImpl* rwhv) 52 TapSuppressionController::TapSuppressionController(RenderWidgetHostImpl* rwhv)
62 : render_widget_host_(rwhv), 53 : render_widget_host_(rwhv),
63 state_(TapSuppressionController::NOTHING) { 54 state_(TapSuppressionController::NOTHING) {
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 case MD_STASHED: 155 case MD_STASHED:
165 TRACE_EVENT0("browser", 156 TRACE_EVENT0("browser",
166 "TapSuppressionController::MouseDownTimerExpired"); 157 "TapSuppressionController::MouseDownTimerExpired");
167 render_widget_host_->ForwardMouseEventImmediately(stashed_mouse_down_); 158 render_widget_host_->ForwardMouseEventImmediately(stashed_mouse_down_);
168 state_ = NOTHING; 159 state_ = NOTHING;
169 break; 160 break;
170 } 161 }
171 } 162 }
172 163
173 } // namespace content 164 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698