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

Side by Side Diff: content/browser/renderer_host/input/stylus_text_selector.cc

Issue 679633005: Expose native, desktop and mobile gesture detection defaults (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Code review Created 6 years 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/input/stylus_text_selector.h" 5 #include "content/browser/renderer_host/input/stylus_text_selector.h"
6 6
7 #include "ui/events/event_constants.h" 7 #include "ui/events/event_constants.h"
8 #include "ui/events/gesture_detection/gesture_detector.h" 8 #include "ui/events/gesture_detection/gesture_detector.h"
9 #include "ui/events/gesture_detection/gesture_provider_config_helper.h" 9 #include "ui/events/gesture_detection/gesture_provider_config_helper.h"
10 #include "ui/events/gesture_detection/motion_event.h" 10 #include "ui/events/gesture_detection/motion_event.h"
11 11
12 using ui::GestureDetector; 12 using ui::GestureDetector;
13 using ui::MotionEvent; 13 using ui::MotionEvent;
14 14
15 namespace content { 15 namespace content {
16 namespace { 16 namespace {
17 scoped_ptr<GestureDetector> CreateGestureDetector( 17 scoped_ptr<GestureDetector> CreateGestureDetector(
18 ui::GestureListener* listener) { 18 ui::GestureListener* listener) {
19 GestureDetector::Config config = 19 GestureDetector::Config config =
20 ui::DefaultGestureProviderConfig().gesture_detector_config; 20 ui::GetGestureProviderConfig(
21 ui::GestureProviderConfigType::CURRENT_PLATFORM)
22 .gesture_detector_config;
21 23
22 ui::DoubleTapListener* null_double_tap_listener = nullptr; 24 ui::DoubleTapListener* null_double_tap_listener = nullptr;
23 25
24 // Doubletap, showpress and longpress detection are not required, and 26 // Doubletap, showpress and longpress detection are not required, and
25 // should be explicitly disabled for efficiency. 27 // should be explicitly disabled for efficiency.
26 scoped_ptr<ui::GestureDetector> detector( 28 scoped_ptr<ui::GestureDetector> detector(
27 new ui::GestureDetector(config, listener, null_double_tap_listener)); 29 new ui::GestureDetector(config, listener, null_double_tap_listener));
28 detector->set_longpress_enabled(false); 30 detector->set_longpress_enabled(false);
29 detector->set_showpress_enabled(false); 31 detector->set_showpress_enabled(false);
30 32
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 bool StylusTextSelector::ShouldStartTextSelection(const MotionEvent& event) { 132 bool StylusTextSelector::ShouldStartTextSelection(const MotionEvent& event) {
131 DCHECK_GT(event.GetPointerCount(), 0u); 133 DCHECK_GT(event.GetPointerCount(), 0u);
132 // Currently we are supporting stylus-only cases. 134 // Currently we are supporting stylus-only cases.
133 const bool is_stylus = event.GetToolType(0) == MotionEvent::TOOL_TYPE_STYLUS; 135 const bool is_stylus = event.GetToolType(0) == MotionEvent::TOOL_TYPE_STYLUS;
134 const bool is_only_secondary_button_pressed = 136 const bool is_only_secondary_button_pressed =
135 event.GetButtonState() == MotionEvent::BUTTON_SECONDARY; 137 event.GetButtonState() == MotionEvent::BUTTON_SECONDARY;
136 return is_stylus && is_only_secondary_button_pressed; 138 return is_stylus && is_only_secondary_button_pressed;
137 } 139 }
138 140
139 } // namespace content 141 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698