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 COMPONENTS_VIEW_MANAGER_PUBLIC_CPP_LIB_VIEW_MANAGER_CLIENT_IMPL_H_ | 5 #ifndef COMPONENTS_VIEW_MANAGER_PUBLIC_CPP_LIB_VIEW_TREE_CLIENT_IMPL_H_ |
6 #define COMPONENTS_VIEW_MANAGER_PUBLIC_CPP_LIB_VIEW_MANAGER_CLIENT_IMPL_H_ | 6 #define COMPONENTS_VIEW_MANAGER_PUBLIC_CPP_LIB_VIEW_TREE_CLIENT_IMPL_H_ |
7 | 7 |
8 #include "components/view_manager/public/cpp/types.h" | 8 #include "components/view_manager/public/cpp/types.h" |
9 #include "components/view_manager/public/cpp/view.h" | 9 #include "components/view_manager/public/cpp/view.h" |
10 #include "components/view_manager/public/cpp/view_manager.h" | 10 #include "components/view_manager/public/cpp/view_manager.h" |
11 #include "components/view_manager/public/interfaces/view_manager.mojom.h" | 11 #include "components/view_manager/public/interfaces/view_tree.mojom.h" |
12 #include "third_party/mojo/src/mojo/public/cpp/bindings/strong_binding.h" | 12 #include "third_party/mojo/src/mojo/public/cpp/bindings/strong_binding.h" |
13 | 13 |
14 namespace mojo { | 14 namespace mojo { |
15 class ViewManager; | 15 class ViewManager; |
16 class ViewManagerDelegate; | 16 class ViewManagerDelegate; |
17 class ViewManagerTransaction; | 17 class ViewManagerTransaction; |
18 | 18 |
19 // Manages the connection with the View Manager service. | 19 // Manages the connection with the View Manager service. |
20 class ViewManagerClientImpl : public ViewManager, | 20 class ViewTreeClientImpl : public ViewManager, public ViewTreeClient { |
21 public ViewManagerClient { | |
22 public: | 21 public: |
23 ViewManagerClientImpl(ViewManagerDelegate* delegate, | 22 ViewTreeClientImpl(ViewManagerDelegate* delegate, |
24 InterfaceRequest<ViewManagerClient> request); | 23 InterfaceRequest<ViewTreeClient> request); |
25 ~ViewManagerClientImpl() override; | 24 ~ViewTreeClientImpl() override; |
26 | 25 |
27 bool connected() const { return service_; } | 26 bool connected() const { return tree_; } |
28 ConnectionSpecificId connection_id() const { return connection_id_; } | 27 ConnectionSpecificId connection_id() const { return connection_id_; } |
29 | 28 |
30 // API exposed to the view implementations that pushes local changes to the | 29 // API exposed to the view implementations that pushes local changes to the |
31 // service. | 30 // service. |
32 void DestroyView(Id view_id); | 31 void DestroyView(Id view_id); |
33 | 32 |
34 // These methods take TransportIds. For views owned by the current connection, | 33 // These methods take TransportIds. For views owned by the current connection, |
35 // the connection id high word can be zero. In all cases, the TransportId 0x1 | 34 // the connection id high word can be zero. In all cases, the TransportId 0x1 |
36 // refers to the root view. | 35 // refers to the root view. |
37 void AddChild(Id child_id, Id parent_id); | 36 void AddChild(Id child_id, Id parent_id); |
(...skipping 12 matching lines...) Expand all Loading... |
50 const std::string& name, | 49 const std::string& name, |
51 const std::vector<uint8_t>& data); | 50 const std::vector<uint8_t>& data); |
52 void SetViewTextInputState(Id view_id, TextInputStatePtr state); | 51 void SetViewTextInputState(Id view_id, TextInputStatePtr state); |
53 void SetImeVisibility(Id view_id, bool visible, TextInputStatePtr state); | 52 void SetImeVisibility(Id view_id, bool visible, TextInputStatePtr state); |
54 | 53 |
55 void Embed(const String& url, Id view_id); | 54 void Embed(const String& url, Id view_id); |
56 void Embed(mojo::URLRequestPtr request, | 55 void Embed(mojo::URLRequestPtr request, |
57 Id view_id, | 56 Id view_id, |
58 InterfaceRequest<ServiceProvider> services, | 57 InterfaceRequest<ServiceProvider> services, |
59 ServiceProviderPtr exposed_services); | 58 ServiceProviderPtr exposed_services); |
60 void Embed(Id view_id, ViewManagerClientPtr client); | 59 void Embed(Id view_id, ViewTreeClientPtr client); |
61 void EmbedAllowingReembed(mojo::URLRequestPtr request, Id view_id); | 60 void EmbedAllowingReembed(mojo::URLRequestPtr request, Id view_id); |
62 | 61 |
63 void set_change_acked_callback(const Callback<void(void)>& callback) { | 62 void set_change_acked_callback(const Callback<void(void)>& callback) { |
64 change_acked_callback_ = callback; | 63 change_acked_callback_ = callback; |
65 } | 64 } |
66 void ClearChangeAckedCallback() { change_acked_callback_.reset(); } | 65 void ClearChangeAckedCallback() { change_acked_callback_.reset(); } |
67 | 66 |
68 // Start/stop tracking views. While tracked, they can be retrieved via | 67 // Start/stop tracking views. While tracked, they can be retrieved via |
69 // ViewManager::GetViewById. | 68 // ViewManager::GetViewById. |
70 void AddView(View* view); | 69 void AddView(View* view); |
(...skipping 11 matching lines...) Expand all Loading... |
82 | 81 |
83 Id CreateViewOnServer(); | 82 Id CreateViewOnServer(); |
84 | 83 |
85 // Overridden from ViewManager: | 84 // Overridden from ViewManager: |
86 View* GetRoot() override; | 85 View* GetRoot() override; |
87 View* GetViewById(Id id) override; | 86 View* GetViewById(Id id) override; |
88 View* GetFocusedView() override; | 87 View* GetFocusedView() override; |
89 View* CreateView() override; | 88 View* CreateView() override; |
90 void SetEmbedRoot() override; | 89 void SetEmbedRoot() override; |
91 | 90 |
92 // Overridden from ViewManagerClient: | 91 // Overridden from ViewTreeClient: |
93 void OnEmbed(ConnectionSpecificId connection_id, | 92 void OnEmbed(ConnectionSpecificId connection_id, |
94 ViewDataPtr root, | 93 ViewDataPtr root, |
95 ViewManagerServicePtr view_manager_service, | 94 ViewTreePtr tree, |
96 Id focused_view_id) override; | 95 Id focused_view_id) override; |
97 void OnEmbedForDescendant( | 96 void OnEmbedForDescendant( |
98 Id view, | 97 Id view, |
99 mojo::URLRequestPtr request, | 98 mojo::URLRequestPtr request, |
100 const OnEmbedForDescendantCallback& callback) override; | 99 const OnEmbedForDescendantCallback& callback) override; |
101 void OnEmbeddedAppDisconnected(Id view_id) override; | 100 void OnEmbeddedAppDisconnected(Id view_id) override; |
102 void OnUnembed() override; | 101 void OnUnembed() override; |
103 void OnViewBoundsChanged(Id view_id, | 102 void OnViewBoundsChanged(Id view_id, |
104 RectPtr old_bounds, | 103 RectPtr old_bounds, |
105 RectPtr new_bounds) override; | 104 RectPtr new_bounds) override; |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 ViewManagerDelegate* delegate_; | 136 ViewManagerDelegate* delegate_; |
138 | 137 |
139 View* root_; | 138 View* root_; |
140 | 139 |
141 IdToViewMap views_; | 140 IdToViewMap views_; |
142 | 141 |
143 View* capture_view_; | 142 View* capture_view_; |
144 View* focused_view_; | 143 View* focused_view_; |
145 View* activated_view_; | 144 View* activated_view_; |
146 | 145 |
147 Binding<ViewManagerClient> binding_; | 146 Binding<ViewTreeClient> binding_; |
148 ViewManagerServicePtr service_; | 147 ViewTreePtr tree_; |
149 | 148 |
150 bool is_embed_root_; | 149 bool is_embed_root_; |
151 | 150 |
152 bool in_destructor_; | 151 bool in_destructor_; |
153 | 152 |
154 MOJO_DISALLOW_COPY_AND_ASSIGN(ViewManagerClientImpl); | 153 MOJO_DISALLOW_COPY_AND_ASSIGN(ViewTreeClientImpl); |
155 }; | 154 }; |
156 | 155 |
157 } // namespace mojo | 156 } // namespace mojo |
158 | 157 |
159 #endif // COMPONENTS_VIEW_MANAGER_PUBLIC_CPP_LIB_VIEW_MANAGER_CLIENT_IMPL_H_ | 158 #endif // COMPONENTS_VIEW_MANAGER_PUBLIC_CPP_LIB_VIEW_TREE_CLIENT_IMPL_H_ |
OLD | NEW |