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 COMPONENTS_NACL_BROWSER_NACL_PROCESS_HOST_H_ | 5 #ifndef COMPONENTS_NACL_BROWSER_NACL_PROCESS_HOST_H_ |
6 #define COMPONENTS_NACL_BROWSER_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" |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 void OnProcessLaunchedByBroker(base::ProcessHandle handle); | 88 void OnProcessLaunchedByBroker(base::ProcessHandle handle); |
89 void OnDebugExceptionHandlerLaunchedByBroker(bool success); | 89 void OnDebugExceptionHandlerLaunchedByBroker(bool success); |
90 #endif | 90 #endif |
91 | 91 |
92 bool Send(IPC::Message* msg); | 92 bool Send(IPC::Message* msg); |
93 | 93 |
94 content::BrowserChildProcessHost* process() { return process_.get(); } | 94 content::BrowserChildProcessHost* process() { return process_.get(); } |
95 content::BrowserPpapiHost* browser_ppapi_host() { return ppapi_host_.get(); } | 95 content::BrowserPpapiHost* browser_ppapi_host() { return ppapi_host_.get(); } |
96 | 96 |
97 private: | 97 private: |
98 friend class PluginListener; | |
99 | |
100 // Internal class that holds the NaClHandle objecs so that | 98 // Internal class that holds the NaClHandle objecs so that |
101 // nacl_process_host.h doesn't include NaCl headers. Needed since it's | 99 // nacl_process_host.h doesn't include NaCl headers. Needed since it's |
102 // included by src\content, which can't depend on the NaCl gyp file because it | 100 // included by src\content, which can't depend on the NaCl gyp file because it |
103 // depends on chrome.gyp (circular dependency). | 101 // depends on chrome.gyp (circular dependency). |
104 struct NaClInternal; | 102 struct NaClInternal; |
105 | 103 |
106 // PluginListener that forwards any messages from untrusted code that aren't | |
107 // handled by the PepperMessageFilter to us. | |
108 class PluginListener : public IPC::Listener { | |
109 public: | |
110 explicit PluginListener(NaClProcessHost* host); | |
111 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | |
112 private: | |
113 // Non-owning pointer so we can forward messages to the host. | |
114 NaClProcessHost* host_; | |
115 }; | |
116 | |
117 bool LaunchNaClGdb(); | 104 bool LaunchNaClGdb(); |
118 | 105 |
119 #if defined(OS_POSIX) | 106 #if defined(OS_POSIX) |
120 // Create bound TCP socket in the browser process so that the NaCl GDB debug | 107 // Create bound TCP socket in the browser process so that the NaCl GDB debug |
121 // stub can use it to accept incoming connections even when the Chrome sandbox | 108 // stub can use it to accept incoming connections even when the Chrome sandbox |
122 // is enabled. | 109 // is enabled. |
123 net::SocketDescriptor GetDebugStubSocketHandle(); | 110 net::SocketDescriptor GetDebugStubSocketHandle(); |
124 #endif | 111 #endif |
125 bool LaunchSelLdr(); | 112 bool LaunchSelLdr(); |
126 | 113 |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 const base::PlatformFile& file); | 156 const base::PlatformFile& file); |
170 | 157 |
171 #if defined(OS_WIN) | 158 #if defined(OS_WIN) |
172 // Message handler for Windows hardware exception handling. | 159 // Message handler for Windows hardware exception handling. |
173 void OnAttachDebugExceptionHandler(const std::string& info, | 160 void OnAttachDebugExceptionHandler(const std::string& info, |
174 IPC::Message* reply_msg); | 161 IPC::Message* reply_msg); |
175 bool AttachDebugExceptionHandler(const std::string& info, | 162 bool AttachDebugExceptionHandler(const std::string& info, |
176 IPC::Message* reply_msg); | 163 IPC::Message* reply_msg); |
177 #endif | 164 #endif |
178 | 165 |
179 // Called when the PPAPI IPC channel to the browser has been created. | 166 // Called when the PPAPI IPC channels to the browser/renderer have been |
180 void OnPpapiBrowserChannelCreated(const IPC::ChannelHandle& channel_handle); | 167 // created. |
181 // Called when the PPAPI IPC channel to the renderer has been created. | 168 void OnPpapiChannelsCreated( |
182 void OnPpapiRendererChannelCreated(const IPC::ChannelHandle& channel_handle); | 169 const IPC::ChannelHandle& browser_channel_handle, |
183 | 170 const IPC::ChannelHandle& renderer_channel_handle); |
184 // Called by PluginListener, so messages from the untrusted side of | |
185 // the IPC proxy can be handled. | |
186 bool OnUntrustedMessageForwarded(const IPC::Message& msg); | |
187 | 171 |
188 GURL manifest_url_; | 172 GURL manifest_url_; |
189 ppapi::PpapiPermissions permissions_; | 173 ppapi::PpapiPermissions permissions_; |
190 | 174 |
191 #if defined(OS_WIN) | 175 #if defined(OS_WIN) |
192 // This field becomes true when the broker successfully launched | 176 // This field becomes true when the broker successfully launched |
193 // the NaCl loader. | 177 // the NaCl loader. |
194 bool process_launched_by_broker_; | 178 bool process_launched_by_broker_; |
195 #endif | 179 #endif |
196 // The NaClHostMessageFilter that requested this NaCl process. We use | 180 // The NaClHostMessageFilter that requested this NaCl process. We use |
(...skipping 26 matching lines...) Expand all Loading... |
223 bool enable_dyncode_syscalls_; | 207 bool enable_dyncode_syscalls_; |
224 bool enable_exception_handling_; | 208 bool enable_exception_handling_; |
225 bool enable_crash_throttling_; | 209 bool enable_crash_throttling_; |
226 | 210 |
227 bool off_the_record_; | 211 bool off_the_record_; |
228 | 212 |
229 const base::FilePath profile_directory_; | 213 const base::FilePath profile_directory_; |
230 | 214 |
231 // Channel proxy to terminate the NaCl-Browser PPAPI channel. | 215 // Channel proxy to terminate the NaCl-Browser PPAPI channel. |
232 scoped_ptr<IPC::ChannelProxy> ipc_proxy_channel_; | 216 scoped_ptr<IPC::ChannelProxy> ipc_proxy_channel_; |
233 // Plugin listener, to forward browser channel messages to us. | |
234 PluginListener ipc_plugin_listener_; | |
235 // Browser host for plugin process. | 217 // Browser host for plugin process. |
236 scoped_ptr<content::BrowserPpapiHost> ppapi_host_; | 218 scoped_ptr<content::BrowserPpapiHost> ppapi_host_; |
237 | 219 |
238 int render_view_id_; | 220 int render_view_id_; |
239 | 221 |
240 DISALLOW_COPY_AND_ASSIGN(NaClProcessHost); | 222 DISALLOW_COPY_AND_ASSIGN(NaClProcessHost); |
241 }; | 223 }; |
242 | 224 |
243 } // namespace nacl | 225 } // namespace nacl |
244 | 226 |
245 #endif // COMPONENTS_NACL_BROWSER_NACL_PROCESS_HOST_H_ | 227 #endif // COMPONENTS_NACL_BROWSER_NACL_PROCESS_HOST_H_ |
OLD | NEW |