| 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 10 matching lines...) Expand all Loading... |
| 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" | 30 #include "chrome/common/chrome_paths.h" |
| 31 #include "chrome/common/chrome_switches.h" | |
| 32 #include "chrome/common/logging_chrome.h" | 31 #include "chrome/common/logging_chrome.h" |
| 33 #include "content/browser/appcache/appcache_dispatcher_host.h" | 32 #include "content/browser/appcache/appcache_dispatcher_host.h" |
| 34 #include "content/browser/browser_child_process_host.h" | 33 #include "content/browser/browser_child_process_host.h" |
| 35 #include "content/browser/child_process_security_policy.h" | 34 #include "content/browser/child_process_security_policy.h" |
| 36 #include "content/browser/content_browser_client.h" | 35 #include "content/browser/content_browser_client.h" |
| 37 #include "content/browser/device_orientation/message_filter.h" | 36 #include "content/browser/device_orientation/message_filter.h" |
| 38 #include "content/browser/file_system/file_system_dispatcher_host.h" | 37 #include "content/browser/file_system/file_system_dispatcher_host.h" |
| 39 #include "content/browser/geolocation/geolocation_dispatcher_host.h" | 38 #include "content/browser/geolocation/geolocation_dispatcher_host.h" |
| 40 #include "content/browser/gpu/gpu_data_manager.h" | 39 #include "content/browser/gpu/gpu_data_manager.h" |
| 41 #include "content/browser/gpu/gpu_process_host.h" | 40 #include "content/browser/gpu/gpu_process_host.h" |
| (...skipping 19 matching lines...) Expand all Loading... |
| 61 #include "content/browser/renderer_host/render_widget_helper.h" | 60 #include "content/browser/renderer_host/render_widget_helper.h" |
| 62 #include "content/browser/renderer_host/render_widget_host.h" | 61 #include "content/browser/renderer_host/render_widget_host.h" |
| 63 #include "content/browser/renderer_host/resource_message_filter.h" | 62 #include "content/browser/renderer_host/resource_message_filter.h" |
| 64 #include "content/browser/renderer_host/socket_stream_dispatcher_host.h" | 63 #include "content/browser/renderer_host/socket_stream_dispatcher_host.h" |
| 65 #include "content/browser/speech/speech_input_dispatcher_host.h" | 64 #include "content/browser/speech/speech_input_dispatcher_host.h" |
| 66 #include "content/browser/trace_message_filter.h" | 65 #include "content/browser/trace_message_filter.h" |
| 67 #include "content/browser/user_metrics.h" | 66 #include "content/browser/user_metrics.h" |
| 68 #include "content/browser/worker_host/worker_message_filter.h" | 67 #include "content/browser/worker_host/worker_message_filter.h" |
| 69 #include "content/common/child_process_info.h" | 68 #include "content/common/child_process_info.h" |
| 70 #include "content/common/child_process_messages.h" | 69 #include "content/common/child_process_messages.h" |
| 70 #include "content/common/content_switches.h" |
| 71 #include "content/common/gpu/gpu_messages.h" | 71 #include "content/common/gpu/gpu_messages.h" |
| 72 #include "content/common/notification_service.h" | 72 #include "content/common/notification_service.h" |
| 73 #include "content/common/process_watcher.h" | 73 #include "content/common/process_watcher.h" |
| 74 #include "content/common/resource_messages.h" | 74 #include "content/common/resource_messages.h" |
| 75 #include "content/common/result_codes.h" | 75 #include "content/common/result_codes.h" |
| 76 #include "content/common/view_messages.h" | 76 #include "content/common/view_messages.h" |
| 77 #include "content/renderer/render_process_impl.h" | 77 #include "content/renderer/render_process_impl.h" |
| 78 #include "content/renderer/render_thread.h" | 78 #include "content/renderer/render_thread.h" |
| 79 #include "ipc/ipc_logging.h" | 79 #include "ipc/ipc_logging.h" |
| 80 #include "ipc/ipc_platform_file.h" | 80 #include "ipc/ipc_platform_file.h" |
| (...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 505 DCHECK(gpu_data_manager); | 505 DCHECK(gpu_data_manager); |
| 506 gpu_data_manager->AppendRendererCommandLine(command_line); | 506 gpu_data_manager->AppendRendererCommandLine(command_line); |
| 507 } | 507 } |
| 508 | 508 |
| 509 void BrowserRenderProcessHost::PropagateBrowserCommandLineToRenderer( | 509 void BrowserRenderProcessHost::PropagateBrowserCommandLineToRenderer( |
| 510 const CommandLine& browser_cmd, | 510 const CommandLine& browser_cmd, |
| 511 CommandLine* renderer_cmd) const { | 511 CommandLine* renderer_cmd) const { |
| 512 // Propagate the following switches to the renderer command line (along | 512 // Propagate the following switches to the renderer command line (along |
| 513 // with any associated values) if present in the browser command line. | 513 // with any associated values) if present in the browser command line. |
| 514 static const char* const kSwitchNames[] = { | 514 static const char* const kSwitchNames[] = { |
| 515 switches::kAllowHTTPBackgroundPage, | |
| 516 switches::kAllowScriptingGallery, | |
| 517 switches::kAppsCheckoutURL, | |
| 518 switches::kAppsGalleryURL, | |
| 519 // We propagate the Chrome Frame command line here as well in case the | 515 // We propagate the Chrome Frame command line here as well in case the |
| 520 // renderer is not run in the sandbox. | 516 // renderer is not run in the sandbox. |
| 521 switches::kChromeFrame, | 517 switches::kChromeFrame, |
| 522 switches::kDebugPrint, | |
| 523 switches::kDisable3DAPIs, | 518 switches::kDisable3DAPIs, |
| 524 switches::kDisableAcceleratedCompositing, | 519 switches::kDisableAcceleratedCompositing, |
| 525 switches::kDisableApplicationCache, | 520 switches::kDisableApplicationCache, |
| 526 switches::kDisableAudio, | 521 switches::kDisableAudio, |
| 527 switches::kDisableBreakpad, | 522 switches::kDisableBreakpad, |
| 528 switches::kDisableDataTransferItems, | 523 switches::kDisableDataTransferItems, |
| 529 switches::kDisableDatabases, | 524 switches::kDisableDatabases, |
| 530 switches::kDisableDesktopNotifications, | 525 switches::kDisableDesktopNotifications, |
| 531 switches::kDisableDeviceOrientation, | 526 switches::kDisableDeviceOrientation, |
| 532 switches::kDisableFileSystem, | 527 switches::kDisableFileSystem, |
| 533 switches::kDisableGeolocation, | 528 switches::kDisableGeolocation, |
| 534 switches::kDisableGLMultisampling, | 529 switches::kDisableGLMultisampling, |
| 535 switches::kDisableGLSLTranslator, | 530 switches::kDisableGLSLTranslator, |
| 536 switches::kDisableGpuVsync, | 531 switches::kDisableGpuVsync, |
| 537 switches::kDisableIndexedDatabase, | 532 switches::kDisableIndexedDatabase, |
| 538 switches::kDisableJavaScriptI18NAPI, | 533 switches::kDisableJavaScriptI18NAPI, |
| 539 switches::kDisableLocalStorage, | 534 switches::kDisableLocalStorage, |
| 540 switches::kDisableLogging, | 535 switches::kDisableLogging, |
| 541 #if defined(GOOGLE_CHROME_BUILD) && !defined(OS_CHROMEOS) && !defined(OS_MACOSX) | |
| 542 // Enabled by default in Google Chrome builds, except on CrOS. | |
| 543 switches::kDisablePrintPreview, | |
| 544 #else | |
| 545 // Disabled by default in Chromium builds and on CrOS. | |
| 546 switches::kEnablePrintPreview, | |
| 547 #endif | |
| 548 switches::kDisableSeccompSandbox, | 536 switches::kDisableSeccompSandbox, |
| 549 switches::kDisableSessionStorage, | 537 switches::kDisableSessionStorage, |
| 550 switches::kDisableSharedWorkers, | 538 switches::kDisableSharedWorkers, |
| 551 switches::kDisableSpeechInput, | 539 switches::kDisableSpeechInput, |
| 552 switches::kDisableWebSockets, | 540 switches::kDisableWebSockets, |
| 553 switches::kDomAutomationController, | |
| 554 switches::kDumpHistogramsOnExit, | |
| 555 switches::kEnableAdaptive, | 541 switches::kEnableAdaptive, |
| 556 switches::kEnableBenchmarking, | 542 switches::kEnableBenchmarking, |
| 557 switches::kEnableClickToPlay, | |
| 558 switches::kEnableCrxlessWebApps, | |
| 559 switches::kEnableDCHECK, | 543 switches::kEnableDCHECK, |
| 560 switches::kEnableExperimentalExtensionApis, | |
| 561 switches::kEnableInBrowserThumbnailing, | |
| 562 switches::kEnableIPCFuzzing, | |
| 563 switches::kEnableLogging, | 544 switches::kEnableLogging, |
| 564 switches::kEnableNaCl, | |
| 565 switches::kEnableOpenMax, | 545 switches::kEnableOpenMax, |
| 566 #if defined(ENABLE_P2P_APIS) | 546 #if defined(ENABLE_P2P_APIS) |
| 567 switches::kEnableP2PApi, | 547 switches::kEnableP2PApi, |
| 568 #endif | 548 #endif |
| 569 switches::kEnablePepperTesting, | 549 switches::kEnablePepperTesting, |
| 570 switches::kEnableRemoting, | |
| 571 switches::kEnableResourceContentSettings, | |
| 572 #if defined(OS_MACOSX) | 550 #if defined(OS_MACOSX) |
| 573 // Allow this to be set when invoking the browser and relayed along. | 551 // Allow this to be set when invoking the browser and relayed along. |
| 574 switches::kEnableSandboxLogging, | 552 switches::kEnableSandboxLogging, |
| 575 #endif | 553 #endif |
| 576 switches::kEnableSearchProviderApiV2, | |
| 577 switches::kEnableSeccompSandbox, | 554 switches::kEnableSeccompSandbox, |
| 578 switches::kEnableStatsTable, | 555 switches::kEnableStatsTable, |
| 579 switches::kEnableVideoFullscreen, | 556 switches::kEnableVideoFullscreen, |
| 580 switches::kEnableVideoLogging, | 557 switches::kEnableVideoLogging, |
| 581 switches::kEnableWatchdog, | |
| 582 switches::kEnableWebAudio, | 558 switches::kEnableWebAudio, |
| 583 switches::kExperimentalSpellcheckerFeatures, | |
| 584 switches::kFullMemoryCrashReport, | 559 switches::kFullMemoryCrashReport, |
| 585 #if !defined (GOOGLE_CHROME_BUILD) | 560 #if !defined (GOOGLE_CHROME_BUILD) |
| 586 // These are unsupported and not fully tested modes, so don't enable them | 561 // These are unsupported and not fully tested modes, so don't enable them |
| 587 // for official Google Chrome builds. | 562 // for official Google Chrome builds. |
| 588 switches::kInProcessPlugins, | 563 switches::kInProcessPlugins, |
| 589 #endif // GOOGLE_CHROME_BUILD | 564 #endif // GOOGLE_CHROME_BUILD |
| 590 switches::kInProcessWebGL, | 565 switches::kInProcessWebGL, |
| 591 switches::kJavaScriptFlags, | 566 switches::kJavaScriptFlags, |
| 592 switches::kLoggingLevel, | 567 switches::kLoggingLevel, |
| 593 switches::kMemoryProfiling, | |
| 594 switches::kMessageLoopHistogrammer, | |
| 595 switches::kNoJsRandomness, | 568 switches::kNoJsRandomness, |
| 596 switches::kNoReferrers, | 569 switches::kNoReferrers, |
| 597 switches::kNoSandbox, | 570 switches::kNoSandbox, |
| 598 switches::kPlaybackMode, | 571 switches::kPlaybackMode, |
| 599 switches::kPpapiFlashArgs, | |
| 600 switches::kPpapiFlashInProcess, | |
| 601 switches::kPpapiFlashPath, | |
| 602 switches::kPpapiFlashVersion, | |
| 603 switches::kPpapiOutOfProcess, | 572 switches::kPpapiOutOfProcess, |
| 604 switches::kProfilingAtStart, | |
| 605 switches::kProfilingFile, | |
| 606 switches::kProfilingFlush, | |
| 607 switches::kRecordMode, | 573 switches::kRecordMode, |
| 608 switches::kRegisterPepperPlugins, | 574 switches::kRegisterPepperPlugins, |
| 609 switches::kRemoteShellPort, | |
| 610 switches::kRendererAssertTest, | 575 switches::kRendererAssertTest, |
| 611 #if !defined(OFFICIAL_BUILD) | 576 #if !defined(OFFICIAL_BUILD) |
| 612 switches::kRendererCheckFalseTest, | 577 switches::kRendererCheckFalseTest, |
| 613 #endif // !defined(OFFICIAL_BUILD) | 578 #endif // !defined(OFFICIAL_BUILD) |
| 614 switches::kRendererCrashTest, | 579 switches::kRendererCrashTest, |
| 615 switches::kRendererStartupDialog, | 580 switches::kRendererStartupDialog, |
| 616 switches::kShowPaintRects, | 581 switches::kShowPaintRects, |
| 617 switches::kSilentDumpOnDCHECK, | |
| 618 switches::kSimpleDataSource, | 582 switches::kSimpleDataSource, |
| 619 switches::kTestSandbox, | 583 switches::kTestSandbox, |
| 620 // This flag needs to be propagated to the renderer process for | 584 // This flag needs to be propagated to the renderer process for |
| 621 // --in-process-webgl. | 585 // --in-process-webgl. |
| 622 switches::kUseGL, | 586 switches::kUseGL, |
| 623 switches::kUserAgent, | 587 switches::kUserAgent, |
| 624 switches::kV, | 588 switches::kV, |
| 625 switches::kVideoThreads, | 589 switches::kVideoThreads, |
| 626 switches::kVModule, | 590 switches::kVModule, |
| 627 switches::kWebCoreLogChannels, | 591 switches::kWebCoreLogChannels, |
| (...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 951 void BrowserRenderProcessHost::OnUserMetricsRecordAction( | 915 void BrowserRenderProcessHost::OnUserMetricsRecordAction( |
| 952 const std::string& action) { | 916 const std::string& action) { |
| 953 UserMetrics::RecordComputedAction(action); | 917 UserMetrics::RecordComputedAction(action); |
| 954 } | 918 } |
| 955 | 919 |
| 956 void BrowserRenderProcessHost::OnRevealFolderInOS(const FilePath& path) { | 920 void BrowserRenderProcessHost::OnRevealFolderInOS(const FilePath& path) { |
| 957 // Only honor the request if appropriate persmissions are granted. | 921 // Only honor the request if appropriate persmissions are granted. |
| 958 if (ChildProcessSecurityPolicy::GetInstance()->CanReadFile(id(), path)) | 922 if (ChildProcessSecurityPolicy::GetInstance()->CanReadFile(id(), path)) |
| 959 content::GetContentClient()->browser()->RevealFolderInOS(path); | 923 content::GetContentClient()->browser()->RevealFolderInOS(path); |
| 960 } | 924 } |
| OLD | NEW |