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 | |
28 namespace content { | 24 namespace content { |
29 | 25 |
30 class ChildProcessHostDelegate; | 26 class ChildProcessHostDelegate; |
31 | 27 |
32 // This represents a non-browser process. This can include traditional child | 28 // This represents a non-browser process. This can include traditional child |
33 // processes like plugins, or an embedder could even use this for long lived | 29 // processes like plugins, or an embedder could even use this for long lived |
34 // processes that run independent of the browser process. | 30 // processes that run independent of the browser process. |
35 class CONTENT_EXPORT ChildProcessHost : public IPC::Sender { | 31 class CONTENT_EXPORT ChildProcessHost : public IPC::Sender { |
36 public: | 32 public: |
37 ~ChildProcessHost() override {} | 33 ~ChildProcessHost() override {} |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 // Send the shutdown message to the child process. | 76 // Send the shutdown message to the child process. |
81 // Does not check with the delegate's CanShutdown. | 77 // Does not check with the delegate's CanShutdown. |
82 virtual void ForceShutdown() = 0; | 78 virtual void ForceShutdown() = 0; |
83 | 79 |
84 // Creates the IPC channel. Returns the channel id if it succeeded, an | 80 // Creates the IPC channel. Returns the channel id if it succeeded, an |
85 // empty string otherwise | 81 // empty string otherwise |
86 virtual std::string CreateChannel() = 0; | 82 virtual std::string CreateChannel() = 0; |
87 | 83 |
88 // Creates the IPC channel on top of Mojo. Returns the Mojo channel token if | 84 // Creates the IPC channel on top of Mojo. Returns the Mojo channel token if |
89 // succeeded, or an empty string on failure. | 85 // 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. | |
93 virtual std::string CreateChannelMojo(const std::string& child_token) = 0; | 86 virtual std::string CreateChannelMojo(const std::string& child_token) = 0; |
94 | 87 |
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 | |
99 // Returns true iff the IPC channel is currently being opened; | 88 // Returns true iff the IPC channel is currently being opened; |
100 virtual bool IsChannelOpening() = 0; | 89 virtual bool IsChannelOpening() = 0; |
101 | 90 |
102 // Adds an IPC message filter. A reference will be kept to the filter. | 91 // Adds an IPC message filter. A reference will be kept to the filter. |
103 virtual void AddFilter(IPC::MessageFilter* filter) = 0; | 92 virtual void AddFilter(IPC::MessageFilter* filter) = 0; |
104 | 93 |
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 | |
109 #if defined(OS_POSIX) | 94 #if defined(OS_POSIX) |
110 // See IPC::Channel::TakeClientFileDescriptor. | 95 // See IPC::Channel::TakeClientFileDescriptor. |
111 virtual base::ScopedFD TakeClientFileDescriptor() = 0; | 96 virtual base::ScopedFD TakeClientFileDescriptor() = 0; |
112 #endif | 97 #endif |
113 }; | 98 }; |
114 | 99 |
115 }; // namespace content | 100 }; // namespace content |
116 | 101 |
117 #endif // CONTENT_PUBLIC_COMMON_CHILD_PROCESS_HOST_H_ | 102 #endif // CONTENT_PUBLIC_COMMON_CHILD_PROCESS_HOST_H_ |
OLD | NEW |