Home | History | Annotate | Download | only in gestures
      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
      3 // found in the LICENSE file.
      4 
      5 #include "base/macros.h"
      6 #include "ui/events/gestures/gesture_recognizer.h"
      7 
      8 namespace ui {
      9 
     10 namespace {
     11 
     12 // Stub implementation of GestureRecognizer for Mac. Currently only serves to
     13 // provide a no-op implementation of TransferEventsTo().
     14 class GestureRecognizerImplMac : public GestureRecognizer {
     15  public:
     16   GestureRecognizerImplMac() {}
     17   virtual ~GestureRecognizerImplMac() {}
     18 
     19  private:
     20   virtual Gestures* ProcessTouchEventForGesture(
     21       const TouchEvent& event,
     22       ui::EventResult result,
     23       GestureConsumer* consumer) OVERRIDE {
     24     return NULL;
     25   }
     26   virtual bool CleanupStateForConsumer(GestureConsumer* consumer) OVERRIDE {
     27     return false;
     28   }
     29   virtual GestureConsumer* GetTouchLockedTarget(
     30       const TouchEvent& event) OVERRIDE {
     31     return NULL;
     32   }
     33   virtual GestureConsumer* GetTargetForGestureEvent(
     34       const GestureEvent& event) OVERRIDE {
     35     return NULL;
     36   }
     37   virtual GestureConsumer* GetTargetForLocation(const gfx::PointF& location,
     38                                                 int source_device_id) OVERRIDE {
     39     return NULL;
     40   }
     41   virtual void TransferEventsTo(GestureConsumer* current_consumer,
     42                                 GestureConsumer* new_consumer) OVERRIDE {}
     43   virtual bool GetLastTouchPointForTarget(GestureConsumer* consumer,
     44                                           gfx::PointF* point) OVERRIDE {
     45     return false;
     46   }
     47   virtual bool CancelActiveTouches(GestureConsumer* consumer) OVERRIDE {
     48     return false;
     49   }
     50   virtual void AddGestureEventHelper(GestureEventHelper* helper) OVERRIDE {}
     51   virtual void RemoveGestureEventHelper(GestureEventHelper* helper) OVERRIDE {}
     52 
     53   DISALLOW_COPY_AND_ASSIGN(GestureRecognizerImplMac);
     54 };
     55 
     56 }  // namespace
     57 
     58 // static
     59 GestureRecognizer* GestureRecognizer::Get() {
     60   CR_DEFINE_STATIC_LOCAL(GestureRecognizerImplMac, instance, ());
     61   return &instance;
     62 }
     63 
     64 }  // namespace ui
     65