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 CHROME_BROWSER_NACL_HOST_NACL_PROCESS_HOST_H_ | 5 #ifndef COMPONENTS_NACL_BROWSER_NACL_PROCESS_HOST_H_ |
6 #define CHROME_BROWSER_NACL_HOST_NACL_PROCESS_HOST_H_ | 6 #define COMPONENTS_NACL_BROWSER_NACL_PROCESS_HOST_H_ |
7 | 7 |
8 #include "build/build_config.h" | 8 #include "build/build_config.h" |
9 | 9 |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
11 #include "base/files/file_util_proxy.h" | 11 #include "base/files/file_util_proxy.h" |
12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
13 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
14 #include "base/message_loop/message_loop.h" | 14 #include "base/message_loop/message_loop.h" |
15 #include "base/process/process.h" | 15 #include "base/process/process.h" |
16 #include "components/nacl/common/nacl_types.h" | 16 #include "components/nacl/common/nacl_types.h" |
17 #include "content/public/browser/browser_child_process_host_delegate.h" | 17 #include "content/public/browser/browser_child_process_host_delegate.h" |
18 #include "content/public/browser/browser_child_process_host_iterator.h" | 18 #include "content/public/browser/browser_child_process_host_iterator.h" |
19 #include "ipc/ipc_channel_handle.h" | 19 #include "ipc/ipc_channel_handle.h" |
20 #include "net/socket/socket_descriptor.h" | 20 #include "net/socket/socket_descriptor.h" |
21 #include "ppapi/shared_impl/ppapi_permissions.h" | 21 #include "ppapi/shared_impl/ppapi_permissions.h" |
22 #include "url/gurl.h" | 22 #include "url/gurl.h" |
23 | 23 |
24 class CommandLine; | 24 class CommandLine; |
25 class NaClHostMessageFilter; | |
26 | 25 |
27 namespace content { | 26 namespace content { |
28 class BrowserChildProcessHost; | 27 class BrowserChildProcessHost; |
29 class BrowserPpapiHost; | 28 class BrowserPpapiHost; |
30 } | 29 } |
31 | 30 |
32 namespace IPC { | 31 namespace IPC { |
33 class ChannelProxy; | 32 class ChannelProxy; |
34 } | 33 } |
35 | 34 |
36 namespace nacl { | 35 namespace nacl { |
| 36 |
| 37 class NaClHostMessageFilter; |
37 void* AllocateAddressSpaceASLR(base::ProcessHandle process, size_t size); | 38 void* AllocateAddressSpaceASLR(base::ProcessHandle process, size_t size); |
38 } | |
39 | 39 |
40 // Represents the browser side of the browser <--> NaCl communication | 40 // Represents the browser side of the browser <--> NaCl communication |
41 // channel. There will be one NaClProcessHost per NaCl process | 41 // channel. There will be one NaClProcessHost per NaCl process |
42 // The browser is responsible for starting the NaCl process | 42 // The browser is responsible for starting the NaCl process |
43 // when requested by the renderer. | 43 // when requested by the renderer. |
44 // After that, most of the communication is directly between NaCl plugin | 44 // After that, most of the communication is directly between NaCl plugin |
45 // running in the renderer and NaCl processes. | 45 // running in the renderer and NaCl processes. |
46 class NaClProcessHost : public content::BrowserChildProcessHostDelegate { | 46 class NaClProcessHost : public content::BrowserChildProcessHostDelegate { |
47 public: | 47 public: |
48 // manifest_url: the URL of the manifest of the Native Client plugin being | 48 // manifest_url: the URL of the manifest of the Native Client plugin being |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 | 135 |
136 // Sends the reply message to the renderer who is waiting for the plugin | 136 // Sends the reply message to the renderer who is waiting for the plugin |
137 // to load. Returns true on success. | 137 // to load. Returns true on success. |
138 bool ReplyToRenderer(const IPC::ChannelHandle& channel_handle); | 138 bool ReplyToRenderer(const IPC::ChannelHandle& channel_handle); |
139 | 139 |
140 // Sends the reply with error message to the renderer. | 140 // Sends the reply with error message to the renderer. |
141 void SendErrorToRenderer(const std::string& error_message); | 141 void SendErrorToRenderer(const std::string& error_message); |
142 | 142 |
143 // Sends the reply message to the renderer. Either result or | 143 // Sends the reply message to the renderer. Either result or |
144 // error message must be empty. | 144 // error message must be empty. |
145 void SendMessageToRenderer(const nacl::NaClLaunchResult& result, | 145 void SendMessageToRenderer(const NaClLaunchResult& result, |
146 const std::string& error_message); | 146 const std::string& error_message); |
147 | 147 |
148 // Sends the message to the NaCl process to load the plugin. Returns true | 148 // Sends the message to the NaCl process to load the plugin. Returns true |
149 // on success. | 149 // on success. |
150 bool StartNaClExecution(); | 150 bool StartNaClExecution(); |
151 | 151 |
152 // Called once all initialization is complete and the NaCl process is | 152 // Called once all initialization is complete and the NaCl process is |
153 // ready to go. Returns true on success. | 153 // ready to go. Returns true on success. |
154 bool SendStart(); | 154 bool SendStart(); |
155 | 155 |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
229 // Plugin listener, to forward browser channel messages to us. | 229 // Plugin listener, to forward browser channel messages to us. |
230 PluginListener ipc_plugin_listener_; | 230 PluginListener ipc_plugin_listener_; |
231 // Browser host for plugin process. | 231 // Browser host for plugin process. |
232 scoped_ptr<content::BrowserPpapiHost> ppapi_host_; | 232 scoped_ptr<content::BrowserPpapiHost> ppapi_host_; |
233 | 233 |
234 int render_view_id_; | 234 int render_view_id_; |
235 | 235 |
236 DISALLOW_COPY_AND_ASSIGN(NaClProcessHost); | 236 DISALLOW_COPY_AND_ASSIGN(NaClProcessHost); |
237 }; | 237 }; |
238 | 238 |
239 #endif // CHROME_BROWSER_NACL_HOST_NACL_PROCESS_HOST_H_ | 239 } // namespace nacl |
| 240 |
| 241 #endif // COMPONENTS_NACL_BROWSER_NACL_PROCESS_HOST_H_ |
OLD | NEW |