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

Side by Side Diff: ui/aura/env.h

Issue 135563004: Nukes MessageLoop::Dispatcher (2) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix Created 6 years, 11 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 #ifndef UI_AURA_ENV_H_ 5 #ifndef UI_AURA_ENV_H_
6 #define UI_AURA_ENV_H_ 6 #define UI_AURA_ENV_H_
7 7
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_pump_dispatcher.h"
10 #include "base/observer_list.h" 10 #include "base/observer_list.h"
11 #include "ui/aura/aura_export.h" 11 #include "ui/aura/aura_export.h"
12 #include "ui/events/event_handler.h" 12 #include "ui/events/event_handler.h"
13 #include "ui/events/event_target.h" 13 #include "ui/events/event_target.h"
14 #include "ui/gfx/point.h" 14 #include "ui/gfx/point.h"
15 15
16 #if defined(USE_X11) 16 #if defined(USE_X11)
17 #include "ui/aura/device_list_updater_aurax11.h" 17 #include "ui/aura/device_list_updater_aurax11.h"
18 #endif 18 #endif
19 19
20 namespace aura { 20 namespace aura {
21 21
22 namespace test { 22 namespace test {
23 class EnvTestHelper; 23 class EnvTestHelper;
24 } 24 }
25 25
26 class EnvObserver; 26 class EnvObserver;
27 class InputStateLookup; 27 class InputStateLookup;
28 class RootWindow; 28 class RootWindow;
29 class Window; 29 class Window;
30 30
31 // Creates a platform-specific native event dispatcher. 31 // Creates a platform-specific native event dispatcher.
32 base::MessageLoop::Dispatcher* CreateDispatcher(); 32 base::MessagePumpDispatcher* CreateDispatcher();
33 33
34 // A singleton object that tracks general state within Aura. 34 // A singleton object that tracks general state within Aura.
35 // TODO(beng): manage RootWindows. 35 // TODO(beng): manage RootWindows.
36 class AURA_EXPORT Env : public ui::EventTarget { 36 class AURA_EXPORT Env : public ui::EventTarget {
37 public: 37 public:
38 Env(); 38 Env();
39 virtual ~Env(); 39 virtual ~Env();
40 40
41 static void CreateInstance(); 41 static void CreateInstance();
42 static Env* GetInstance(); 42 static Env* GetInstance();
(...skipping 16 matching lines...) Expand all
59 last_mouse_location_ = last_mouse_location; 59 last_mouse_location_ = last_mouse_location;
60 } 60 }
61 61
62 // Whether any touch device is currently down. 62 // Whether any touch device is currently down.
63 bool is_touch_down() const { return is_touch_down_; } 63 bool is_touch_down() const { return is_touch_down_; }
64 void set_touch_down(bool value) { is_touch_down_ = value; } 64 void set_touch_down(bool value) { is_touch_down_ = value; }
65 65
66 // Returns the native event dispatcher. The result should only be passed to 66 // Returns the native event dispatcher. The result should only be passed to
67 // base::RunLoop(dispatcher), or used to dispatch an event by 67 // base::RunLoop(dispatcher), or used to dispatch an event by
68 // |Dispatch(const NativeEvent&)| on it. It must never be stored. 68 // |Dispatch(const NativeEvent&)| on it. It must never be stored.
69 base::MessageLoop::Dispatcher* GetDispatcher(); 69 base::MessagePumpDispatcher* GetDispatcher();
70 70
71 // Invoked by RootWindow when its host is activated. 71 // Invoked by RootWindow when its host is activated.
72 void RootWindowActivated(RootWindow* root_window); 72 void RootWindowActivated(RootWindow* root_window);
73 73
74 private: 74 private:
75 friend class test::EnvTestHelper; 75 friend class test::EnvTestHelper;
76 friend class Window; 76 friend class Window;
77 friend class WindowTreeHost; 77 friend class WindowTreeHost;
78 78
79 void Init(); 79 void Init();
80 80
81 // Called by the Window when it is initialized. Notifies observers. 81 // Called by the Window when it is initialized. Notifies observers.
82 void NotifyWindowInitialized(Window* window); 82 void NotifyWindowInitialized(Window* window);
83 83
84 // Called by the RootWindow when it is initialized. Notifies observers. 84 // Called by the RootWindow when it is initialized. Notifies observers.
85 void NotifyRootWindowInitialized(RootWindow* root_window); 85 void NotifyRootWindowInitialized(RootWindow* root_window);
86 86
87 // Overridden from ui::EventTarget: 87 // Overridden from ui::EventTarget:
88 virtual bool CanAcceptEvent(const ui::Event& event) OVERRIDE; 88 virtual bool CanAcceptEvent(const ui::Event& event) OVERRIDE;
89 virtual ui::EventTarget* GetParentTarget() OVERRIDE; 89 virtual ui::EventTarget* GetParentTarget() OVERRIDE;
90 virtual scoped_ptr<ui::EventTargetIterator> GetChildIterator() const OVERRIDE; 90 virtual scoped_ptr<ui::EventTargetIterator> GetChildIterator() const OVERRIDE;
91 virtual ui::EventTargeter* GetEventTargeter() OVERRIDE; 91 virtual ui::EventTargeter* GetEventTargeter() OVERRIDE;
92 92
93 ObserverList<EnvObserver> observers_; 93 ObserverList<EnvObserver> observers_;
94 scoped_ptr<base::MessageLoop::Dispatcher> dispatcher_; 94 scoped_ptr<base::MessagePumpDispatcher> dispatcher_;
95 95
96 static Env* instance_; 96 static Env* instance_;
97 int mouse_button_flags_; 97 int mouse_button_flags_;
98 // Location of last mouse event, in screen coordinates. 98 // Location of last mouse event, in screen coordinates.
99 gfx::Point last_mouse_location_; 99 gfx::Point last_mouse_location_;
100 bool is_touch_down_; 100 bool is_touch_down_;
101 101
102 #if defined(USE_X11) 102 #if defined(USE_X11)
103 DeviceListUpdaterAuraX11 device_list_updater_aurax11_; 103 DeviceListUpdaterAuraX11 device_list_updater_aurax11_;
104 #endif 104 #endif
105 105
106 scoped_ptr<InputStateLookup> input_state_lookup_; 106 scoped_ptr<InputStateLookup> input_state_lookup_;
107 107
108 DISALLOW_COPY_AND_ASSIGN(Env); 108 DISALLOW_COPY_AND_ASSIGN(Env);
109 }; 109 };
110 110
111 } // namespace aura 111 } // namespace aura
112 112
113 #endif // UI_AURA_ENV_H_ 113 #endif // UI_AURA_ENV_H_
OLDNEW
« base/run_loop.h ('K') | « ui/aura/dispatcher_win.cc ('k') | ui/aura/env.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698