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