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 <memory> | 8 #include <memory> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 }; | 48 }; |
49 | 49 |
50 ~Env() override; | 50 ~Env() override; |
51 | 51 |
52 // NOTE: if you pass in Mode::MUS it is expected that you call | 52 // NOTE: if you pass in Mode::MUS it is expected that you call |
53 // SetWindowTreeClient() before any windows are created. | 53 // SetWindowTreeClient() before any windows are created. |
54 static std::unique_ptr<Env> CreateInstance(Mode mode = Mode::LOCAL); | 54 static std::unique_ptr<Env> CreateInstance(Mode mode = Mode::LOCAL); |
55 static Env* GetInstance(); | 55 static Env* GetInstance(); |
56 static Env* GetInstanceDontCreate(); | 56 static Env* GetInstanceDontCreate(); |
57 | 57 |
| 58 Mode mode() const { return mode_; } |
| 59 |
58 // Called internally to create the appropriate WindowPort implementation. | 60 // Called internally to create the appropriate WindowPort implementation. |
59 std::unique_ptr<WindowPort> CreateWindowPort(Window* window); | 61 std::unique_ptr<WindowPort> CreateWindowPort(Window* window); |
60 | 62 |
61 void AddObserver(EnvObserver* observer); | 63 void AddObserver(EnvObserver* observer); |
62 void RemoveObserver(EnvObserver* observer); | 64 void RemoveObserver(EnvObserver* observer); |
63 | 65 |
64 int mouse_button_flags() const { return mouse_button_flags_; } | 66 int mouse_button_flags() const { return mouse_button_flags_; } |
65 void set_mouse_button_flags(int mouse_button_flags) { | 67 void set_mouse_button_flags(int mouse_button_flags) { |
66 mouse_button_flags_ = mouse_button_flags; | 68 mouse_button_flags_ = mouse_button_flags; |
67 } | 69 } |
(...skipping 12 matching lines...) Expand all Loading... |
80 bool is_touch_down() const { return is_touch_down_; } | 82 bool is_touch_down() const { return is_touch_down_; } |
81 void set_touch_down(bool value) { is_touch_down_ = value; } | 83 void set_touch_down(bool value) { is_touch_down_ = value; } |
82 | 84 |
83 void set_context_factory(ui::ContextFactory* context_factory) { | 85 void set_context_factory(ui::ContextFactory* context_factory) { |
84 context_factory_ = context_factory; | 86 context_factory_ = context_factory; |
85 } | 87 } |
86 ui::ContextFactory* context_factory() { return context_factory_; } | 88 ui::ContextFactory* context_factory() { return context_factory_; } |
87 | 89 |
88 // See CreateInstance() for description. | 90 // See CreateInstance() for description. |
89 void SetWindowTreeClient(WindowTreeClient* window_tree_client); | 91 void SetWindowTreeClient(WindowTreeClient* window_tree_client); |
| 92 bool HasWindowTreeClient() const { return window_tree_client_ != nullptr; } |
90 | 93 |
91 // Sets the active FocusClient and the window the FocusClient is associated | 94 // Sets the active FocusClient and the window the FocusClient is associated |
92 // with. |window| is not necessarily the window that actually has focus. | 95 // with. |window| is not necessarily the window that actually has focus. |
93 // |window| may be null, which indicates all windows share a FocusClient. | 96 // |window| may be null, which indicates all windows share a FocusClient. |
94 void SetActiveFocusClient(client::FocusClient* focus_client, | 97 void SetActiveFocusClient(client::FocusClient* focus_client, |
95 Window* focus_client_root); | 98 Window* focus_client_root); |
96 client::FocusClient* active_focus_client() { return active_focus_client_; } | 99 client::FocusClient* active_focus_client() { return active_focus_client_; } |
97 Window* active_focus_client_root() { return active_focus_client_root_; } | 100 Window* active_focus_client_root() { return active_focus_client_root_; } |
98 | 101 |
99 private: | 102 private: |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 client::FocusClient* active_focus_client_ = nullptr; | 148 client::FocusClient* active_focus_client_ = nullptr; |
146 std::unique_ptr<ActiveFocusClientWindowObserver> | 149 std::unique_ptr<ActiveFocusClientWindowObserver> |
147 active_focus_client_window_observer_; | 150 active_focus_client_window_observer_; |
148 | 151 |
149 DISALLOW_COPY_AND_ASSIGN(Env); | 152 DISALLOW_COPY_AND_ASSIGN(Env); |
150 }; | 153 }; |
151 | 154 |
152 } // namespace aura | 155 } // namespace aura |
153 | 156 |
154 #endif // UI_AURA_ENV_H_ | 157 #endif // UI_AURA_ENV_H_ |
OLD | NEW |