Chromium Code Reviews| 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 "base/supports_user_data.h" | 10 #include "base/supports_user_data.h" |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 31 // A singleton object that tracks general state within Aura. | 31 // A singleton object that tracks general state within Aura. |
| 32 class AURA_EXPORT Env : public ui::EventTarget, public base::SupportsUserData { | 32 class AURA_EXPORT Env : public ui::EventTarget, public base::SupportsUserData { |
| 33 public: | 33 public: |
| 34 // Creates the single Env instance (if it hasn't been created yet). If | 34 // Creates the single Env instance (if it hasn't been created yet). If |
| 35 // |create_event_source| is true a PlatformEventSource is created. | 35 // |create_event_source| is true a PlatformEventSource is created. |
| 36 // TODO(sky): nuke |create_event_source|. Only necessary while mojo's | 36 // TODO(sky): nuke |create_event_source|. Only necessary while mojo's |
| 37 // nativeviewportservice lives in the same process as the viewmanager. | 37 // nativeviewportservice lives in the same process as the viewmanager. |
| 38 static void CreateInstance(bool create_event_source); | 38 static void CreateInstance(bool create_event_source); |
| 39 static Env* GetInstance(); | 39 static Env* GetInstance(); |
| 40 static void DeleteInstance(); | 40 static void DeleteInstance(); |
| 41 static bool HasInstanceForTesting(); | |
|
sky
2015/02/28 17:30:46
I would rather have a GetInstanceDontCreate type o
Devlin
2015/03/02 17:27:12
Done.
| |
| 41 | 42 |
| 42 void AddObserver(EnvObserver* observer); | 43 void AddObserver(EnvObserver* observer); |
| 43 void RemoveObserver(EnvObserver* observer); | 44 void RemoveObserver(EnvObserver* observer); |
| 44 | 45 |
| 45 int mouse_button_flags() const { return mouse_button_flags_; } | 46 int mouse_button_flags() const { return mouse_button_flags_; } |
| 46 void set_mouse_button_flags(int mouse_button_flags) { | 47 void set_mouse_button_flags(int mouse_button_flags) { |
| 47 mouse_button_flags_ = mouse_button_flags; | 48 mouse_button_flags_ = mouse_button_flags; |
| 48 } | 49 } |
| 49 // Returns true if a mouse button is down. This may query the native OS, | 50 // Returns true if a mouse button is down. This may query the native OS, |
| 50 // otherwise it uses |mouse_button_flags_|. | 51 // otherwise it uses |mouse_button_flags_|. |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 103 scoped_ptr<ui::PlatformEventSource> event_source_; | 104 scoped_ptr<ui::PlatformEventSource> event_source_; |
| 104 | 105 |
| 105 ui::ContextFactory* context_factory_; | 106 ui::ContextFactory* context_factory_; |
| 106 | 107 |
| 107 DISALLOW_COPY_AND_ASSIGN(Env); | 108 DISALLOW_COPY_AND_ASSIGN(Env); |
| 108 }; | 109 }; |
| 109 | 110 |
| 110 } // namespace aura | 111 } // namespace aura |
| 111 | 112 |
| 112 #endif // UI_AURA_ENV_H_ | 113 #endif // UI_AURA_ENV_H_ |
| OLD | NEW |