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