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/observer_list.h" | 9 #include "base/observer_list.h" |
10 #include "ui/aura/aura_export.h" | 10 #include "ui/aura/aura_export.h" |
(...skipping 14 matching lines...) Expand all Loading... |
25 class InputStateLookup; | 25 class InputStateLookup; |
26 class Window; | 26 class Window; |
27 class WindowTreeHost; | 27 class WindowTreeHost; |
28 | 28 |
29 // A singleton object that tracks general state within Aura. | 29 // A singleton object that tracks general state within Aura. |
30 class AURA_EXPORT Env : public ui::EventTarget { | 30 class AURA_EXPORT Env : public ui::EventTarget { |
31 public: | 31 public: |
32 Env(); | 32 Env(); |
33 virtual ~Env(); | 33 virtual ~Env(); |
34 | 34 |
35 static void CreateInstance(); | 35 // Creates the single Env instance (if it hasn't been created yet). If |
| 36 // |create_event_source| is true a PlatformEventSource is created. |
| 37 // TODO(sky): nuke |create_event_source|. Only necessary while mojo's |
| 38 // nativeviewportservice lives in the same process as the viewmanager. |
| 39 static void CreateInstance(bool create_event_source); |
36 static Env* GetInstance(); | 40 static Env* GetInstance(); |
37 static void DeleteInstance(); | 41 static void DeleteInstance(); |
38 | 42 |
39 void AddObserver(EnvObserver* observer); | 43 void AddObserver(EnvObserver* observer); |
40 void RemoveObserver(EnvObserver* observer); | 44 void RemoveObserver(EnvObserver* observer); |
41 | 45 |
42 const int mouse_button_flags() const { return mouse_button_flags_; } | 46 const int mouse_button_flags() const { return mouse_button_flags_; } |
43 void set_mouse_button_flags(int mouse_button_flags) { | 47 void set_mouse_button_flags(int mouse_button_flags) { |
44 mouse_button_flags_ = mouse_button_flags; | 48 mouse_button_flags_ = mouse_button_flags; |
45 } | 49 } |
(...skipping 10 matching lines...) Expand all Loading... |
56 | 60 |
57 // Whether any touch device is currently down. | 61 // Whether any touch device is currently down. |
58 bool is_touch_down() const { return is_touch_down_; } | 62 bool is_touch_down() const { return is_touch_down_; } |
59 void set_touch_down(bool value) { is_touch_down_ = value; } | 63 void set_touch_down(bool value) { is_touch_down_ = value; } |
60 | 64 |
61 private: | 65 private: |
62 friend class test::EnvTestHelper; | 66 friend class test::EnvTestHelper; |
63 friend class Window; | 67 friend class Window; |
64 friend class WindowTreeHost; | 68 friend class WindowTreeHost; |
65 | 69 |
66 void Init(); | 70 // See description of CreateInstance() for deatils of |create_event_source|. |
| 71 void Init(bool create_event_source); |
67 | 72 |
68 // Called by the Window when it is initialized. Notifies observers. | 73 // Called by the Window when it is initialized. Notifies observers. |
69 void NotifyWindowInitialized(Window* window); | 74 void NotifyWindowInitialized(Window* window); |
70 | 75 |
71 // Called by the WindowTreeHost when it is initialized. Notifies observers. | 76 // Called by the WindowTreeHost when it is initialized. Notifies observers. |
72 void NotifyHostInitialized(WindowTreeHost* host); | 77 void NotifyHostInitialized(WindowTreeHost* host); |
73 | 78 |
74 // Invoked by WindowTreeHost when it is activated. Notifies observers. | 79 // Invoked by WindowTreeHost when it is activated. Notifies observers. |
75 void NotifyHostActivated(WindowTreeHost* host); | 80 void NotifyHostActivated(WindowTreeHost* host); |
76 | 81 |
(...skipping 13 matching lines...) Expand all Loading... |
90 | 95 |
91 scoped_ptr<InputStateLookup> input_state_lookup_; | 96 scoped_ptr<InputStateLookup> input_state_lookup_; |
92 scoped_ptr<ui::PlatformEventSource> event_source_; | 97 scoped_ptr<ui::PlatformEventSource> event_source_; |
93 | 98 |
94 DISALLOW_COPY_AND_ASSIGN(Env); | 99 DISALLOW_COPY_AND_ASSIGN(Env); |
95 }; | 100 }; |
96 | 101 |
97 } // namespace aura | 102 } // namespace aura |
98 | 103 |
99 #endif // UI_AURA_ENV_H_ | 104 #endif // UI_AURA_ENV_H_ |
OLD | NEW |