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