OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 CONTENT_COMMON_SERVICE_MANAGER_SERVICE_MANAGER_CONNECTION_IMPL_H_ | 5 #ifndef CONTENT_COMMON_SERVICE_MANAGER_SERVICE_MANAGER_CONNECTION_IMPL_H_ |
6 #define CONTENT_COMMON_SERVICE_MANAGER_SERVICE_MANAGER_CONNECTION_IMPL_H_ | 6 #define CONTENT_COMMON_SERVICE_MANAGER_SERVICE_MANAGER_CONNECTION_IMPL_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 void SetupInterfaceRequestProxies( | 44 void SetupInterfaceRequestProxies( |
45 service_manager::InterfaceRegistry* registry, | 45 service_manager::InterfaceRegistry* registry, |
46 service_manager::InterfaceProvider* provider) override; | 46 service_manager::InterfaceProvider* provider) override; |
47 int AddConnectionFilter(std::unique_ptr<ConnectionFilter> filter) override; | 47 int AddConnectionFilter(std::unique_ptr<ConnectionFilter> filter) override; |
48 void RemoveConnectionFilter(int filter_id) override; | 48 void RemoveConnectionFilter(int filter_id) override; |
49 void AddEmbeddedService(const std::string& name, | 49 void AddEmbeddedService(const std::string& name, |
50 const ServiceInfo& info) override; | 50 const ServiceInfo& info) override; |
51 void AddServiceRequestHandler( | 51 void AddServiceRequestHandler( |
52 const std::string& name, | 52 const std::string& name, |
53 const ServiceRequestHandler& handler) override; | 53 const ServiceRequestHandler& handler) override; |
| 54 int AddOnConnectHandler(const OnConnectHandler& handler) override; |
| 55 void RemoveOnConnectHandler(int id) override; |
54 | 56 |
55 void OnContextInitialized(const service_manager::Identity& identity); | 57 void OnContextInitialized(const service_manager::Identity& identity); |
56 void OnConnectionLost(); | 58 void OnConnectionLost(); |
| 59 void OnConnect(const service_manager::ServiceInfo& local_info, |
| 60 const service_manager::ServiceInfo& remote_info); |
57 void CreateService(service_manager::mojom::ServiceRequest request, | 61 void CreateService(service_manager::mojom::ServiceRequest request, |
58 const std::string& name); | 62 const std::string& name); |
59 void GetInterface(service_manager::mojom::InterfaceProvider* provider, | 63 void GetInterface(service_manager::mojom::InterfaceProvider* provider, |
60 const std::string& interface_name, | 64 const std::string& interface_name, |
61 mojo::ScopedMessagePipeHandle request_handle); | 65 mojo::ScopedMessagePipeHandle request_handle); |
62 | 66 |
63 service_manager::Identity identity_; | 67 service_manager::Identity identity_; |
| 68 service_manager::ServiceInfo local_info_; |
| 69 service_manager::ServiceInfo last_remote_info_; |
64 | 70 |
65 std::unique_ptr<service_manager::Connector> connector_; | 71 std::unique_ptr<service_manager::Connector> connector_; |
66 scoped_refptr<IOThreadContext> context_; | 72 scoped_refptr<IOThreadContext> context_; |
67 | 73 |
68 base::Closure initialize_handler_; | 74 base::Closure initialize_handler_; |
69 base::Closure connection_lost_handler_; | 75 base::Closure connection_lost_handler_; |
70 | 76 |
71 std::unordered_map<std::string, std::unique_ptr<EmbeddedServiceRunner>> | 77 std::unordered_map<std::string, std::unique_ptr<EmbeddedServiceRunner>> |
72 embedded_services_; | 78 embedded_services_; |
73 std::unordered_map<std::string, ServiceRequestHandler> request_handlers_; | 79 std::unordered_map<std::string, ServiceRequestHandler> request_handlers_; |
| 80 int next_on_connect_handler_id_ = 0; |
| 81 std::map<int, OnConnectHandler> on_connect_handlers_; |
74 | 82 |
75 base::WeakPtrFactory<ServiceManagerConnectionImpl> weak_factory_; | 83 base::WeakPtrFactory<ServiceManagerConnectionImpl> weak_factory_; |
76 | 84 |
77 DISALLOW_COPY_AND_ASSIGN(ServiceManagerConnectionImpl); | 85 DISALLOW_COPY_AND_ASSIGN(ServiceManagerConnectionImpl); |
78 }; | 86 }; |
79 | 87 |
80 } // namespace content | 88 } // namespace content |
81 | 89 |
82 #endif // CONTENT_COMMON_SERVICE_MANAGER_SERVICE_MANAGER_CONNECTION_IMPL_H_ | 90 #endif // CONTENT_COMMON_SERVICE_MANAGER_SERVICE_MANAGER_CONNECTION_IMPL_H_ |
OLD | NEW |