| 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 #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_loop.h" |
| 10 #include "base/observer_list.h" | 10 #include "base/observer_list.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 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 #if !defined(OS_MACOSX) && !defined(OS_ANDROID) && !defined(USE_X11) | 31 #if !defined(OS_ANDROID) && !defined(USE_X11) |
| 32 // Creates a platform-specific native event dispatcher. | 32 // Creates a platform-specific native event dispatcher. |
| 33 base::MessageLoop::Dispatcher* CreateDispatcher(); | 33 base::MessageLoop::Dispatcher* CreateDispatcher(); |
| 34 #endif | 34 #endif |
| 35 | 35 |
| 36 // A singleton object that tracks general state within Aura. | 36 // A singleton object that tracks general state within Aura. |
| 37 // TODO(beng): manage RootWindows. | 37 // TODO(beng): manage RootWindows. |
| 38 class AURA_EXPORT Env : public ui::EventTarget { | 38 class AURA_EXPORT Env : public ui::EventTarget { |
| 39 public: | 39 public: |
| 40 Env(); | 40 Env(); |
| 41 virtual ~Env(); | 41 virtual ~Env(); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 61 last_mouse_location_ = last_mouse_location; | 61 last_mouse_location_ = last_mouse_location; |
| 62 } | 62 } |
| 63 | 63 |
| 64 // Whether any touch device is currently down. | 64 // Whether any touch device is currently down. |
| 65 bool is_touch_down() const { return is_touch_down_; } | 65 bool is_touch_down() const { return is_touch_down_; } |
| 66 void set_touch_down(bool value) { is_touch_down_ = value; } | 66 void set_touch_down(bool value) { is_touch_down_ = value; } |
| 67 | 67 |
| 68 // Returns the native event dispatcher. The result should only be passed to | 68 // Returns the native event dispatcher. The result should only be passed to |
| 69 // base::RunLoop(dispatcher), or used to dispatch an event by | 69 // base::RunLoop(dispatcher), or used to dispatch an event by |
| 70 // |Dispatch(const NativeEvent&)| on it. It must never be stored. | 70 // |Dispatch(const NativeEvent&)| on it. It must never be stored. |
| 71 #if !defined(OS_MACOSX) && !defined(OS_ANDROID) && \ | 71 #if defined(USE_AURA) |
| 72 !defined(USE_GTK_MESSAGE_PUMP) | |
| 73 base::MessageLoop::Dispatcher* GetDispatcher(); | 72 base::MessageLoop::Dispatcher* GetDispatcher(); |
| 74 #endif | 73 #endif |
| 75 | 74 |
| 76 // Invoked by RootWindow when its host is activated. | 75 // Invoked by RootWindow when its host is activated. |
| 77 void RootWindowActivated(RootWindow* root_window); | 76 void RootWindowActivated(RootWindow* root_window); |
| 78 | 77 |
| 79 private: | 78 private: |
| 80 friend class test::EnvTestHelper; | 79 friend class test::EnvTestHelper; |
| 81 friend class Window; | 80 friend class Window; |
| 82 friend class RootWindowHost; | 81 friend class RootWindowHost; |
| 83 | 82 |
| 84 void Init(); | 83 void Init(); |
| 85 | 84 |
| 86 // Called by the Window when it is initialized. Notifies observers. | 85 // Called by the Window when it is initialized. Notifies observers. |
| 87 void NotifyWindowInitialized(Window* window); | 86 void NotifyWindowInitialized(Window* window); |
| 88 | 87 |
| 89 // Called by the RootWindow when it is initialized. Notifies observers. | 88 // Called by the RootWindow when it is initialized. Notifies observers. |
| 90 void NotifyRootWindowInitialized(RootWindow* root_window); | 89 void NotifyRootWindowInitialized(RootWindow* root_window); |
| 91 | 90 |
| 92 // Overridden from ui::EventTarget: | 91 // Overridden from ui::EventTarget: |
| 93 virtual bool CanAcceptEvent(const ui::Event& event) OVERRIDE; | 92 virtual bool CanAcceptEvent(const ui::Event& event) OVERRIDE; |
| 94 virtual ui::EventTarget* GetParentTarget() OVERRIDE; | 93 virtual ui::EventTarget* GetParentTarget() OVERRIDE; |
| 95 virtual scoped_ptr<ui::EventTargetIterator> GetChildIterator() const OVERRIDE; | 94 virtual scoped_ptr<ui::EventTargetIterator> GetChildIterator() const OVERRIDE; |
| 96 virtual ui::EventTargeter* GetEventTargeter() OVERRIDE; | 95 virtual ui::EventTargeter* GetEventTargeter() OVERRIDE; |
| 97 | 96 |
| 98 ObserverList<EnvObserver> observers_; | 97 ObserverList<EnvObserver> observers_; |
| 99 #if !defined(OS_MACOSX) && !defined(OS_ANDROID) && !defined(USE_X11) | 98 #if !defined(OS_ANDROID) && !defined(USE_X11) |
| 100 scoped_ptr<base::MessageLoop::Dispatcher> dispatcher_; | 99 scoped_ptr<base::MessageLoop::Dispatcher> dispatcher_; |
| 101 #endif | 100 #endif |
| 102 | 101 |
| 103 static Env* instance_; | 102 static Env* instance_; |
| 104 int mouse_button_flags_; | 103 int mouse_button_flags_; |
| 105 // Location of last mouse event, in screen coordinates. | 104 // Location of last mouse event, in screen coordinates. |
| 106 gfx::Point last_mouse_location_; | 105 gfx::Point last_mouse_location_; |
| 107 bool is_touch_down_; | 106 bool is_touch_down_; |
| 108 | 107 |
| 109 #if defined(USE_X11) | 108 #if defined(USE_X11) |
| 110 DeviceListUpdaterAuraX11 device_list_updater_aurax11_; | 109 DeviceListUpdaterAuraX11 device_list_updater_aurax11_; |
| 111 #endif | 110 #endif |
| 112 | 111 |
| 113 scoped_ptr<InputStateLookup> input_state_lookup_; | 112 scoped_ptr<InputStateLookup> input_state_lookup_; |
| 114 | 113 |
| 115 DISALLOW_COPY_AND_ASSIGN(Env); | 114 DISALLOW_COPY_AND_ASSIGN(Env); |
| 116 }; | 115 }; |
| 117 | 116 |
| 118 } // namespace aura | 117 } // namespace aura |
| 119 | 118 |
| 120 #endif // UI_AURA_ENV_H_ | 119 #endif // UI_AURA_ENV_H_ |
| OLD | NEW |