Upstream version 7.36.149.0
[platform/framework/web/crosswalk.git] / src / ui / ozone / platform / caca / caca_event_factory.h
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 #ifndef UI_OZONE_PLATFORM_CACA_CACA_EVENT_FACTORY_H_
6 #define UI_OZONE_PLATFORM_CACA_CACA_EVENT_FACTORY_H_
7
8 #include "base/memory/ref_counted.h"
9 #include "base/time/time.h"
10 #include "ui/events/ozone/event_factory_ozone.h"
11 #include "ui/gfx/geometry/point_f.h"
12
13 namespace ui {
14
15 class CacaConnection;
16
17 class CacaEventFactory : public ui::EventFactoryOzone {
18  public:
19   CacaEventFactory(CacaConnection* connection);
20   virtual ~CacaEventFactory();
21
22   // ui::EventFactoryOzone overrides:
23   virtual void StartProcessingEvents() OVERRIDE;
24   virtual void WarpCursorTo(gfx::AcceleratedWidget widget,
25                             const gfx::PointF& location) OVERRIDE;
26
27  private:
28   void ScheduleEventProcessing();
29
30   void TryProcessingEvent();
31
32   CacaConnection* connection_;  // Not owned.
33
34   base::WeakPtrFactory<CacaEventFactory> weak_ptr_factory_;
35
36   // Delay between event polls.
37   base::TimeDelta delay_;
38
39   // Keep track of last cursor position to dispatch correct mouse push/release
40   // events.
41   gfx::PointF last_cursor_location_;
42
43   int modifier_flags_;
44
45   DISALLOW_COPY_AND_ASSIGN(CacaEventFactory);
46 };
47
48 }  // namespace ui
49
50 #endif  // UI_OZONE_PLATFORM_CACA_CACA_EVENT_FACTORY_H_