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_HOST_IMPL_H_ | 5 #ifndef SERVICES_UI_VIEW_MANAGER_VIEW_HOST_IMPL_H_ |
6 #define SERVICES_UI_VIEW_MANAGER_VIEW_HOST_IMPL_H_ | 6 #define SERVICES_UI_VIEW_MANAGER_VIEW_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/views.mojom.h" | 11 #include "mojo/services/ui/views/interfaces/views.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_state.h" | 13 #include "services/ui/view_manager/view_state.h" |
13 | 14 |
14 namespace view_manager { | 15 namespace view_manager { |
15 | 16 |
16 // ViewHost interface implementation. | 17 // ViewHost interface implementation. |
17 // This object is owned by its associated ViewState. | 18 // This object is owned by its associated ViewState. |
18 class ViewHostImpl : public mojo::ui::ViewHost { | 19 class ViewHostImpl : public mojo::ui::ViewHost, public mojo::ServiceProvider { |
19 public: | 20 public: |
20 ViewHostImpl(ViewRegistry* registry, | 21 ViewHostImpl(ViewRegistry* registry, |
21 ViewState* state, | 22 ViewState* state, |
22 mojo::InterfaceRequest<mojo::ui::ViewHost> view_host_request); | 23 mojo::InterfaceRequest<mojo::ui::ViewHost> view_host_request); |
23 ~ViewHostImpl() override; | 24 ~ViewHostImpl() override; |
24 | 25 |
25 void set_view_host_connection_error_handler(const base::Closure& handler) { | 26 void set_view_host_connection_error_handler(const base::Closure& handler) { |
26 binding_.set_connection_error_handler(handler); | 27 binding_.set_connection_error_handler(handler); |
27 } | 28 } |
28 | 29 |
29 private: | 30 private: |
30 // |ViewHost|: | 31 // |ViewHost|: |
31 void GetServiceProvider( | 32 void GetServiceProvider(mojo::InterfaceRequest<mojo::ServiceProvider> |
32 mojo::InterfaceRequest<mojo::ServiceProvider> service_provider) override; | 33 service_provider_request) override; |
| 34 void CreateScene( |
| 35 mojo::InterfaceRequest<mojo::gfx::composition::Scene> scene) override; |
33 void RequestLayout() override; | 36 void RequestLayout() override; |
34 void AddChild(uint32_t child_key, | 37 void AddChild(uint32_t child_key, |
35 mojo::ui::ViewTokenPtr child_view_token) override; | 38 mojo::ui::ViewTokenPtr child_view_token) override; |
36 void RemoveChild(uint32_t child_key) override; | 39 void RemoveChild(uint32_t child_key) override; |
37 void LayoutChild(uint32_t child_key, | 40 void LayoutChild(uint32_t child_key, |
38 mojo::ui::ViewLayoutParamsPtr child_layout_params, | 41 mojo::ui::ViewLayoutParamsPtr child_layout_params, |
39 const LayoutChildCallback& callback) override; | 42 const LayoutChildCallback& callback) override; |
40 | 43 |
| 44 // |ServiceProvider|: |
| 45 void ConnectToService(const mojo::String& service_name, |
| 46 mojo::ScopedMessagePipeHandle client_handle) override; |
| 47 |
41 ViewRegistry* const registry_; | 48 ViewRegistry* const registry_; |
42 ViewState* const state_; | 49 ViewState* const state_; |
43 mojo::Binding<mojo::ui::ViewHost> binding_; | 50 mojo::Binding<mojo::ui::ViewHost> binding_; |
| 51 mojo::BindingSet<mojo::ServiceProvider> service_provider_bindings_; |
44 | 52 |
45 DISALLOW_COPY_AND_ASSIGN(ViewHostImpl); | 53 DISALLOW_COPY_AND_ASSIGN(ViewHostImpl); |
46 }; | 54 }; |
47 | 55 |
48 } // namespace view_manager | 56 } // namespace view_manager |
49 | 57 |
50 #endif // SERVICES_UI_VIEW_MANAGER_VIEW_HOST_IMPL_H_ | 58 #endif // SERVICES_UI_VIEW_MANAGER_VIEW_HOST_IMPL_H_ |
OLD | NEW |