| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_CHILD_CONNECTION_H_ | 5 #ifndef CONTENT_BROWSER_MOJO_MOJO_CHILD_CONNECTION_H_ |
| 6 #define CONTENT_BROWSER_MOJO_MOJO_CHILD_CONNECTION_H_ | 6 #define CONTENT_BROWSER_MOJO_MOJO_CHILD_CONNECTION_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 "base/process/process_handle.h" | 12 #include "base/process/process_handle.h" |
| 13 #include "services/shell/public/interfaces/connector.mojom.h" | 13 #include "services/shell/public/interfaces/connector.mojom.h" |
| 14 | 14 |
| 15 #if defined(OS_ANDROID) | |
| 16 #include "content/public/browser/android/service_registry_android.h" | |
| 17 #endif | |
| 18 | |
| 19 namespace shell { | 15 namespace shell { |
| 20 class Connection; | 16 class Connection; |
| 21 class Connector; | 17 class Connector; |
| 22 } | 18 } |
| 23 | 19 |
| 24 namespace content { | 20 namespace content { |
| 25 | 21 |
| 26 // Helper class to establish a connection between the shell and a single child | 22 // Helper class to establish a connection between the shell and a single child |
| 27 // process. Process hosts can use this when launching new processes which | 23 // process. Process hosts can use this when launching new processes which |
| 28 // should be registered with the shell. | 24 // should be registered with the shell. |
| (...skipping 16 matching lines...) Expand all Loading... |
| 45 // A token which must be passed to the child process via | 41 // A token which must be passed to the child process via |
| 46 // |switches::kPrimordialPipeToken| in order for the child to initialize its | 42 // |switches::kPrimordialPipeToken| in order for the child to initialize its |
| 47 // end of the shell connection pipe. | 43 // end of the shell connection pipe. |
| 48 std::string shell_client_token() const { return shell_client_token_; } | 44 std::string shell_client_token() const { return shell_client_token_; } |
| 49 | 45 |
| 50 // Sets the child connection's process handle. This should be called as soon | 46 // Sets the child connection's process handle. This should be called as soon |
| 51 // as the process has been launched, and the connection will not be fully | 47 // as the process has been launched, and the connection will not be fully |
| 52 // functional until this is called. | 48 // functional until this is called. |
| 53 void SetProcessHandle(base::ProcessHandle handle); | 49 void SetProcessHandle(base::ProcessHandle handle); |
| 54 | 50 |
| 55 #if defined(OS_ANDROID) | |
| 56 ServiceRegistryAndroid* service_registry_android() { | |
| 57 return service_registry_android_.get(); | |
| 58 } | |
| 59 #endif | |
| 60 | |
| 61 private: | 51 private: |
| 62 const std::string shell_client_token_; | 52 const std::string shell_client_token_; |
| 63 std::unique_ptr<shell::Connection> connection_; | 53 std::unique_ptr<shell::Connection> connection_; |
| 64 shell::mojom::PIDReceiverPtr pid_receiver_; | 54 shell::mojom::PIDReceiverPtr pid_receiver_; |
| 65 #if defined(OS_ANDROID) | |
| 66 std::unique_ptr<ServiceRegistryAndroid> service_registry_android_; | |
| 67 #endif | |
| 68 | 55 |
| 69 DISALLOW_COPY_AND_ASSIGN(MojoChildConnection); | 56 DISALLOW_COPY_AND_ASSIGN(MojoChildConnection); |
| 70 }; | 57 }; |
| 71 | 58 |
| 72 } // namespace content | 59 } // namespace content |
| 73 | 60 |
| 74 #endif // CONTENT_BROWSER_MOJO_MOJO_CHILD_CONNECTION_H_ | 61 #endif // CONTENT_BROWSER_MOJO_MOJO_CHILD_CONNECTION_H_ |
| OLD | NEW |