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 CONTENT_CHILD_SERVICE_FACTORY_H_ | 5 #ifndef CONTENT_CHILD_SERVICE_FACTORY_H_ |
6 #define CONTENT_CHILD_SERVICE_FACTORY_H_ | 6 #define CONTENT_CHILD_SERVICE_FACTORY_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <memory> | 9 #include <memory> |
10 | 10 |
11 #include "base/macros.h" | 11 #include "base/macros.h" |
12 #include "content/public/common/mojo_application_info.h" | 12 #include "content/public/common/service_info.h" |
13 #include "services/shell/public/interfaces/service.mojom.h" | 13 #include "services/shell/public/interfaces/service.mojom.h" |
14 #include "services/shell/public/interfaces/service_factory.mojom.h" | 14 #include "services/shell/public/interfaces/service_factory.mojom.h" |
15 | 15 |
16 namespace content { | 16 namespace content { |
17 | 17 |
18 class EmbeddedApplicationRunner; | 18 class EmbeddedServiceRunner; |
19 | 19 |
20 // Base class for child-process specific implementations of | 20 // Base class for child-process specific implementations of |
21 // shell::mojom::ServiceFactory. | 21 // shell::mojom::ServiceFactory. |
22 class ServiceFactory : public shell::mojom::ServiceFactory { | 22 class ServiceFactory : public shell::mojom::ServiceFactory { |
23 public: | 23 public: |
24 using ServiceMap = std::map<std::string, MojoApplicationInfo>; | 24 using ServiceMap = std::map<std::string, ServiceInfo>; |
25 | 25 |
26 ServiceFactory(); | 26 ServiceFactory(); |
27 ~ServiceFactory() override; | 27 ~ServiceFactory() override; |
28 | 28 |
29 virtual void RegisterServices(ServiceMap* services) = 0; | 29 virtual void RegisterServices(ServiceMap* services) = 0; |
30 virtual void OnServiceQuit() {} | 30 virtual void OnServiceQuit() {} |
31 | 31 |
32 // shell::mojom::ServiceFactory: | 32 // shell::mojom::ServiceFactory: |
33 void CreateService(shell::mojom::ServiceRequest request, | 33 void CreateService(shell::mojom::ServiceRequest request, |
34 const std::string& name) override; | 34 const std::string& name) override; |
35 | 35 |
36 private: | 36 private: |
37 // Called if CreateService fails to find a registered service. | 37 // Called if CreateService fails to find a registered service. |
38 virtual void OnLoadFailed() {} | 38 virtual void OnLoadFailed() {} |
39 | 39 |
40 bool has_registered_services_ = false; | 40 bool has_registered_services_ = false; |
41 std::unordered_map<std::string, std::unique_ptr<EmbeddedApplicationRunner>> | 41 std::unordered_map<std::string, std::unique_ptr<EmbeddedServiceRunner>> |
42 services_; | 42 services_; |
43 | 43 |
44 DISALLOW_COPY_AND_ASSIGN(ServiceFactory); | 44 DISALLOW_COPY_AND_ASSIGN(ServiceFactory); |
45 }; | 45 }; |
46 | 46 |
47 } // namespace content | 47 } // namespace content |
48 | 48 |
49 #endif // CONTENT_CHILD_SERVICE_FACTORY_H_ | 49 #endif // CONTENT_CHILD_SERVICE_FACTORY_H_ |
OLD | NEW |