| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_VIEW_MANAGER_VIEW_TREE_HOST_IMPL_H_ | 5 #ifndef SERVICES_UI_VIEW_MANAGER_VIEW_TREE_HOST_IMPL_H_ |
| 6 #define SERVICES_UI_VIEW_MANAGER_VIEW_TREE_HOST_IMPL_H_ | 6 #define SERVICES_UI_VIEW_MANAGER_VIEW_TREE_HOST_IMPL_H_ |
| 7 | 7 |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "mojo/common/binding_set.h" | 9 #include "mojo/common/binding_set.h" |
| 10 #include "mojo/public/cpp/bindings/binding.h" | |
| 11 #include "mojo/services/ui/views/interfaces/view_trees.mojom.h" | 10 #include "mojo/services/ui/views/interfaces/view_trees.mojom.h" |
| 12 #include "services/ui/view_manager/view_registry.h" | |
| 13 #include "services/ui/view_manager/view_tree_state.h" | |
| 14 | 11 |
| 15 namespace view_manager { | 12 namespace view_manager { |
| 16 | 13 |
| 14 class ViewRegistry; |
| 15 class ViewTreeState; |
| 16 |
| 17 // ViewTreeHost interface implementation. | 17 // ViewTreeHost interface implementation. |
| 18 // This object is owned by its associated ViewTreeState. | 18 // This object is owned by its associated ViewTreeState. |
| 19 class ViewTreeHostImpl : public mojo::ui::ViewTreeHost, | 19 class ViewTreeHostImpl : public mojo::ui::ViewTreeHost, |
| 20 public mojo::ServiceProvider { | 20 public mojo::ServiceProvider { |
| 21 public: | 21 public: |
| 22 ViewTreeHostImpl( | 22 ViewTreeHostImpl(ViewRegistry* registry, ViewTreeState* state); |
| 23 ViewRegistry* registry, | |
| 24 ViewTreeState* state, | |
| 25 mojo::InterfaceRequest<mojo::ui::ViewTreeHost> view_tree_host_request); | |
| 26 ~ViewTreeHostImpl() override; | 23 ~ViewTreeHostImpl() override; |
| 27 | 24 |
| 28 void set_view_tree_host_connection_error_handler( | |
| 29 const base::Closure& handler) { | |
| 30 binding_.set_connection_error_handler(handler); | |
| 31 } | |
| 32 | |
| 33 private: | 25 private: |
| 34 // |ViewTreeHost|: | 26 // |ViewTreeHost|: |
| 27 void GetToken(const GetTokenCallback& callback) override; |
| 35 void GetServiceProvider( | 28 void GetServiceProvider( |
| 36 mojo::InterfaceRequest<mojo::ServiceProvider> service_provider) override; | 29 mojo::InterfaceRequest<mojo::ServiceProvider> service_provider) override; |
| 37 void RequestLayout() override; | 30 void RequestLayout() override; |
| 38 void SetRoot(uint32_t root_key, | 31 void SetRoot(uint32_t root_key, |
| 39 mojo::ui::ViewTokenPtr root_view_token) override; | 32 mojo::ui::ViewOwnerPtr root_view_owner) override; |
| 40 void ResetRoot() override; | 33 void ResetRoot(mojo::InterfaceRequest<mojo::ui::ViewOwner> |
| 34 transferred_view_owner_request) override; |
| 41 void LayoutRoot(mojo::ui::ViewLayoutParamsPtr root_layout_params, | 35 void LayoutRoot(mojo::ui::ViewLayoutParamsPtr root_layout_params, |
| 42 const LayoutRootCallback& callback) override; | 36 const LayoutRootCallback& callback) override; |
| 43 | 37 |
| 44 // |ServiceProvider|: | 38 // |ServiceProvider|: |
| 45 void ConnectToService(const mojo::String& service_name, | 39 void ConnectToService(const mojo::String& service_name, |
| 46 mojo::ScopedMessagePipeHandle client_handle) override; | 40 mojo::ScopedMessagePipeHandle client_handle) override; |
| 47 | 41 |
| 48 ViewRegistry* const registry_; | 42 ViewRegistry* const registry_; |
| 49 ViewTreeState* const state_; | 43 ViewTreeState* const state_; |
| 50 mojo::Binding<mojo::ui::ViewTreeHost> binding_; | |
| 51 mojo::BindingSet<mojo::ServiceProvider> service_provider_bindings_; | 44 mojo::BindingSet<mojo::ServiceProvider> service_provider_bindings_; |
| 52 | 45 |
| 53 DISALLOW_COPY_AND_ASSIGN(ViewTreeHostImpl); | 46 DISALLOW_COPY_AND_ASSIGN(ViewTreeHostImpl); |
| 54 }; | 47 }; |
| 55 | 48 |
| 56 } // namespace view_manager | 49 } // namespace view_manager |
| 57 | 50 |
| 58 #endif // SERVICES_UI_VIEW_MANAGER_VIEW_TREE_HOST_IMPL_H_ | 51 #endif // SERVICES_UI_VIEW_MANAGER_VIEW_TREE_HOST_IMPL_H_ |
| OLD | NEW |