| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef COMPONENTS_MUS_WS_WINDOW_TREE_BINDING_H_ | |
| 6 #define COMPONENTS_MUS_WS_WINDOW_TREE_BINDING_H_ | |
| 7 | |
| 8 #include <memory> | |
| 9 | |
| 10 #include "base/macros.h" | |
| 11 #include "components/mus/public/interfaces/window_tree.mojom.h" | |
| 12 #include "mojo/public/cpp/bindings/binding.h" | |
| 13 | |
| 14 namespace mus { | |
| 15 namespace ws { | |
| 16 | |
| 17 class WindowServer; | |
| 18 class WindowTree; | |
| 19 | |
| 20 // WindowTreeBinding manages the binding between a WindowTree and its | |
| 21 // WindowTreeClient. WindowTreeBinding exists so that a mock implementation | |
| 22 // of WindowTreeClient can be injected for tests. WindowTree owns its | |
| 23 // associated WindowTreeBinding. | |
| 24 class WindowTreeBinding { | |
| 25 public: | |
| 26 explicit WindowTreeBinding(mojom::WindowTreeClient* client); | |
| 27 virtual ~WindowTreeBinding(); | |
| 28 | |
| 29 mojom::WindowTreeClient* client() { return client_; } | |
| 30 | |
| 31 // Obtains a new WindowManager. This should only be called once. | |
| 32 virtual mojom::WindowManager* GetWindowManager() = 0; | |
| 33 | |
| 34 virtual void SetIncomingMethodCallProcessingPaused(bool paused) = 0; | |
| 35 | |
| 36 private: | |
| 37 mojom::WindowTreeClient* client_; | |
| 38 | |
| 39 DISALLOW_COPY_AND_ASSIGN(WindowTreeBinding); | |
| 40 }; | |
| 41 | |
| 42 // Bindings implementation of WindowTreeBinding. | |
| 43 class DefaultWindowTreeBinding : public WindowTreeBinding { | |
| 44 public: | |
| 45 DefaultWindowTreeBinding(WindowTree* tree, | |
| 46 WindowServer* window_server, | |
| 47 mojom::WindowTreeRequest service_request, | |
| 48 mojom::WindowTreeClientPtr client); | |
| 49 DefaultWindowTreeBinding(WindowTree* tree, | |
| 50 mojom::WindowTreeClientPtr client); | |
| 51 ~DefaultWindowTreeBinding() override; | |
| 52 | |
| 53 // Use when created with the constructor that does not take a | |
| 54 // WindowTreeRequest. | |
| 55 mojom::WindowTreePtr CreateInterfacePtrAndBind(); | |
| 56 | |
| 57 // WindowTreeBinding: | |
| 58 mojom::WindowManager* GetWindowManager() override; | |
| 59 void SetIncomingMethodCallProcessingPaused(bool paused) override; | |
| 60 | |
| 61 private: | |
| 62 mojo::Binding<mojom::WindowTree> binding_; | |
| 63 mojom::WindowTreeClientPtr client_; | |
| 64 mojom::WindowManagerAssociatedPtr window_manager_internal_; | |
| 65 | |
| 66 DISALLOW_COPY_AND_ASSIGN(DefaultWindowTreeBinding); | |
| 67 }; | |
| 68 | |
| 69 } // namespace ws | |
| 70 } // namespace mus | |
| 71 | |
| 72 #endif // COMPONENTS_MUS_WS_WINDOW_TREE_BINDING_H_ | |
| OLD | NEW |