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 #if defined(USE_X11) |
| 16 #include "ui/aura/x11_atom_cache.h" |
| 17 #endif |
| 18 |
15 namespace aura { | 19 namespace aura { |
16 | 20 |
17 class EnvObserver; | 21 class EnvObserver; |
18 class MonitorManager; | 22 class MonitorManager; |
19 class Window; | 23 class Window; |
20 | 24 |
21 namespace internal { | 25 namespace internal { |
22 class MonitorChangeObserverX11; | 26 class MonitorChangeObserverX11; |
23 } | 27 } |
24 | 28 |
(...skipping 23 matching lines...) Expand all Loading... |
48 client::StackingClient* stacking_client() { return stacking_client_; } | 52 client::StackingClient* stacking_client() { return stacking_client_; } |
49 void set_stacking_client(client::StackingClient* stacking_client) { | 53 void set_stacking_client(client::StackingClient* stacking_client) { |
50 stacking_client_ = stacking_client; | 54 stacking_client_ = stacking_client; |
51 } | 55 } |
52 | 56 |
53 // Gets/sets MonitorManager. The MonitorManager's ownership is | 57 // Gets/sets MonitorManager. The MonitorManager's ownership is |
54 // transfered. | 58 // transfered. |
55 MonitorManager* monitor_manager() { return monitor_manager_.get(); } | 59 MonitorManager* monitor_manager() { return monitor_manager_.get(); } |
56 void SetMonitorManager(MonitorManager* monitor_manager); | 60 void SetMonitorManager(MonitorManager* monitor_manager); |
57 | 61 |
| 62 #if defined(USE_X11) |
| 63 // Gets the X11 atom cache. This must not persist the cache across |
| 64 // Env::DeleteInstance() calls. |
| 65 X11AtomCache* atom_cache() { return &atom_cache_; } |
| 66 #endif |
| 67 |
58 // 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 |
59 // MessageLoopForUI::RunWithDispatcher() or | 69 // MessageLoopForUI::RunWithDispatcher() or |
60 // MessageLoopForUI::RunAllPendingWithDispatcher(), or used to dispatch | 70 // MessageLoopForUI::RunAllPendingWithDispatcher(), or used to dispatch |
61 // an event by |Dispatch(const NativeEvent&)| on it. It must never be stored. | 71 // an event by |Dispatch(const NativeEvent&)| on it. It must never be stored. |
62 #if !defined(OS_MACOSX) | 72 #if !defined(OS_MACOSX) |
63 MessageLoop::Dispatcher* GetDispatcher(); | 73 MessageLoop::Dispatcher* GetDispatcher(); |
64 #endif | 74 #endif |
65 | 75 |
66 private: | 76 private: |
67 friend class Window; | 77 friend class Window; |
68 | 78 |
69 void Init(); | 79 void Init(); |
70 | 80 |
71 // Called by the Window when it is initialized. Notifies observers. | 81 // Called by the Window when it is initialized. Notifies observers. |
72 void NotifyWindowInitialized(Window* window); | 82 void NotifyWindowInitialized(Window* window); |
73 | 83 |
74 ObserverList<EnvObserver> observers_; | 84 ObserverList<EnvObserver> observers_; |
75 #if !defined(OS_MACOSX) | 85 #if !defined(OS_MACOSX) |
76 scoped_ptr<MessageLoop::Dispatcher> dispatcher_; | 86 scoped_ptr<MessageLoop::Dispatcher> dispatcher_; |
77 #endif | 87 #endif |
78 | 88 |
79 static Env* instance_; | 89 static Env* instance_; |
80 int mouse_button_flags_; | 90 int mouse_button_flags_; |
81 client::StackingClient* stacking_client_; | 91 client::StackingClient* stacking_client_; |
82 scoped_ptr<MonitorManager> monitor_manager_; | 92 scoped_ptr<MonitorManager> monitor_manager_; |
83 | 93 |
84 #if defined(USE_X11) | 94 #if defined(USE_X11) |
85 scoped_ptr<internal::MonitorChangeObserverX11> monitor_change_observer_; | 95 scoped_ptr<internal::MonitorChangeObserverX11> monitor_change_observer_; |
| 96 X11AtomCache atom_cache_; |
86 #endif | 97 #endif |
87 | 98 |
88 DISALLOW_COPY_AND_ASSIGN(Env); | 99 DISALLOW_COPY_AND_ASSIGN(Env); |
89 }; | 100 }; |
90 | 101 |
91 } // namespace aura | 102 } // namespace aura |
92 | 103 |
93 #endif // UI_AURA_ENV_H_ | 104 #endif // UI_AURA_ENV_H_ |
OLD | NEW |