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_SHELL_SERVICE_MANAGER_H_ | 5 #ifndef SERVICES_SHELL_SERVICE_MANAGER_H_ |
6 #define SERVICES_SHELL_SERVICE_MANAGER_H_ | 6 #define SERVICES_SHELL_SERVICE_MANAGER_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <memory> | 9 #include <memory> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/macros.h" | 12 #include "base/macros.h" |
13 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
14 #include "mojo/public/cpp/bindings/binding_set.h" | 14 #include "mojo/public/cpp/bindings/binding_set.h" |
15 #include "mojo/public/cpp/bindings/interface_ptr_set.h" | 15 #include "mojo/public/cpp/bindings/interface_ptr_set.h" |
16 #include "services/shell/connect_params.h" | 16 #include "services/shell/connect_params.h" |
17 #include "services/shell/native_runner.h" | 17 #include "services/shell/native_runner.h" |
18 #include "services/shell/public/cpp/capabilities.h" | 18 #include "services/shell/public/cpp/capabilities.h" |
19 #include "services/shell/public/cpp/identity.h" | 19 #include "services/shell/public/cpp/identity.h" |
20 #include "services/shell/public/cpp/interface_factory.h" | 20 #include "services/shell/public/cpp/interface_factory.h" |
21 #include "services/shell/public/cpp/service.h" | 21 #include "services/shell/public/cpp/service.h" |
22 #include "services/shell/public/interfaces/connector.mojom.h" | 22 #include "services/shell/public/interfaces/connector.mojom.h" |
23 #include "services/shell/public/interfaces/interface_provider.mojom.h" | 23 #include "services/shell/public/interfaces/interface_provider.mojom.h" |
24 #include "services/shell/public/interfaces/resolver.mojom.h" | 24 #include "services/shell/public/interfaces/resolver.mojom.h" |
25 #include "services/shell/public/interfaces/service.mojom.h" | 25 #include "services/shell/public/interfaces/service.mojom.h" |
26 #include "services/shell/public/interfaces/service_factory.mojom.h" | 26 #include "services/shell/public/interfaces/service_factory.mojom.h" |
27 #include "services/shell/public/interfaces/service_manager.mojom.h" | 27 #include "services/shell/public/interfaces/service_manager.mojom.h" |
28 | 28 |
29 namespace shell { | 29 namespace shell { |
30 class ShellConnection; | 30 class ServiceContext; |
31 | 31 |
32 // Creates an identity for the Service Manager, used when the Service Manager | 32 // Creates an identity for the Service Manager, used when the Service Manager |
33 // connects to services. | 33 // connects to services. |
34 Identity CreateServiceManagerIdentity(); | 34 Identity CreateServiceManagerIdentity(); |
35 | 35 |
36 class ServiceManager : public Service { | 36 class ServiceManager : public Service { |
37 public: | 37 public: |
38 // API for testing. | 38 // API for testing. |
39 class TestAPI { | 39 class TestAPI { |
40 public: | 40 public: |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 | 147 |
148 // Tracks the names of instances that are allowed to field connection requests | 148 // Tracks the names of instances that are allowed to field connection requests |
149 // from all users. | 149 // from all users. |
150 std::set<std::string> singletons_; | 150 std::set<std::string> singletons_; |
151 | 151 |
152 std::map<Identity, mojom::ServiceFactoryPtr> service_factories_; | 152 std::map<Identity, mojom::ServiceFactoryPtr> service_factories_; |
153 std::map<Identity, mojom::ResolverPtr> identity_to_resolver_; | 153 std::map<Identity, mojom::ResolverPtr> identity_to_resolver_; |
154 mojo::InterfacePtrSet<mojom::ServiceManagerListener> listeners_; | 154 mojo::InterfacePtrSet<mojom::ServiceManagerListener> listeners_; |
155 base::Callback<void(const Identity&)> instance_quit_callback_; | 155 base::Callback<void(const Identity&)> instance_quit_callback_; |
156 std::unique_ptr<NativeRunnerFactory> native_runner_factory_; | 156 std::unique_ptr<NativeRunnerFactory> native_runner_factory_; |
157 std::unique_ptr<ShellConnection> shell_connection_; | 157 std::unique_ptr<ServiceContext> service_context_; |
158 base::WeakPtrFactory<ServiceManager> weak_ptr_factory_; | 158 base::WeakPtrFactory<ServiceManager> weak_ptr_factory_; |
159 | 159 |
160 DISALLOW_COPY_AND_ASSIGN(ServiceManager); | 160 DISALLOW_COPY_AND_ASSIGN(ServiceManager); |
161 }; | 161 }; |
162 | 162 |
163 mojom::Connector::ConnectCallback EmptyConnectCallback(); | 163 mojom::Connector::ConnectCallback EmptyConnectCallback(); |
164 | 164 |
165 } // namespace shell | 165 } // namespace shell |
166 | 166 |
167 #endif // SERVICES_SHELL_SERVICE_MANAGER_H_ | 167 #endif // SERVICES_SHELL_SERVICE_MANAGER_H_ |
OLD | NEW |