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

Side by Side Diff: trunk/src/ui/events/gestures/gesture_recognizer_impl.cc

Issue 330613003: Revert 276728 "Fix slop region boundary handling." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 6 years, 6 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 "ui/events/gestures/gesture_recognizer_impl.h" 5 #include "ui/events/gestures/gesture_recognizer_impl.h"
6 6
7 #include <limits> 7 #include <limits>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
12 #include "base/message_loop/message_loop.h" 12 #include "base/message_loop/message_loop.h"
13 #include "base/time/time.h" 13 #include "base/time/time.h"
14 #include "ui/events/event.h" 14 #include "ui/events/event.h"
15 #include "ui/events/event_constants.h" 15 #include "ui/events/event_constants.h"
16 #include "ui/events/event_switches.h" 16 #include "ui/events/event_switches.h"
17 #include "ui/events/event_utils.h" 17 #include "ui/events/event_utils.h"
18 #include "ui/events/gestures/gesture_configuration.h" 18 #include "ui/events/gestures/gesture_configuration.h"
19 #include "ui/events/gestures/gesture_sequence.h" 19 #include "ui/events/gestures/gesture_sequence.h"
20 #include "ui/events/gestures/gesture_types.h" 20 #include "ui/events/gestures/gesture_types.h"
21 #include "ui/events/gestures/unified_gesture_detector_enabled.h"
22 21
23 namespace ui { 22 namespace ui {
24 23
25 namespace { 24 namespace {
26 25
27 template <typename T> 26 template <typename T>
28 void TransferConsumer(GestureConsumer* current_consumer, 27 void TransferConsumer(GestureConsumer* current_consumer,
29 GestureConsumer* new_consumer, 28 GestureConsumer* new_consumer,
30 std::map<GestureConsumer*, T>* map) { 29 std::map<GestureConsumer*, T>* map) {
31 if (map->count(current_consumer)) { 30 if (map->count(current_consumer)) {
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 GestureProviderAura* CreateGestureProvider(GestureProviderAuraClient* client) { 62 GestureProviderAura* CreateGestureProvider(GestureProviderAuraClient* client) {
64 return new GestureProviderAura(client); 63 return new GestureProviderAura(client);
65 } 64 }
66 65
67 } // namespace 66 } // namespace
68 67
69 //////////////////////////////////////////////////////////////////////////////// 68 ////////////////////////////////////////////////////////////////////////////////
70 // GestureRecognizerImpl, public: 69 // GestureRecognizerImpl, public:
71 70
72 GestureRecognizerImpl::GestureRecognizerImpl() { 71 GestureRecognizerImpl::GestureRecognizerImpl() {
73 use_unified_gesture_detector_ = IsUnifiedGestureDetectorEnabled(); 72 // Default to not using the unified gesture detector.
73 const CommandLine& command_line = *CommandLine::ForCurrentProcess();
74 const std::string unified_gd_enabled_switch =
75 command_line.HasSwitch(switches::kUnifiedGestureDetector) ?
76 command_line.GetSwitchValueASCII(switches::kUnifiedGestureDetector) :
77 switches::kUnifiedGestureDetectorAuto;
78
79 const bool kUseUnifiedGestureDetectorByDefault = false;
80 if (unified_gd_enabled_switch.empty() ||
81 unified_gd_enabled_switch == switches::kUnifiedGestureDetectorEnabled) {
82 use_unified_gesture_detector_ = true;
83 } else if (unified_gd_enabled_switch ==
84 switches::kUnifiedGestureDetectorDisabled) {
85 use_unified_gesture_detector_ = false;
86 } else if (unified_gd_enabled_switch ==
87 switches::kUnifiedGestureDetectorAuto) {
88 use_unified_gesture_detector_ = kUseUnifiedGestureDetectorByDefault;
89 } else {
90 LOG(ERROR) << "Invalid --unified-gesture-detector option: "
91 << unified_gd_enabled_switch;
92 use_unified_gesture_detector_ = false;
93 }
74 } 94 }
75 95
76 GestureRecognizerImpl::~GestureRecognizerImpl() { 96 GestureRecognizerImpl::~GestureRecognizerImpl() {
77 STLDeleteValues(&consumer_sequence_); 97 STLDeleteValues(&consumer_sequence_);
78 STLDeleteValues(&consumer_gesture_provider_); 98 STLDeleteValues(&consumer_gesture_provider_);
79 } 99 }
80 100
81 // Checks if this finger is already down, if so, returns the current target. 101 // Checks if this finger is already down, if so, returns the current target.
82 // Otherwise, returns NULL. 102 // Otherwise, returns NULL.
83 GestureConsumer* GestureRecognizerImpl::GetTouchLockedTarget( 103 GestureConsumer* GestureRecognizerImpl::GetTouchLockedTarget(
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after
392 std::vector<GestureEventHelper*>::iterator it; 412 std::vector<GestureEventHelper*>::iterator it;
393 for (it = helpers.begin(); it != helpers.end(); ++it) 413 for (it = helpers.begin(); it != helpers.end(); ++it)
394 gesture_recognizer->AddGestureEventHelper(*it); 414 gesture_recognizer->AddGestureEventHelper(*it);
395 415
396 helpers.clear(); 416 helpers.clear();
397 g_gesture_recognizer_instance = 417 g_gesture_recognizer_instance =
398 static_cast<GestureRecognizerImpl*>(gesture_recognizer); 418 static_cast<GestureRecognizerImpl*>(gesture_recognizer);
399 } 419 }
400 420
401 } // namespace ui 421 } // namespace ui
OLDNEW
« no previous file with comments | « trunk/src/ui/events/events.gyp ('k') | trunk/src/ui/events/gestures/unified_gesture_detector_enabled.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698