Chromium Code Reviews| 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 SERVICES_UI_PUBLIC_CPP_WINDOW_TREE_CLIENT_H_ | 5 #ifndef SERVICES_UI_PUBLIC_CPP_WINDOW_TREE_CLIENT_H_ |
| 6 #define SERVICES_UI_PUBLIC_CPP_WINDOW_TREE_CLIENT_H_ | 6 #define SERVICES_UI_PUBLIC_CPP_WINDOW_TREE_CLIENT_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <map> | 10 #include <map> |
| (...skipping 28 matching lines...) Expand all Loading... | |
| 39 | 39 |
| 40 namespace ui { | 40 namespace ui { |
| 41 class InFlightChange; | 41 class InFlightChange; |
| 42 class WindowTreeClientDelegate; | 42 class WindowTreeClientDelegate; |
| 43 class WindowTreeClientPrivate; | 43 class WindowTreeClientPrivate; |
| 44 class WindowTreeClientObserver; | 44 class WindowTreeClientObserver; |
| 45 enum class ChangeType; | 45 enum class ChangeType; |
| 46 | 46 |
| 47 // Manages the connection with mus. | 47 // Manages the connection with mus. |
| 48 // | 48 // |
| 49 // WindowTreeClient is deleted by any of the following: | 49 // WindowTreeClient is owned by the creator. Generally when the delegate gets |
| 50 // . If all the roots of the connection are destroyed and the connection is | 50 // one of OnEmbedRootDestroyed() or OnLostConnection() it should delete the |
| 51 // configured to delete when there are no roots (true if the WindowTreeClient | 51 // WindowTreeClient. |
| 52 // is created with a mojom::WindowTreeClientRequest). This happens | |
| 53 // if the owner of the roots Embed()s another app in all the roots, or all | |
| 54 // the roots are explicitly deleted. | |
| 55 // . The connection to mus is lost. | |
| 56 // . Explicitly by way of calling delete. | |
| 57 // | 52 // |
| 58 // When WindowTreeClient is deleted all windows are deleted (and observers | 53 // When WindowTreeClient is deleted all windows are deleted (and observers |
| 59 // notified). This is followed by calling | 54 // notified). |
| 60 // WindowTreeClientDelegate::OnDidDestroyClient(). | |
| 61 class WindowTreeClient : public mojom::WindowTreeClient, | 55 class WindowTreeClient : public mojom::WindowTreeClient, |
| 62 public mojom::WindowManager, | 56 public mojom::WindowManager, |
| 63 public WindowManagerClient { | 57 public WindowManagerClient { |
| 64 public: | 58 public: |
| 65 WindowTreeClient(WindowTreeClientDelegate* delegate, | 59 WindowTreeClient(WindowTreeClientDelegate* delegate, |
| 66 WindowManagerDelegate* window_manager_delegate, | 60 WindowManagerDelegate* window_manager_delegate, |
| 67 mojom::WindowTreeClientRequest request); | 61 mojom::WindowTreeClientRequest request); |
| 68 ~WindowTreeClient() override; | 62 ~WindowTreeClient() override; |
| 69 | 63 |
| 70 // Establishes the connection by way of the WindowTreeFactory. | 64 // Establishes the connection by way of the WindowTreeFactory. |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 149 bool IsRoot(Window* window) const { return roots_.count(window) > 0; } | 143 bool IsRoot(Window* window) const { return roots_.count(window) > 0; } |
| 150 | 144 |
| 151 void OnWindowDestroying(Window* window); | 145 void OnWindowDestroying(Window* window); |
| 152 | 146 |
| 153 // Called after the window's observers have been notified of destruction (as | 147 // Called after the window's observers have been notified of destruction (as |
| 154 // the last step of ~Window). | 148 // the last step of ~Window). |
| 155 void OnWindowDestroyed(Window* window); | 149 void OnWindowDestroyed(Window* window); |
| 156 | 150 |
| 157 Window* GetWindowByServerId(Id id); | 151 Window* GetWindowByServerId(Id id); |
| 158 | 152 |
| 159 // Sets whether this is deleted when there are no roots. The default is to | |
| 160 // delete when there are no roots. | |
| 161 void SetDeleteOnNoRoots(bool value); | |
| 162 | |
| 163 // Returns the root of this connection. | 153 // Returns the root of this connection. |
| 164 const std::set<Window*>& GetRoots(); | 154 const std::set<Window*>& GetRoots(); |
| 165 | 155 |
| 166 // Returns the Window with input capture; null if no window has requested | 156 // Returns the Window with input capture; null if no window has requested |
| 167 // input capture, or if another app has capture. | 157 // input capture, or if another app has capture. |
| 168 Window* GetCaptureWindow(); | 158 Window* GetCaptureWindow(); |
| 169 | 159 |
| 170 // Returns the focused window; null if focus is not yet known or another app | 160 // Returns the focused window; null if focus is not yet known or another app |
| 171 // is focused. | 161 // is focused. |
| 172 Window* GetFocusedWindow(); | 162 Window* GetFocusedWindow(); |
| (...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 395 Window* capture_window_; | 385 Window* capture_window_; |
| 396 | 386 |
| 397 Window* focused_window_; | 387 Window* focused_window_; |
| 398 | 388 |
| 399 mojo::Binding<mojom::WindowTreeClient> binding_; | 389 mojo::Binding<mojom::WindowTreeClient> binding_; |
| 400 mojom::WindowTreePtr tree_ptr_; | 390 mojom::WindowTreePtr tree_ptr_; |
| 401 // Typically this is the value contained in |tree_ptr_|, but tests may | 391 // Typically this is the value contained in |tree_ptr_|, but tests may |
| 402 // directly set this. | 392 // directly set this. |
| 403 mojom::WindowTree* tree_; | 393 mojom::WindowTree* tree_; |
| 404 | 394 |
| 405 bool delete_on_no_roots_; | 395 // Set to true if OnEmbed() was received. |
| 396 bool is_from_embed_ = false; | |
| 406 | 397 |
| 407 bool in_destructor_; | 398 bool in_destructor_; |
|
sadrul
2016/09/02 17:04:15
Sidenote: should we switch to default initializing
sky
2016/09/06 17:15:42
Yes, but I'll keep that to a separate patch.
| |
| 408 | 399 |
| 409 // A mapping to shared memory that is one 32 bit integer long. The window | 400 // A mapping to shared memory that is one 32 bit integer long. The window |
| 410 // server uses this to let us synchronously read the cursor location. | 401 // server uses this to let us synchronously read the cursor location. |
| 411 mojo::ScopedSharedBufferMapping cursor_location_mapping_; | 402 mojo::ScopedSharedBufferMapping cursor_location_mapping_; |
| 412 | 403 |
| 413 base::ObserverList<WindowTreeClientObserver> observers_; | 404 base::ObserverList<WindowTreeClientObserver> observers_; |
| 414 | 405 |
| 415 std::unique_ptr<mojo::AssociatedBinding<mojom::WindowManager>> | 406 std::unique_ptr<mojo::AssociatedBinding<mojom::WindowManager>> |
| 416 window_manager_internal_; | 407 window_manager_internal_; |
| 417 mojom::WindowManagerClientAssociatedPtr window_manager_internal_client_; | 408 mojom::WindowManagerClientAssociatedPtr window_manager_internal_client_; |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 430 base::Callback<void(bool)> on_current_move_finished_; | 421 base::Callback<void(bool)> on_current_move_finished_; |
| 431 | 422 |
| 432 base::WeakPtrFactory<WindowTreeClient> weak_factory_; | 423 base::WeakPtrFactory<WindowTreeClient> weak_factory_; |
| 433 | 424 |
| 434 DISALLOW_COPY_AND_ASSIGN(WindowTreeClient); | 425 DISALLOW_COPY_AND_ASSIGN(WindowTreeClient); |
| 435 }; | 426 }; |
| 436 | 427 |
| 437 } // namespace ui | 428 } // namespace ui |
| 438 | 429 |
| 439 #endif // SERVICES_UI_PUBLIC_CPP_WINDOW_TREE_CLIENT_H_ | 430 #endif // SERVICES_UI_PUBLIC_CPP_WINDOW_TREE_CLIENT_H_ |
| OLD | NEW |