| 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_ASSOCIATE_TABLE_H_ | 5 #ifndef SERVICES_UI_VIEW_MANAGER_VIEW_ASSOCIATE_TABLE_H_ |
| 6 #define SERVICES_UI_VIEW_MANAGER_VIEW_ASSOCIATE_TABLE_H_ | 6 #define SERVICES_UI_VIEW_MANAGER_VIEW_ASSOCIATE_TABLE_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 | 28 |
| 29 // Begins connecting to the view associates. | 29 // Begins connecting to the view associates. |
| 30 // Invokes |connection_error_callback| if an associate connection fails | 30 // Invokes |connection_error_callback| if an associate connection fails |
| 31 // and provides the associate's url. | 31 // and provides the associate's url. |
| 32 void ConnectAssociates( | 32 void ConnectAssociates( |
| 33 mojo::ApplicationImpl* app_impl, | 33 mojo::ApplicationImpl* app_impl, |
| 34 mojo::ui::ViewInspector* inspector, | 34 mojo::ui::ViewInspector* inspector, |
| 35 const std::vector<std::string>& urls, | 35 const std::vector<std::string>& urls, |
| 36 const AssociateConnectionErrorCallback& connection_error_callback); | 36 const AssociateConnectionErrorCallback& connection_error_callback); |
| 37 | 37 |
| 38 void RegisterViewAssociate(mojo::ui::ViewInspector* inspector, |
| 39 mojo::ui::ViewAssociatePtr associate); |
| 40 |
| 38 // Connects to services offered by the view associates. | 41 // Connects to services offered by the view associates. |
| 39 void ConnectToViewService(mojo::ui::ViewTokenPtr view_token, | 42 void ConnectToViewService(mojo::ui::ViewTokenPtr view_token, |
| 40 const mojo::String& service_name, | 43 const mojo::String& service_name, |
| 41 mojo::ScopedMessagePipeHandle client_handle); | 44 mojo::ScopedMessagePipeHandle client_handle); |
| 42 void ConnectToViewTreeService(mojo::ui::ViewTreeTokenPtr view_tree_token, | 45 void ConnectToViewTreeService(mojo::ui::ViewTreeTokenPtr view_tree_token, |
| 43 const mojo::String& service_name, | 46 const mojo::String& service_name, |
| 44 mojo::ScopedMessagePipeHandle client_handle); | 47 mojo::ScopedMessagePipeHandle client_handle); |
| 45 | 48 |
| 46 void OnConnected(uint32_t index, mojo::ui::ViewAssociateInfoPtr info); | 49 void OnConnected(uint32_t index, mojo::ui::ViewAssociateInfoPtr info); |
| 47 | 50 |
| 48 void CompleteDeferredWork(); | 51 void CompleteDeferredWork(); |
| 49 | 52 |
| 50 private: | 53 private: |
| 51 struct AssociateData { | 54 struct AssociateData { |
| 52 AssociateData(const std::string& url, mojo::ui::ViewInspector* inspector); | 55 AssociateData(mojo::ui::ViewAssociatePtr associate, |
| 56 mojo::ui::ViewInspector* inspector); |
| 53 ~AssociateData(); | 57 ~AssociateData(); |
| 54 | 58 |
| 55 const std::string url; | |
| 56 mojo::ui::ViewAssociatePtr associate; | 59 mojo::ui::ViewAssociatePtr associate; |
| 57 mojo::ui::ViewAssociateInfoPtr info; | 60 mojo::ui::ViewAssociateInfoPtr info; |
| 58 mojo::Binding<mojo::ui::ViewInspector> inspector_binding; | 61 mojo::Binding<mojo::ui::ViewInspector> inspector_binding; |
| 59 }; | 62 }; |
| 60 | 63 |
| 64 void ConnectAssociate(mojo::ApplicationImpl* app_impl, |
| 65 mojo::ui::ViewInspector* inspector, |
| 66 const std::string& url); |
| 67 |
| 68 void OnAssociateConnectionError(AssociateData* associate_data); |
| 69 |
| 61 std::vector<std::unique_ptr<AssociateData>> associates_; | 70 std::vector<std::unique_ptr<AssociateData>> associates_; |
| 62 | 71 |
| 63 uint32_t pending_connection_count_ = 0u; | 72 uint32_t pending_connection_count_ = 0u; |
| 64 std::vector<base::Closure> deferred_work_; | 73 std::vector<base::Closure> deferred_work_; |
| 65 | 74 |
| 66 DISALLOW_COPY_AND_ASSIGN(ViewAssociateTable); | 75 DISALLOW_COPY_AND_ASSIGN(ViewAssociateTable); |
| 67 }; | 76 }; |
| 68 | 77 |
| 69 } // namespace view_manager | 78 } // namespace view_manager |
| 70 | 79 |
| 71 #endif // SERVICES_UI_VIEW_MANAGER_VIEW_ASSOCIATE_TABLE_H_ | 80 #endif // SERVICES_UI_VIEW_MANAGER_VIEW_ASSOCIATE_TABLE_H_ |
| OLD | NEW |