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> |
11 #include <limits> | 11 #include <limits> |
12 #include <vector> | 12 #include <vector> |
13 | 13 |
14 #if defined(OS_POSIX) | 14 #if defined(OS_POSIX) |
15 #include <utility> // for pair<> | 15 #include <utility> // for pair<> |
16 #endif | 16 #endif |
17 | 17 |
18 #include "base/callback.h" | 18 #include "base/callback.h" |
19 #include "base/command_line.h" | 19 #include "base/command_line.h" |
20 #include "base/logging.h" | 20 #include "base/logging.h" |
21 #include "base/metrics/field_trial.h" | 21 #include "base/metrics/field_trial.h" |
22 #include "base/metrics/histogram.h" | 22 #include "base/metrics/histogram.h" |
23 #include "base/path_service.h" | 23 #include "base/path_service.h" |
24 #include "base/platform_file.h" | 24 #include "base/platform_file.h" |
25 #include "base/stl_util-inl.h" | 25 #include "base/stl_util-inl.h" |
26 #include "base/string_util.h" | 26 #include "base/string_util.h" |
27 #include "base/threading/thread.h" | 27 #include "base/threading/thread.h" |
28 #include "base/threading/thread_restrictions.h" | 28 #include "base/threading/thread_restrictions.h" |
29 #include "chrome/browser/profiles/profile.h" | 29 #include "chrome/browser/profiles/profile.h" |
30 #include "chrome/common/chrome_paths.h" | |
31 #include "chrome/common/logging_chrome.h" | 30 #include "chrome/common/logging_chrome.h" |
32 #include "content/browser/appcache/appcache_dispatcher_host.h" | 31 #include "content/browser/appcache/appcache_dispatcher_host.h" |
33 #include "content/browser/browser_child_process_host.h" | 32 #include "content/browser/browser_child_process_host.h" |
34 #include "content/browser/child_process_security_policy.h" | 33 #include "content/browser/child_process_security_policy.h" |
35 #include "content/browser/content_browser_client.h" | 34 #include "content/browser/content_browser_client.h" |
36 #include "content/browser/device_orientation/message_filter.h" | 35 #include "content/browser/device_orientation/message_filter.h" |
37 #include "content/browser/file_system/file_system_dispatcher_host.h" | 36 #include "content/browser/file_system/file_system_dispatcher_host.h" |
38 #include "content/browser/geolocation/geolocation_dispatcher_host.h" | 37 #include "content/browser/geolocation/geolocation_dispatcher_host.h" |
39 #include "content/browser/gpu/gpu_data_manager.h" | 38 #include "content/browser/gpu/gpu_data_manager.h" |
40 #include "content/browser/gpu/gpu_process_host.h" | 39 #include "content/browser/gpu/gpu_process_host.h" |
(...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
465 | 464 |
466 void BrowserRenderProcessHost::AppendRendererCommandLine( | 465 void BrowserRenderProcessHost::AppendRendererCommandLine( |
467 CommandLine* command_line) const { | 466 CommandLine* command_line) const { |
468 // Pass the process type first, so it shows first in process listings. | 467 // Pass the process type first, so it shows first in process listings. |
469 // Extensions use a special pseudo-process type to make them distinguishable, | 468 // Extensions use a special pseudo-process type to make them distinguishable, |
470 // even though they're just renderers. | 469 // even though they're just renderers. |
471 command_line->AppendSwitchASCII(switches::kProcessType, | 470 command_line->AppendSwitchASCII(switches::kProcessType, |
472 is_extension_process_ ? switches::kExtensionProcess : | 471 is_extension_process_ ? switches::kExtensionProcess : |
473 switches::kRendererProcess); | 472 switches::kRendererProcess); |
474 | 473 |
475 if (logging::DialogsAreSuppressed()) | |
476 command_line->AppendSwitch(switches::kNoErrorDialogs); | |
477 | |
478 if (accessibility_enabled_) | 474 if (accessibility_enabled_) |
479 command_line->AppendSwitch(switches::kEnableAccessibility); | 475 command_line->AppendSwitch(switches::kEnableAccessibility); |
480 | 476 |
481 // Now send any options from our own command line we want to propagate. | 477 // Now send any options from our own command line we want to propagate. |
482 const CommandLine& browser_command_line = *CommandLine::ForCurrentProcess(); | 478 const CommandLine& browser_command_line = *CommandLine::ForCurrentProcess(); |
483 PropagateBrowserCommandLineToRenderer(browser_command_line, command_line); | 479 PropagateBrowserCommandLineToRenderer(browser_command_line, command_line); |
484 | 480 |
485 // Pass on the browser locale. | 481 // Pass on the browser locale. |
486 const std::string locale = | 482 const std::string locale = |
487 content::GetContentClient()->browser()->GetApplicationLocale(); | 483 content::GetContentClient()->browser()->GetApplicationLocale(); |
(...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
915 void BrowserRenderProcessHost::OnUserMetricsRecordAction( | 911 void BrowserRenderProcessHost::OnUserMetricsRecordAction( |
916 const std::string& action) { | 912 const std::string& action) { |
917 UserMetrics::RecordComputedAction(action); | 913 UserMetrics::RecordComputedAction(action); |
918 } | 914 } |
919 | 915 |
920 void BrowserRenderProcessHost::OnRevealFolderInOS(const FilePath& path) { | 916 void BrowserRenderProcessHost::OnRevealFolderInOS(const FilePath& path) { |
921 // Only honor the request if appropriate persmissions are granted. | 917 // Only honor the request if appropriate persmissions are granted. |
922 if (ChildProcessSecurityPolicy::GetInstance()->CanReadFile(id(), path)) | 918 if (ChildProcessSecurityPolicy::GetInstance()->CanReadFile(id(), path)) |
923 content::GetContentClient()->browser()->RevealFolderInOS(path); | 919 content::GetContentClient()->browser()->RevealFolderInOS(path); |
924 } | 920 } |
OLD | NEW |