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_REGISTRY_H_ | 5 #ifndef SERVICES_UI_VIEW_MANAGER_VIEW_REGISTRY_H_ |
6 #define SERVICES_UI_VIEW_MANAGER_VIEW_REGISTRY_H_ | 6 #define SERVICES_UI_VIEW_MANAGER_VIEW_REGISTRY_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <unordered_map> | 9 #include <unordered_map> |
10 | 10 |
(...skipping 13 matching lines...) Expand all Loading... |
24 // Maintains a registry of the state of all views. | 24 // Maintains a registry of the state of all views. |
25 // All ViewState objects are owned by the registry. | 25 // All ViewState objects are owned by the registry. |
26 class ViewRegistry : public mojo::ui::ViewInspector { | 26 class ViewRegistry : public mojo::ui::ViewInspector { |
27 public: | 27 public: |
28 using AssociateConnectionErrorCallback = | 28 using AssociateConnectionErrorCallback = |
29 ViewAssociateTable::AssociateConnectionErrorCallback; | 29 ViewAssociateTable::AssociateConnectionErrorCallback; |
30 | 30 |
31 explicit ViewRegistry(mojo::gfx::composition::CompositorPtr compositor); | 31 explicit ViewRegistry(mojo::gfx::composition::CompositorPtr compositor); |
32 ~ViewRegistry() override; | 32 ~ViewRegistry() override; |
33 | 33 |
34 // Begins connecting to the view associates. | |
35 // Invokes |connection_error_callback| if an associate connection fails | |
36 // and provides the associate's url. | |
37 void ConnectAssociates( | |
38 mojo::ApplicationImpl* app_impl, | |
39 const std::vector<std::string>& urls, | |
40 const AssociateConnectionErrorCallback& connection_error_callback); | |
41 | |
42 // VIEW MANAGER REQUESTS | 34 // VIEW MANAGER REQUESTS |
43 | 35 |
44 // Creates a view and returns its ViewToken. | 36 // Creates a view and returns its ViewToken. |
45 void CreateView( | 37 void CreateView( |
46 mojo::InterfaceRequest<mojo::ui::View> view_request, | 38 mojo::InterfaceRequest<mojo::ui::View> view_request, |
47 mojo::InterfaceRequest<mojo::ui::ViewOwner> view_owner_request, | 39 mojo::InterfaceRequest<mojo::ui::ViewOwner> view_owner_request, |
48 mojo::ui::ViewListenerPtr view_listener, | 40 mojo::ui::ViewListenerPtr view_listener, |
49 const mojo::String& label); | 41 const mojo::String& label); |
50 | 42 |
51 // Creates a view tree. | 43 // Creates a view tree. |
52 void CreateViewTree( | 44 void CreateViewTree( |
53 mojo::InterfaceRequest<mojo::ui::ViewTree> view_tree_request, | 45 mojo::InterfaceRequest<mojo::ui::ViewTree> view_tree_request, |
54 mojo::ui::ViewTreeListenerPtr view_tree_listener, | 46 mojo::ui::ViewTreeListenerPtr view_tree_listener, |
55 const mojo::String& label); | 47 const mojo::String& label); |
56 | 48 |
| 49 void RegisterViewAssociate( |
| 50 mojo::ui::ViewInspector* view_inspector, |
| 51 mojo::ui::ViewAssociatePtr view_associate, |
| 52 mojo::InterfaceRequest<mojo::ui::ViewAssociateOwner> view_associate_owner, |
| 53 const mojo::String& label); |
| 54 |
| 55 void FinishedRegisteringViewAssociates(); |
| 56 |
57 // VIEW STUB REQUESTS | 57 // VIEW STUB REQUESTS |
58 | 58 |
59 void OnViewResolved(ViewStub* view_stub, mojo::ui::ViewTokenPtr view_token); | 59 void OnViewResolved(ViewStub* view_stub, mojo::ui::ViewTokenPtr view_token); |
60 | 60 |
61 // VIEW REQUESTS | 61 // VIEW REQUESTS |
62 | 62 |
63 // Creates a scene for the view, replacing its current scene. | 63 // Creates a scene for the view, replacing its current scene. |
64 // Destroys |view_state| if an error occurs. | 64 // Destroys |view_state| if an error occurs. |
65 void CreateScene(ViewState* view_state, | 65 void CreateScene(ViewState* view_state, |
66 mojo::InterfaceRequest<mojo::gfx::composition::Scene> scene); | 66 mojo::InterfaceRequest<mojo::gfx::composition::Scene> scene); |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 std::unordered_map<uint32_t, ViewState*> views_by_token_; | 206 std::unordered_map<uint32_t, ViewState*> views_by_token_; |
207 std::unordered_map<uint32_t, ViewState*> views_by_scene_token_; | 207 std::unordered_map<uint32_t, ViewState*> views_by_scene_token_; |
208 std::unordered_map<uint32_t, ViewTreeState*> view_trees_by_token_; | 208 std::unordered_map<uint32_t, ViewTreeState*> view_trees_by_token_; |
209 | 209 |
210 DISALLOW_COPY_AND_ASSIGN(ViewRegistry); | 210 DISALLOW_COPY_AND_ASSIGN(ViewRegistry); |
211 }; | 211 }; |
212 | 212 |
213 } // namespace view_manager | 213 } // namespace view_manager |
214 | 214 |
215 #endif // SERVICES_UI_VIEW_MANAGER_VIEW_REGISTRY_H_ | 215 #endif // SERVICES_UI_VIEW_MANAGER_VIEW_REGISTRY_H_ |
OLD | NEW |