| 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 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
| 11 #include "base/observer_list.h" | 11 #include "base/observer_list.h" |
| 12 #include "ui/aura/aura_export.h" | 12 #include "ui/aura/aura_export.h" |
| 13 #include "ui/aura/client/stacking_client.h" | 13 #include "ui/aura/client/stacking_client.h" |
| 14 | 14 |
| 15 namespace aura { | 15 namespace aura { |
| 16 | 16 |
| 17 class EnvObserver; | 17 class EnvObserver; |
| 18 class MonitorChangeObserverX11; |
| 18 class MonitorManager; | 19 class MonitorManager; |
| 19 class Window; | 20 class Window; |
| 20 | 21 |
| 21 #if !defined(OS_MACOSX) | 22 #if !defined(OS_MACOSX) |
| 22 class Dispatcher : public MessageLoop::Dispatcher { | 23 class Dispatcher : public MessageLoop::Dispatcher { |
| 23 public: | 24 public: |
| 24 virtual ~Dispatcher() {} | 25 virtual ~Dispatcher() {} |
| 25 }; | 26 }; |
| 26 | 27 |
| 27 // Creates a platform-specific native event dispatcher. | 28 // Creates a platform-specific native event dispatcher. |
| (...skipping 16 matching lines...) Expand all Loading... |
| 44 bool is_mouse_button_down() const { return mouse_button_flags_ != 0; } | 45 bool is_mouse_button_down() const { return mouse_button_flags_ != 0; } |
| 45 void set_mouse_button_flags(int mouse_button_flags) { | 46 void set_mouse_button_flags(int mouse_button_flags) { |
| 46 mouse_button_flags_ = mouse_button_flags; | 47 mouse_button_flags_ = mouse_button_flags; |
| 47 } | 48 } |
| 48 | 49 |
| 49 client::StackingClient* stacking_client() { return stacking_client_; } | 50 client::StackingClient* stacking_client() { return stacking_client_; } |
| 50 void set_stacking_client(client::StackingClient* stacking_client) { | 51 void set_stacking_client(client::StackingClient* stacking_client) { |
| 51 stacking_client_ = stacking_client; | 52 stacking_client_ = stacking_client; |
| 52 } | 53 } |
| 53 | 54 |
| 55 #if defined(USE_X11) |
| 56 MonitorChangeObserverX11* monitor_change_observer() { |
| 57 return monitor_change_observer_.get(); |
| 58 } |
| 59 #endif |
| 60 |
| 54 // Gets/sets MonitorManager. The MonitorManager's ownership is | 61 // Gets/sets MonitorManager. The MonitorManager's ownership is |
| 55 // transfered. | 62 // transfered. |
| 56 MonitorManager* monitor_manager() { return monitor_manager_.get(); } | 63 MonitorManager* monitor_manager() { return monitor_manager_.get(); } |
| 57 void SetMonitorManager(MonitorManager* monitor_manager); | 64 void SetMonitorManager(MonitorManager* monitor_manager); |
| 58 | 65 |
| 59 // 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 |
| 60 // MessageLoopForUI::RunWithDispatcher() or | 67 // MessageLoopForUI::RunWithDispatcher() or |
| 61 // MessageLoopForUI::RunAllPendingWithDispatcher(), or used to dispatch | 68 // MessageLoopForUI::RunAllPendingWithDispatcher(), or used to dispatch |
| 62 // an event by |Dispatch(const NativeEvent&)| on it. It must never be stored. | 69 // an event by |Dispatch(const NativeEvent&)| on it. It must never be stored. |
| 63 #if !defined(OS_MACOSX) | 70 #if !defined(OS_MACOSX) |
| 64 MessageLoop::Dispatcher* GetDispatcher(); | 71 MessageLoop::Dispatcher* GetDispatcher(); |
| 65 #endif | 72 #endif |
| 66 | 73 |
| 67 private: | 74 private: |
| 68 friend class Window; | 75 friend class Window; |
| 69 | 76 |
| 70 // Called by the Window when it is initialized. Notifies observers. | 77 // Called by the Window when it is initialized. Notifies observers. |
| 71 void NotifyWindowInitialized(Window* window); | 78 void NotifyWindowInitialized(Window* window); |
| 72 | 79 |
| 73 ObserverList<EnvObserver> observers_; | 80 ObserverList<EnvObserver> observers_; |
| 74 #if !defined(OS_MACOSX) | 81 #if !defined(OS_MACOSX) |
| 75 scoped_ptr<Dispatcher> dispatcher_; | 82 scoped_ptr<Dispatcher> dispatcher_; |
| 76 #endif | 83 #endif |
| 77 | 84 |
| 78 static Env* instance_; | 85 static Env* instance_; |
| 79 int mouse_button_flags_; | 86 int mouse_button_flags_; |
| 80 client::StackingClient* stacking_client_; | 87 client::StackingClient* stacking_client_; |
| 81 scoped_ptr<MonitorManager> monitor_manager_; | 88 scoped_ptr<MonitorManager> monitor_manager_; |
| 82 | 89 |
| 90 #if defined(USE_X11) |
| 91 scoped_ptr<MonitorChangeObserverX11> monitor_change_observer_; |
| 92 #endif |
| 93 |
| 83 DISALLOW_COPY_AND_ASSIGN(Env); | 94 DISALLOW_COPY_AND_ASSIGN(Env); |
| 84 }; | 95 }; |
| 85 | 96 |
| 86 } // namespace aura | 97 } // namespace aura |
| 87 | 98 |
| 88 #endif // UI_AURA_ENV_H_ | 99 #endif // UI_AURA_ENV_H_ |
| OLD | NEW |