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 CONTENT_BROWSER_MOJO_MOJO_APPLICATION_HOST_H_ | 5 #ifndef CONTENT_BROWSER_MOJO_MOJO_APPLICATION_HOST_H_ |
6 #define CONTENT_BROWSER_MOJO_MOJO_APPLICATION_HOST_H_ | 6 #define CONTENT_BROWSER_MOJO_MOJO_APPLICATION_HOST_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/macros.h" | 11 #include "base/macros.h" |
12 #include "build/build_config.h" | 12 #include "build/build_config.h" |
13 #include "content/common/application_setup.mojom.h" | 13 #include "content/common/application_setup.mojom.h" |
14 #include "content/common/mojo/service_registry_impl.h" | 14 #include "content/common/content_export.h" |
| 15 #include "services/shell/public/cpp/interface_provider.h" |
| 16 #include "services/shell/public/cpp/interface_registry.h" |
15 | 17 |
16 #if defined(OS_ANDROID) | 18 #if defined(OS_ANDROID) |
17 #include "content/public/browser/android/service_registry_android.h" | 19 #include "content/public/browser/android/service_registry_android.h" |
18 #endif | 20 #endif |
19 | 21 |
20 namespace IPC { | 22 namespace IPC { |
21 class Sender; | 23 class Sender; |
22 } | 24 } |
23 | 25 |
24 namespace content { | 26 namespace content { |
25 | 27 |
26 // MojoApplicationHost represents the code needed on the browser side to setup | 28 // MojoApplicationHost represents the code needed on the browser side to setup |
27 // a child process as a Mojo application. The child process should use the token | 29 // a child process as a Mojo application. The child process should use the token |
28 // from GetToken() to initialize its MojoApplication. MojoApplicationHost makes | 30 // from GetToken() to initialize its MojoApplication. MojoApplicationHost makes |
29 // the ServiceRegistry interface available so that child-provided services can | 31 // the InterfaceRegistry interface available so that child-provided interfaces |
30 // be invoked. | 32 // can be bound. |
31 class CONTENT_EXPORT MojoApplicationHost { | 33 class CONTENT_EXPORT MojoApplicationHost { |
32 public: | 34 public: |
33 explicit MojoApplicationHost(const std::string& child_token); | 35 explicit MojoApplicationHost(const std::string& child_token); |
34 ~MojoApplicationHost(); | 36 ~MojoApplicationHost(); |
35 | 37 |
36 // Returns a token to pass to the child process to initialize its | 38 // Returns a token to pass to the child process to initialize its |
37 // MojoApplication. | 39 // MojoApplication. |
38 const std::string& GetToken() { return token_; } | 40 const std::string& GetToken() { return token_; } |
39 | 41 |
40 ServiceRegistry* service_registry() { return &service_registry_; } | 42 shell::InterfaceRegistry* interface_registry() { |
| 43 return interface_registry_.get(); |
| 44 } |
| 45 shell::InterfaceProvider* remote_interfaces() { |
| 46 return remote_interfaces_.get(); |
| 47 } |
41 | 48 |
42 #if defined(OS_ANDROID) | 49 #if defined(OS_ANDROID) |
43 ServiceRegistryAndroid* service_registry_android() { | 50 ServiceRegistryAndroid* service_registry_android() { |
44 return service_registry_android_.get(); | 51 return service_registry_android_.get(); |
45 } | 52 } |
46 #endif | 53 #endif |
47 | 54 |
48 private: | 55 private: |
49 const std::string token_; | 56 const std::string token_; |
50 | 57 |
51 std::unique_ptr<mojom::ApplicationSetup> application_setup_; | 58 std::unique_ptr<mojom::ApplicationSetup> application_setup_; |
52 ServiceRegistryImpl service_registry_; | 59 std::unique_ptr<shell::InterfaceRegistry> interface_registry_; |
| 60 std::unique_ptr<shell::InterfaceProvider> remote_interfaces_; |
53 | 61 |
54 #if defined(OS_ANDROID) | 62 #if defined(OS_ANDROID) |
55 std::unique_ptr<ServiceRegistryAndroid> service_registry_android_; | 63 std::unique_ptr<ServiceRegistryAndroid> service_registry_android_; |
56 #endif | 64 #endif |
57 | 65 |
58 DISALLOW_COPY_AND_ASSIGN(MojoApplicationHost); | 66 DISALLOW_COPY_AND_ASSIGN(MojoApplicationHost); |
59 }; | 67 }; |
60 | 68 |
61 } // namespace content | 69 } // namespace content |
62 | 70 |
63 #endif // CONTENT_BROWSER_MOJO_MOJO_APPLICATION_HOST_H_ | 71 #endif // CONTENT_BROWSER_MOJO_MOJO_APPLICATION_HOST_H_ |
OLD | NEW |