| 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" |
| 11 #include "base/observer_list.h" | 11 #include "base/observer_list.h" |
| 12 #include "base/supports_user_data.h" | 12 #include "base/supports_user_data.h" |
| 13 #include "ui/aura/aura_export.h" | 13 #include "ui/aura/aura_export.h" |
| 14 #include "ui/base/dragdrop/os_exchange_data_provider_factory.h" | 14 #include "ui/base/dragdrop/os_exchange_data_provider_factory.h" |
| 15 #include "ui/events/event_handler.h" | 15 #include "ui/events/event_handler.h" |
| 16 #include "ui/events/event_target.h" | 16 #include "ui/events/event_target.h" |
| 17 #include "ui/gfx/geometry/point.h" | 17 #include "ui/gfx/geometry/point.h" |
| 18 | 18 |
| 19 namespace ui { | 19 namespace ui { |
| 20 class ContextFactory; | 20 class ContextFactory; |
| 21 class ContextFactoryPrivate; | 21 class ContextFactoryPrivate; |
| 22 class PlatformEventSource; | 22 class PlatformEventSource; |
| 23 } | 23 } |
| 24 namespace aura { | 24 namespace aura { |
| 25 | |
| 26 namespace client { | |
| 27 class FocusClient; | |
| 28 } | |
| 29 | |
| 30 namespace test { | 25 namespace test { |
| 31 class EnvTestHelper; | 26 class EnvTestHelper; |
| 32 } | 27 } |
| 33 | 28 |
| 34 class EnvObserver; | 29 class EnvObserver; |
| 35 class InputStateLookup; | 30 class InputStateLookup; |
| 36 class MusMouseLocationUpdater; | 31 class MusMouseLocationUpdater; |
| 37 class Window; | 32 class Window; |
| 38 class WindowPort; | 33 class WindowPort; |
| 39 class WindowTreeClient; | 34 class WindowTreeClient; |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 context_factory_private_ = context_factory_private; | 92 context_factory_private_ = context_factory_private; |
| 98 } | 93 } |
| 99 ui::ContextFactoryPrivate* context_factory_private() { | 94 ui::ContextFactoryPrivate* context_factory_private() { |
| 100 return context_factory_private_; | 95 return context_factory_private_; |
| 101 } | 96 } |
| 102 | 97 |
| 103 // See CreateInstance() for description. | 98 // See CreateInstance() for description. |
| 104 void SetWindowTreeClient(WindowTreeClient* window_tree_client); | 99 void SetWindowTreeClient(WindowTreeClient* window_tree_client); |
| 105 bool HasWindowTreeClient() const { return window_tree_client_ != nullptr; } | 100 bool HasWindowTreeClient() const { return window_tree_client_ != nullptr; } |
| 106 | 101 |
| 107 // Sets the active FocusClient and the window the FocusClient is associated | |
| 108 // with. |window| is not necessarily the window that actually has focus. | |
| 109 // |window| may be null, which indicates all windows share a FocusClient. | |
| 110 void SetActiveFocusClient(client::FocusClient* focus_client, | |
| 111 Window* focus_client_root); | |
| 112 client::FocusClient* active_focus_client() { return active_focus_client_; } | |
| 113 Window* active_focus_client_root() { return active_focus_client_root_; } | |
| 114 | |
| 115 private: | 102 private: |
| 116 class ActiveFocusClientWindowObserver; | |
| 117 | |
| 118 friend class test::EnvTestHelper; | 103 friend class test::EnvTestHelper; |
| 119 friend class MusMouseLocationUpdater; | 104 friend class MusMouseLocationUpdater; |
| 120 friend class Window; | 105 friend class Window; |
| 121 friend class WindowTreeHost; | 106 friend class WindowTreeHost; |
| 122 | 107 |
| 123 explicit Env(Mode mode); | 108 explicit Env(Mode mode); |
| 124 | 109 |
| 125 void Init(); | 110 void Init(); |
| 126 | 111 |
| 127 // After calling this method, all OSExchangeDataProvider instances will be | 112 // After calling this method, all OSExchangeDataProvider instances will be |
| 128 // Mus instances. We can't do this work in Init(), because our mode may | 113 // Mus instances. We can't do this work in Init(), because our mode may |
| 129 // changed via the EnvTestHelper. | 114 // changed via the EnvTestHelper. |
| 130 void EnableMusOSExchangeDataProvider(); | 115 void EnableMusOSExchangeDataProvider(); |
| 131 | 116 |
| 132 // Called by the Window when it is initialized. Notifies observers. | 117 // Called by the Window when it is initialized. Notifies observers. |
| 133 void NotifyWindowInitialized(Window* window); | 118 void NotifyWindowInitialized(Window* window); |
| 134 | 119 |
| 135 // Called by the WindowTreeHost when it is initialized. Notifies observers. | 120 // Called by the WindowTreeHost when it is initialized. Notifies observers. |
| 136 void NotifyHostInitialized(WindowTreeHost* host); | 121 void NotifyHostInitialized(WindowTreeHost* host); |
| 137 | 122 |
| 138 // Invoked by WindowTreeHost when it is activated. Notifies observers. | 123 // Invoked by WindowTreeHost when it is activated. Notifies observers. |
| 139 void NotifyHostActivated(WindowTreeHost* host); | 124 void NotifyHostActivated(WindowTreeHost* host); |
| 140 | 125 |
| 141 void OnActiveFocusClientWindowDestroying(); | |
| 142 | |
| 143 // Overridden from ui::EventTarget: | 126 // Overridden from ui::EventTarget: |
| 144 bool CanAcceptEvent(const ui::Event& event) override; | 127 bool CanAcceptEvent(const ui::Event& event) override; |
| 145 ui::EventTarget* GetParentTarget() override; | 128 ui::EventTarget* GetParentTarget() override; |
| 146 std::unique_ptr<ui::EventTargetIterator> GetChildIterator() const override; | 129 std::unique_ptr<ui::EventTargetIterator> GetChildIterator() const override; |
| 147 ui::EventTargeter* GetEventTargeter() override; | 130 ui::EventTargeter* GetEventTargeter() override; |
| 148 | 131 |
| 149 // Overridden from ui::OSExchangeDataProviderFactory::Factory: | 132 // Overridden from ui::OSExchangeDataProviderFactory::Factory: |
| 150 std::unique_ptr<ui::OSExchangeData::Provider> BuildProvider() override; | 133 std::unique_ptr<ui::OSExchangeData::Provider> BuildProvider() override; |
| 151 | 134 |
| 152 // This is not const for tests, which may share Env across tests and so needs | 135 // This is not const for tests, which may share Env across tests and so needs |
| (...skipping 16 matching lines...) Expand all Loading... |
| 169 bool always_use_last_mouse_location_ = false; | 152 bool always_use_last_mouse_location_ = false; |
| 170 // Whether we set ourselves as the OSExchangeDataProviderFactory. | 153 // Whether we set ourselves as the OSExchangeDataProviderFactory. |
| 171 bool is_os_exchange_data_provider_factory_ = false; | 154 bool is_os_exchange_data_provider_factory_ = false; |
| 172 | 155 |
| 173 std::unique_ptr<InputStateLookup> input_state_lookup_; | 156 std::unique_ptr<InputStateLookup> input_state_lookup_; |
| 174 std::unique_ptr<ui::PlatformEventSource> event_source_; | 157 std::unique_ptr<ui::PlatformEventSource> event_source_; |
| 175 | 158 |
| 176 ui::ContextFactory* context_factory_; | 159 ui::ContextFactory* context_factory_; |
| 177 ui::ContextFactoryPrivate* context_factory_private_; | 160 ui::ContextFactoryPrivate* context_factory_private_; |
| 178 | 161 |
| 179 Window* active_focus_client_root_ = nullptr; | |
| 180 client::FocusClient* active_focus_client_ = nullptr; | |
| 181 std::unique_ptr<ActiveFocusClientWindowObserver> | |
| 182 active_focus_client_window_observer_; | |
| 183 | |
| 184 DISALLOW_COPY_AND_ASSIGN(Env); | 162 DISALLOW_COPY_AND_ASSIGN(Env); |
| 185 }; | 163 }; |
| 186 | 164 |
| 187 } // namespace aura | 165 } // namespace aura |
| 188 | 166 |
| 189 #endif // UI_AURA_ENV_H_ | 167 #endif // UI_AURA_ENV_H_ |
| OLD | NEW |