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