| OLD | NEW |
| 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" |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 | 61 |
| 62 GestureProviderAura* CreateGestureProvider(GestureProviderAuraClient* client) { | 62 GestureProviderAura* CreateGestureProvider(GestureProviderAuraClient* client) { |
| 63 return new GestureProviderAura(client); | 63 return new GestureProviderAura(client); |
| 64 } | 64 } |
| 65 | 65 |
| 66 } // namespace | 66 } // namespace |
| 67 | 67 |
| 68 //////////////////////////////////////////////////////////////////////////////// | 68 //////////////////////////////////////////////////////////////////////////////// |
| 69 // GestureRecognizerImpl, public: | 69 // GestureRecognizerImpl, public: |
| 70 | 70 |
| 71 GestureRecognizerImpl::GestureRecognizerImpl() | 71 GestureRecognizerImpl::GestureRecognizerImpl() { |
| 72 : use_unified_gesture_detector_(CommandLine::ForCurrentProcess()->HasSwitch( | 72 // Default to not using the unified gesture detector. |
| 73 switches::kUseUnifiedGestureDetector)) { | 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 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 393 std::vector<GestureEventHelper*>::iterator it; | 413 std::vector<GestureEventHelper*>::iterator it; |
| 394 for (it = helpers.begin(); it != helpers.end(); ++it) | 414 for (it = helpers.begin(); it != helpers.end(); ++it) |
| 395 gesture_recognizer->AddGestureEventHelper(*it); | 415 gesture_recognizer->AddGestureEventHelper(*it); |
| 396 | 416 |
| 397 helpers.clear(); | 417 helpers.clear(); |
| 398 g_gesture_recognizer_instance = | 418 g_gesture_recognizer_instance = |
| 399 static_cast<GestureRecognizerImpl*>(gesture_recognizer); | 419 static_cast<GestureRecognizerImpl*>(gesture_recognizer); |
| 400 } | 420 } |
| 401 | 421 |
| 402 } // namespace ui | 422 } // namespace ui |
| OLD | NEW |