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