| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 COMPONENTS_MUS_PUBLIC_CPP_LIB_WINDOW_TREE_CLIENT_IMPL_H_ | 5 #ifndef COMPONENTS_MUS_PUBLIC_CPP_LIB_WINDOW_TREE_CLIENT_IMPL_H_ |
| 6 #define COMPONENTS_MUS_PUBLIC_CPP_LIB_WINDOW_TREE_CLIENT_IMPL_H_ | 6 #define COMPONENTS_MUS_PUBLIC_CPP_LIB_WINDOW_TREE_CLIENT_IMPL_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <map> | 10 #include <map> |
| 11 #include <set> | 11 #include <set> |
| 12 | 12 |
| 13 #include "base/atomicops.h" |
| 13 #include "base/macros.h" | 14 #include "base/macros.h" |
| 15 #include "base/memory/weak_ptr.h" |
| 14 #include "base/observer_list.h" | 16 #include "base/observer_list.h" |
| 15 #include "components/mus/common/types.h" | 17 #include "components/mus/common/types.h" |
| 16 #include "components/mus/public/cpp/window.h" | 18 #include "components/mus/public/cpp/window.h" |
| 17 #include "components/mus/public/cpp/window_manager_delegate.h" | 19 #include "components/mus/public/cpp/window_manager_delegate.h" |
| 18 #include "components/mus/public/cpp/window_tree_connection.h" | 20 #include "components/mus/public/cpp/window_tree_connection.h" |
| 19 #include "components/mus/public/interfaces/window_tree.mojom.h" | 21 #include "components/mus/public/interfaces/window_tree.mojom.h" |
| 20 #include "mojo/public/cpp/bindings/associated_binding.h" | 22 #include "mojo/public/cpp/bindings/associated_binding.h" |
| 21 #include "mojo/public/cpp/bindings/strong_binding.h" | 23 #include "mojo/public/cpp/bindings/strong_binding.h" |
| 22 | 24 |
| 23 namespace gfx { | 25 namespace gfx { |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 Window* NewWindowImpl(NewWindowType type, | 157 Window* NewWindowImpl(NewWindowType type, |
| 156 const Window::SharedProperties* properties); | 158 const Window::SharedProperties* properties); |
| 157 | 159 |
| 158 // OnEmbed() calls into this. Exposed as a separate function for testing. | 160 // OnEmbed() calls into this. Exposed as a separate function for testing. |
| 159 void OnEmbedImpl(mojom::WindowTree* window_tree, | 161 void OnEmbedImpl(mojom::WindowTree* window_tree, |
| 160 ConnectionSpecificId connection_id, | 162 ConnectionSpecificId connection_id, |
| 161 mojom::WindowDataPtr root_data, | 163 mojom::WindowDataPtr root_data, |
| 162 Id focused_window_id, | 164 Id focused_window_id, |
| 163 bool drawn); | 165 bool drawn); |
| 164 | 166 |
| 167 void OnReceivedCursorLocationMemory(mojo::ScopedSharedBufferHandle handle); |
| 168 |
| 165 // Overridden from WindowTreeConnection: | 169 // Overridden from WindowTreeConnection: |
| 166 void SetDeleteOnNoRoots(bool value) override; | 170 void SetDeleteOnNoRoots(bool value) override; |
| 167 const std::set<Window*>& GetRoots() override; | 171 const std::set<Window*>& GetRoots() override; |
| 168 Window* GetFocusedWindow() override; | 172 Window* GetFocusedWindow() override; |
| 169 void ClearFocus() override; | 173 void ClearFocus() override; |
| 174 gfx::Point GetCursorScreenPoint() override; |
| 170 void SetEventObserver(mojom::EventMatcherPtr matcher) override; | 175 void SetEventObserver(mojom::EventMatcherPtr matcher) override; |
| 171 Window* NewWindow(const Window::SharedProperties* properties) override; | 176 Window* NewWindow(const Window::SharedProperties* properties) override; |
| 172 Window* NewTopLevelWindow( | 177 Window* NewTopLevelWindow( |
| 173 const Window::SharedProperties* properties) override; | 178 const Window::SharedProperties* properties) override; |
| 174 ConnectionSpecificId GetConnectionId() override; | 179 ConnectionSpecificId GetConnectionId() override; |
| 175 void AddObserver(WindowTreeConnectionObserver* observer) override; | 180 void AddObserver(WindowTreeConnectionObserver* observer) override; |
| 176 void RemoveObserver(WindowTreeConnectionObserver* observer) override; | 181 void RemoveObserver(WindowTreeConnectionObserver* observer) override; |
| 177 | 182 |
| 178 // Overridden from WindowTreeClient: | 183 // Overridden from WindowTreeClient: |
| 179 void OnEmbed(ConnectionSpecificId connection_id, | 184 void OnEmbed(ConnectionSpecificId connection_id, |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 287 mojo::Binding<WindowTreeClient> binding_; | 292 mojo::Binding<WindowTreeClient> binding_; |
| 288 mojom::WindowTreePtr tree_ptr_; | 293 mojom::WindowTreePtr tree_ptr_; |
| 289 // Typically this is the value contained in |tree_ptr_|, but tests may | 294 // Typically this is the value contained in |tree_ptr_|, but tests may |
| 290 // directly set this. | 295 // directly set this. |
| 291 mojom::WindowTree* tree_; | 296 mojom::WindowTree* tree_; |
| 292 | 297 |
| 293 bool delete_on_no_roots_; | 298 bool delete_on_no_roots_; |
| 294 | 299 |
| 295 bool in_destructor_; | 300 bool in_destructor_; |
| 296 | 301 |
| 302 // A handle to shared memory that is one 32 bit integer long. The window |
| 303 // server uses this to let us synchronously read the cursor location. |
| 304 mojo::ScopedSharedBufferHandle cursor_location_handle_; |
| 305 |
| 306 // The one int in |cursor_location_handle_|. When we read from this |
| 307 // location, we must always read from it atomically. |
| 308 base::subtle::Atomic32* cursor_location_memory_; |
| 309 |
| 297 base::ObserverList<WindowTreeConnectionObserver> observers_; | 310 base::ObserverList<WindowTreeConnectionObserver> observers_; |
| 298 | 311 |
| 299 std::unique_ptr<mojo::AssociatedBinding<mojom::WindowManager>> | 312 std::unique_ptr<mojo::AssociatedBinding<mojom::WindowManager>> |
| 300 window_manager_internal_; | 313 window_manager_internal_; |
| 301 mojom::WindowManagerClientAssociatedPtr window_manager_internal_client_; | 314 mojom::WindowManagerClientAssociatedPtr window_manager_internal_client_; |
| 302 | 315 |
| 303 bool has_event_observer_ = false; | 316 bool has_event_observer_ = false; |
| 304 | 317 |
| 305 // Monotonically increasing ID for event observers. | 318 // Monotonically increasing ID for event observers. |
| 306 uint32_t event_observer_id_ = 0u; | 319 uint32_t event_observer_id_ = 0u; |
| 307 | 320 |
| 321 base::WeakPtrFactory<WindowTreeClientImpl> weak_factory_; |
| 322 |
| 308 DISALLOW_COPY_AND_ASSIGN(WindowTreeClientImpl); | 323 DISALLOW_COPY_AND_ASSIGN(WindowTreeClientImpl); |
| 309 }; | 324 }; |
| 310 | 325 |
| 311 } // namespace mus | 326 } // namespace mus |
| 312 | 327 |
| 313 #endif // COMPONENTS_MUS_PUBLIC_CPP_LIB_WINDOW_TREE_CLIENT_IMPL_H_ | 328 #endif // COMPONENTS_MUS_PUBLIC_CPP_LIB_WINDOW_TREE_CLIENT_IMPL_H_ |
| OLD | NEW |