| 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 19 matching lines...) Expand all Loading... |
| 30 service_manager::mojom::ServiceRequest request, | 30 service_manager::mojom::ServiceRequest request, |
| 31 scoped_refptr<base::SequencedTaskRunner> io_task_runner); | 31 scoped_refptr<base::SequencedTaskRunner> io_task_runner); |
| 32 ~ServiceManagerConnectionImpl() override; | 32 ~ServiceManagerConnectionImpl() override; |
| 33 | 33 |
| 34 private: | 34 private: |
| 35 class IOThreadContext; | 35 class IOThreadContext; |
| 36 | 36 |
| 37 // ServiceManagerConnection: | 37 // ServiceManagerConnection: |
| 38 void Start() override; | 38 void Start() override; |
| 39 service_manager::Connector* GetConnector() override; | 39 service_manager::Connector* GetConnector() override; |
| 40 const service_manager::Identity& GetIdentity() const override; | 40 const service_manager::ServiceInfo& GetLocalInfo() const override; |
| 41 const service_manager::ServiceInfo& GetBrowserInfo() const override; |
| 41 void SetConnectionLostClosure(const base::Closure& closure) override; | 42 void SetConnectionLostClosure(const base::Closure& closure) override; |
| 42 void SetupInterfaceRequestProxies( | 43 void SetupInterfaceRequestProxies( |
| 43 service_manager::InterfaceRegistry* registry, | 44 service_manager::InterfaceRegistry* registry, |
| 44 service_manager::InterfaceProvider* provider) override; | 45 service_manager::InterfaceProvider* provider) override; |
| 45 int AddConnectionFilter(std::unique_ptr<ConnectionFilter> filter) override; | 46 int AddConnectionFilter(std::unique_ptr<ConnectionFilter> filter) override; |
| 46 void RemoveConnectionFilter(int filter_id) override; | 47 void RemoveConnectionFilter(int filter_id) override; |
| 47 void AddEmbeddedService(const std::string& name, | 48 void AddEmbeddedService(const std::string& name, |
| 48 const ServiceInfo& info) override; | 49 const ServiceInfo& info) override; |
| 49 void AddServiceRequestHandler( | 50 void AddServiceRequestHandler( |
| 50 const std::string& name, | 51 const std::string& name, |
| 51 const ServiceRequestHandler& handler) override; | 52 const ServiceRequestHandler& handler) override; |
| 52 int AddOnConnectHandler(const OnConnectHandler& handler) override; | 53 int AddOnConnectHandler(const OnConnectHandler& handler) override; |
| 53 void RemoveOnConnectHandler(int id) override; | 54 void RemoveOnConnectHandler(int id) override; |
| 54 | 55 |
| 55 void OnContextInitialized(const service_manager::Identity& identity); | 56 void OnLocalServiceInfoAvailable( |
| 57 const service_manager::ServiceInfo& local_info); |
| 58 void OnBrowserServiceInfoAvailable( |
| 59 const service_manager::ServiceInfo& browser_info); |
| 56 void OnConnectionLost(); | 60 void OnConnectionLost(); |
| 57 void OnConnect(const service_manager::ServiceInfo& local_info, | |
| 58 const service_manager::ServiceInfo& remote_info); | |
| 59 void GetInterface(service_manager::mojom::InterfaceProvider* provider, | 61 void GetInterface(service_manager::mojom::InterfaceProvider* provider, |
| 60 const std::string& interface_name, | 62 const std::string& interface_name, |
| 61 mojo::ScopedMessagePipeHandle request_handle); | 63 mojo::ScopedMessagePipeHandle request_handle); |
| 62 | 64 |
| 63 service_manager::Identity identity_; | |
| 64 service_manager::ServiceInfo local_info_; | 65 service_manager::ServiceInfo local_info_; |
| 65 service_manager::ServiceInfo last_remote_info_; | 66 service_manager::ServiceInfo browser_info_; |
| 66 | 67 |
| 67 std::unique_ptr<service_manager::Connector> connector_; | 68 std::unique_ptr<service_manager::Connector> connector_; |
| 68 scoped_refptr<IOThreadContext> context_; | 69 scoped_refptr<IOThreadContext> context_; |
| 69 | 70 |
| 70 base::Closure connection_lost_handler_; | 71 base::Closure connection_lost_handler_; |
| 71 | 72 |
| 72 int next_on_connect_handler_id_ = 0; | 73 int next_on_connect_handler_id_ = 0; |
| 73 std::map<int, OnConnectHandler> on_connect_handlers_; | 74 std::map<int, OnConnectHandler> on_connect_handlers_; |
| 74 | 75 |
| 75 base::WeakPtrFactory<ServiceManagerConnectionImpl> weak_factory_; | 76 base::WeakPtrFactory<ServiceManagerConnectionImpl> weak_factory_; |
| 76 | 77 |
| 77 DISALLOW_COPY_AND_ASSIGN(ServiceManagerConnectionImpl); | 78 DISALLOW_COPY_AND_ASSIGN(ServiceManagerConnectionImpl); |
| 78 }; | 79 }; |
| 79 | 80 |
| 80 } // namespace content | 81 } // namespace content |
| 81 | 82 |
| 82 #endif // CONTENT_COMMON_SERVICE_MANAGER_SERVICE_MANAGER_CONNECTION_IMPL_H_ | 83 #endif // CONTENT_COMMON_SERVICE_MANAGER_SERVICE_MANAGER_CONNECTION_IMPL_H_ |
| OLD | NEW |