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 SERVICES_SERVICE_MANAGER_PUBLIC_CPP_SERVICE_CONTEXT_H_ | 5 #ifndef SERVICES_SERVICE_MANAGER_PUBLIC_CPP_SERVICE_CONTEXT_H_ |
6 #define SERVICES_SERVICE_MANAGER_PUBLIC_CPP_SERVICE_CONTEXT_H_ | 6 #define SERVICES_SERVICE_MANAGER_PUBLIC_CPP_SERVICE_CONTEXT_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <utility> | 9 #include <utility> |
10 #include <vector> | 10 #include <vector> |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 ServiceContext(service_manager::Service* service, | 51 ServiceContext(service_manager::Service* service, |
52 mojom::ServiceRequest request, | 52 mojom::ServiceRequest request, |
53 std::unique_ptr<Connector> connector = nullptr, | 53 std::unique_ptr<Connector> connector = nullptr, |
54 mojom::ConnectorRequest connector_request = nullptr); | 54 mojom::ConnectorRequest connector_request = nullptr); |
55 | 55 |
56 ~ServiceContext() override; | 56 ~ServiceContext() override; |
57 | 57 |
58 Connector* connector() { return connector_.get(); } | 58 Connector* connector() { return connector_.get(); } |
59 const Identity& identity() { return identity_; } | 59 const Identity& identity() { return identity_; } |
60 | 60 |
61 // Specify a function to be called when the connection to the shell is lost. | 61 // Specify a function to be called when the connection to the service manager |
| 62 // is lost. |
62 // Note that if connection has already been lost, then |closure| is called | 63 // Note that if connection has already been lost, then |closure| is called |
63 // immediately. | 64 // immediately. |
64 void SetConnectionLostClosure(const base::Closure& closure); | 65 void SetConnectionLostClosure(const base::Closure& closure); |
65 | 66 |
66 private: | 67 private: |
67 // mojom::Service: | 68 // mojom::Service: |
68 void OnStart(const Identity& identity, | 69 void OnStart(const Identity& identity, |
69 const OnStartCallback& callback) override; | 70 const OnStartCallback& callback) override; |
70 void OnConnect(const Identity& source, | 71 void OnConnect(const Identity& source, |
71 mojom::InterfaceProviderRequest interfaces, | 72 mojom::InterfaceProviderRequest interfaces, |
(...skipping 20 matching lines...) Expand all Loading... |
92 bool should_run_connection_lost_closure_ = false; | 93 bool should_run_connection_lost_closure_ = false; |
93 | 94 |
94 base::Closure connection_lost_closure_; | 95 base::Closure connection_lost_closure_; |
95 | 96 |
96 DISALLOW_COPY_AND_ASSIGN(ServiceContext); | 97 DISALLOW_COPY_AND_ASSIGN(ServiceContext); |
97 }; | 98 }; |
98 | 99 |
99 } // namespace service_manager | 100 } // namespace service_manager |
100 | 101 |
101 #endif // SERVICES_SERVICE_MANAGER_PUBLIC_CPP_SERVICE_CONTEXT_H_ | 102 #endif // SERVICES_SERVICE_MANAGER_PUBLIC_CPP_SERVICE_CONTEXT_H_ |
OLD | NEW |