OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 // Represents the browser side of the browser <--> renderer communication | 5 // Represents the browser side of the browser <--> renderer communication |
6 // channel. There will be one RenderProcessHost per renderer process. | 6 // channel. There will be one RenderProcessHost per renderer process. |
7 | 7 |
8 #include "content/browser/renderer_host/browser_render_process_host.h" | 8 #include "content/browser/renderer_host/browser_render_process_host.h" |
9 | 9 |
10 #include <algorithm> | 10 #include <algorithm> |
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
263 | 263 |
264 CommandLine::StringType renderer_prefix; | 264 CommandLine::StringType renderer_prefix; |
265 #if defined(OS_POSIX) | 265 #if defined(OS_POSIX) |
266 // A command prefix is something prepended to the command line of the spawned | 266 // A command prefix is something prepended to the command line of the spawned |
267 // process. It is supported only on POSIX systems. | 267 // process. It is supported only on POSIX systems. |
268 const CommandLine& browser_command_line = *CommandLine::ForCurrentProcess(); | 268 const CommandLine& browser_command_line = *CommandLine::ForCurrentProcess(); |
269 renderer_prefix = | 269 renderer_prefix = |
270 browser_command_line.GetSwitchValueNative(switches::kRendererCmdPrefix); | 270 browser_command_line.GetSwitchValueNative(switches::kRendererCmdPrefix); |
271 #endif // defined(OS_POSIX) | 271 #endif // defined(OS_POSIX) |
272 | 272 |
| 273 #if defined(OS_LINUX) |
| 274 int flags = renderer_prefix.empty() ? ChildProcessHost::CHILD_ALLOW_SELF : |
| 275 ChildProcessHost::CHILD_NORMAL; |
| 276 #else |
| 277 int flags = ChildProcessHost::CHILD_NORMAL; |
| 278 #endif |
| 279 |
273 // Find the renderer before creating the channel so if this fails early we | 280 // Find the renderer before creating the channel so if this fails early we |
274 // return without creating the channel. | 281 // return without creating the channel. |
275 FilePath renderer_path = | 282 FilePath renderer_path = ChildProcessHost::GetChildPath(flags); |
276 ChildProcessHost::GetChildPath(renderer_prefix.empty()); | |
277 if (renderer_path.empty()) | 283 if (renderer_path.empty()) |
278 return false; | 284 return false; |
279 | 285 |
280 // Setup the IPC channel. | 286 // Setup the IPC channel. |
281 const std::string channel_id = | 287 const std::string channel_id = |
282 ChildProcessInfo::GenerateRandomChannelID(this); | 288 ChildProcessInfo::GenerateRandomChannelID(this); |
283 channel_.reset(new IPC::ChannelProxy( | 289 channel_.reset(new IPC::ChannelProxy( |
284 channel_id, IPC::Channel::MODE_SERVER, this, | 290 channel_id, IPC::Channel::MODE_SERVER, this, |
285 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO))); | 291 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO))); |
286 | 292 |
(...skipping 635 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
922 void BrowserRenderProcessHost::OnRevealFolderInOS(const FilePath& path) { | 928 void BrowserRenderProcessHost::OnRevealFolderInOS(const FilePath& path) { |
923 // Only honor the request if appropriate persmissions are granted. | 929 // Only honor the request if appropriate persmissions are granted. |
924 if (ChildProcessSecurityPolicy::GetInstance()->CanReadFile(id(), path)) | 930 if (ChildProcessSecurityPolicy::GetInstance()->CanReadFile(id(), path)) |
925 content::GetContentClient()->browser()->OpenItem(path); | 931 content::GetContentClient()->browser()->OpenItem(path); |
926 } | 932 } |
927 | 933 |
928 void BrowserRenderProcessHost::OnSavedPageAsMHTML(int job_id, bool success) { | 934 void BrowserRenderProcessHost::OnSavedPageAsMHTML(int job_id, bool success) { |
929 content::GetContentClient()->browser()->GetMHTMLGenerationManager()-> | 935 content::GetContentClient()->browser()->GetMHTMLGenerationManager()-> |
930 MHTMLGenerated(job_id, success); | 936 MHTMLGenerated(job_id, success); |
931 } | 937 } |
OLD | NEW |