OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_PUBLIC_COMMON_CHILD_PROCESS_HOST_H_ | 5 #ifndef CONTENT_PUBLIC_COMMON_CHILD_PROCESS_HOST_H_ |
6 #define CONTENT_PUBLIC_COMMON_CHILD_PROCESS_HOST_H_ | 6 #define CONTENT_PUBLIC_COMMON_CHILD_PROCESS_HOST_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include "base/files/scoped_file.h" | 10 #include "base/files/scoped_file.h" |
11 #include "build/build_config.h" | 11 #include "build/build_config.h" |
12 #include "content/common/content_export.h" | 12 #include "content/common/content_export.h" |
13 #include "ipc/attachment_broker_privileged.h" | 13 #include "ipc/attachment_broker_privileged.h" |
14 #include "ipc/ipc_channel_proxy.h" | 14 #include "ipc/ipc_channel_proxy.h" |
15 | 15 |
16 namespace base { | 16 namespace base { |
17 class FilePath; | 17 class FilePath; |
18 } | 18 } |
19 | 19 |
20 namespace IPC { | 20 namespace IPC { |
21 class MessageFilter; | 21 class MessageFilter; |
22 } | 22 } |
23 | 23 |
| 24 namespace shell { |
| 25 class InterfaceProvider; |
| 26 } |
| 27 |
24 namespace content { | 28 namespace content { |
25 | 29 |
26 class ChildProcessHostDelegate; | 30 class ChildProcessHostDelegate; |
27 | 31 |
28 // This represents a non-browser process. This can include traditional child | 32 // This represents a non-browser process. This can include traditional child |
29 // processes like plugins, or an embedder could even use this for long lived | 33 // processes like plugins, or an embedder could even use this for long lived |
30 // processes that run independent of the browser process. | 34 // processes that run independent of the browser process. |
31 class CONTENT_EXPORT ChildProcessHost : public IPC::Sender { | 35 class CONTENT_EXPORT ChildProcessHost : public IPC::Sender { |
32 public: | 36 public: |
33 ~ChildProcessHost() override {} | 37 ~ChildProcessHost() override {} |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 // Send the shutdown message to the child process. | 80 // Send the shutdown message to the child process. |
77 // Does not check with the delegate's CanShutdown. | 81 // Does not check with the delegate's CanShutdown. |
78 virtual void ForceShutdown() = 0; | 82 virtual void ForceShutdown() = 0; |
79 | 83 |
80 // Creates the IPC channel. Returns the channel id if it succeeded, an | 84 // Creates the IPC channel. Returns the channel id if it succeeded, an |
81 // empty string otherwise | 85 // empty string otherwise |
82 virtual std::string CreateChannel() = 0; | 86 virtual std::string CreateChannel() = 0; |
83 | 87 |
84 // Creates the IPC channel on top of Mojo. Returns the Mojo channel token if | 88 // Creates the IPC channel on top of Mojo. Returns the Mojo channel token if |
85 // succeeded, or an empty string on failure. | 89 // succeeded, or an empty string on failure. |
| 90 // |
| 91 // DEPRECATED: Don't use this. Instead implement GetRemoteInterfaces() in the |
| 92 // delegate and use the CreateChannelMojo() version below. |
86 virtual std::string CreateChannelMojo(const std::string& child_token) = 0; | 93 virtual std::string CreateChannelMojo(const std::string& child_token) = 0; |
87 | 94 |
| 95 // Creates the IPC channel over a Mojo message pipe. The pipe connection is |
| 96 // brokered through the shell like any other service connection. |
| 97 virtual void CreateChannelMojo() = 0; |
| 98 |
88 // Returns true iff the IPC channel is currently being opened; | 99 // Returns true iff the IPC channel is currently being opened; |
89 virtual bool IsChannelOpening() = 0; | 100 virtual bool IsChannelOpening() = 0; |
90 | 101 |
91 // Adds an IPC message filter. A reference will be kept to the filter. | 102 // Adds an IPC message filter. A reference will be kept to the filter. |
92 virtual void AddFilter(IPC::MessageFilter* filter) = 0; | 103 virtual void AddFilter(IPC::MessageFilter* filter) = 0; |
93 | 104 |
| 105 // Returns the shell::InterfaceProvider the process host can use to bind |
| 106 // interfaces exposed to it from the child. |
| 107 virtual shell::InterfaceProvider* GetRemoteInterfaces() = 0; |
| 108 |
94 #if defined(OS_POSIX) | 109 #if defined(OS_POSIX) |
95 // See IPC::Channel::TakeClientFileDescriptor. | 110 // See IPC::Channel::TakeClientFileDescriptor. |
96 virtual base::ScopedFD TakeClientFileDescriptor() = 0; | 111 virtual base::ScopedFD TakeClientFileDescriptor() = 0; |
97 #endif | 112 #endif |
98 }; | 113 }; |
99 | 114 |
100 }; // namespace content | 115 }; // namespace content |
101 | 116 |
102 #endif // CONTENT_PUBLIC_COMMON_CHILD_PROCESS_HOST_H_ | 117 #endif // CONTENT_PUBLIC_COMMON_CHILD_PROCESS_HOST_H_ |
OLD | NEW |