| 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 #include "chrome/renderer/chrome_content_renderer_client.h" | 5 #include "chrome/renderer/chrome_content_renderer_client.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 #include "content/public/renderer/plugin_instance_throttler.h" | 90 #include "content/public/renderer/plugin_instance_throttler.h" |
| 91 #include "content/public/renderer/render_frame.h" | 91 #include "content/public/renderer/render_frame.h" |
| 92 #include "content/public/renderer/render_thread.h" | 92 #include "content/public/renderer/render_thread.h" |
| 93 #include "content/public/renderer/render_view.h" | 93 #include "content/public/renderer/render_view.h" |
| 94 #include "content/public/renderer/render_view_visitor.h" | 94 #include "content/public/renderer/render_view_visitor.h" |
| 95 #include "extensions/common/constants.h" | 95 #include "extensions/common/constants.h" |
| 96 #include "ipc/ipc_sync_channel.h" | 96 #include "ipc/ipc_sync_channel.h" |
| 97 #include "net/base/net_errors.h" | 97 #include "net/base/net_errors.h" |
| 98 #include "ppapi/c/private/ppb_pdf.h" | 98 #include "ppapi/c/private/ppb_pdf.h" |
| 99 #include "ppapi/shared_impl/ppapi_switches.h" | 99 #include "ppapi/shared_impl/ppapi_switches.h" |
| 100 #include "printing/features/features.h" |
| 100 #include "services/service_manager/public/cpp/interface_provider.h" | 101 #include "services/service_manager/public/cpp/interface_provider.h" |
| 101 #include "third_party/WebKit/public/platform/URLConversion.h" | 102 #include "third_party/WebKit/public/platform/URLConversion.h" |
| 102 #include "third_party/WebKit/public/platform/WebCachePolicy.h" | 103 #include "third_party/WebKit/public/platform/WebCachePolicy.h" |
| 103 #include "third_party/WebKit/public/platform/WebSecurityOrigin.h" | 104 #include "third_party/WebKit/public/platform/WebSecurityOrigin.h" |
| 104 #include "third_party/WebKit/public/platform/WebURL.h" | 105 #include "third_party/WebKit/public/platform/WebURL.h" |
| 105 #include "third_party/WebKit/public/platform/WebURLError.h" | 106 #include "third_party/WebKit/public/platform/WebURLError.h" |
| 106 #include "third_party/WebKit/public/platform/WebURLRequest.h" | 107 #include "third_party/WebKit/public/platform/WebURLRequest.h" |
| 107 #include "third_party/WebKit/public/platform/WebURLResponse.h" | 108 #include "third_party/WebKit/public/platform/WebURLResponse.h" |
| 108 #include "third_party/WebKit/public/web/WebCache.h" | 109 #include "third_party/WebKit/public/web/WebCache.h" |
| 109 #include "third_party/WebKit/public/web/WebDataSource.h" | 110 #include "third_party/WebKit/public/web/WebDataSource.h" |
| (...skipping 22 matching lines...) Expand all Loading... |
| 132 #include "extensions/renderer/dispatcher.h" | 133 #include "extensions/renderer/dispatcher.h" |
| 133 #include "extensions/renderer/renderer_extension_registry.h" | 134 #include "extensions/renderer/renderer_extension_registry.h" |
| 134 #endif | 135 #endif |
| 135 | 136 |
| 136 #if defined(ENABLE_PLUGINS) | 137 #if defined(ENABLE_PLUGINS) |
| 137 #include "chrome/common/plugin_utils.h" | 138 #include "chrome/common/plugin_utils.h" |
| 138 #include "chrome/renderer/plugins/chrome_plugin_placeholder.h" | 139 #include "chrome/renderer/plugins/chrome_plugin_placeholder.h" |
| 139 #include "chrome/renderer/plugins/power_saver_info.h" | 140 #include "chrome/renderer/plugins/power_saver_info.h" |
| 140 #endif | 141 #endif |
| 141 | 142 |
| 142 #if defined(ENABLE_PRINTING) | 143 #if BUILDFLAG(ENABLE_PRINTING) |
| 143 #include "chrome/common/chrome_content_client.h" | 144 #include "chrome/common/chrome_content_client.h" |
| 144 #include "chrome/renderer/printing/chrome_print_web_view_helper_delegate.h" | 145 #include "chrome/renderer/printing/chrome_print_web_view_helper_delegate.h" |
| 145 #include "components/printing/renderer/print_web_view_helper.h" | 146 #include "components/printing/renderer/print_web_view_helper.h" |
| 146 #include "printing/print_settings.h" | 147 #include "printing/print_settings.h" |
| 147 #endif | 148 #endif |
| 148 | 149 |
| 149 #if defined(ENABLE_PRINT_PREVIEW) | 150 #if BUILDFLAG(ENABLE_PRINT_PREVIEW) |
| 150 #include "chrome/renderer/pepper/chrome_pdf_print_client.h" | 151 #include "chrome/renderer/pepper/chrome_pdf_print_client.h" |
| 151 #endif | 152 #endif |
| 152 | 153 |
| 153 #if defined(ENABLE_SPELLCHECK) | 154 #if defined(ENABLE_SPELLCHECK) |
| 154 #include "components/spellcheck/renderer/spellcheck.h" | 155 #include "components/spellcheck/renderer/spellcheck.h" |
| 155 #include "components/spellcheck/renderer/spellcheck_provider.h" | 156 #include "components/spellcheck/renderer/spellcheck_provider.h" |
| 156 #endif | 157 #endif |
| 157 | 158 |
| 158 #if defined(ENABLE_WEBRTC) | 159 #if defined(ENABLE_WEBRTC) |
| 159 #include "chrome/renderer/media/webrtc_logging_message_filter.h" | 160 #include "chrome/renderer/media/webrtc_logging_message_filter.h" |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 300 extensions::ExtensionsRendererClient::Set( | 301 extensions::ExtensionsRendererClient::Set( |
| 301 ChromeExtensionsRendererClient::GetInstance()); | 302 ChromeExtensionsRendererClient::GetInstance()); |
| 302 #endif | 303 #endif |
| 303 #if defined(ENABLE_PLUGINS) | 304 #if defined(ENABLE_PLUGINS) |
| 304 for (size_t i = 0; i < arraysize(kPredefinedAllowedCameraDeviceOrigins); ++i) | 305 for (size_t i = 0; i < arraysize(kPredefinedAllowedCameraDeviceOrigins); ++i) |
| 305 allowed_camera_device_origins_.insert( | 306 allowed_camera_device_origins_.insert( |
| 306 kPredefinedAllowedCameraDeviceOrigins[i]); | 307 kPredefinedAllowedCameraDeviceOrigins[i]); |
| 307 for (size_t i = 0; i < arraysize(kPredefinedAllowedCompositorOrigins); ++i) | 308 for (size_t i = 0; i < arraysize(kPredefinedAllowedCompositorOrigins); ++i) |
| 308 allowed_compositor_origins_.insert(kPredefinedAllowedCompositorOrigins[i]); | 309 allowed_compositor_origins_.insert(kPredefinedAllowedCompositorOrigins[i]); |
| 309 #endif | 310 #endif |
| 310 #if defined(ENABLE_PRINTING) | 311 #if BUILDFLAG(ENABLE_PRINTING) |
| 311 printing::SetAgent(GetUserAgent()); | 312 printing::SetAgent(GetUserAgent()); |
| 312 #endif | 313 #endif |
| 313 } | 314 } |
| 314 | 315 |
| 315 ChromeContentRendererClient::~ChromeContentRendererClient() { | 316 ChromeContentRendererClient::~ChromeContentRendererClient() { |
| 316 } | 317 } |
| 317 | 318 |
| 318 void ChromeContentRendererClient::RenderThreadStarted() { | 319 void ChromeContentRendererClient::RenderThreadStarted() { |
| 319 RenderThread* thread = RenderThread::Get(); | 320 RenderThread* thread = RenderThread::Get(); |
| 320 | 321 |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 404 // chrome-search: pages should not be accessible by bookmarklets | 405 // chrome-search: pages should not be accessible by bookmarklets |
| 405 // or javascript: URLs typed in the omnibox. | 406 // or javascript: URLs typed in the omnibox. |
| 406 WebSecurityPolicy::registerURLSchemeAsNotAllowingJavascriptURLs( | 407 WebSecurityPolicy::registerURLSchemeAsNotAllowingJavascriptURLs( |
| 407 chrome_search_scheme); | 408 chrome_search_scheme); |
| 408 | 409 |
| 409 // chrome-search: resources shouldn't trigger insecure content warnings. Note | 410 // chrome-search: resources shouldn't trigger insecure content warnings. Note |
| 410 // that chrome-extension: and chrome-extension-resource: schemes are taken | 411 // that chrome-extension: and chrome-extension-resource: schemes are taken |
| 411 // care of in extensions::Dispatcher. | 412 // care of in extensions::Dispatcher. |
| 412 WebSecurityPolicy::registerURLSchemeAsSecure(chrome_search_scheme); | 413 WebSecurityPolicy::registerURLSchemeAsSecure(chrome_search_scheme); |
| 413 | 414 |
| 414 #if defined(ENABLE_PRINT_PREVIEW) | 415 #if BUILDFLAG(ENABLE_PRINT_PREVIEW) |
| 415 pdf_print_client_.reset(new ChromePDFPrintClient()); | 416 pdf_print_client_.reset(new ChromePDFPrintClient()); |
| 416 pdf::PepperPDFHost::SetPrintClient(pdf_print_client_.get()); | 417 pdf::PepperPDFHost::SetPrintClient(pdf_print_client_.get()); |
| 417 #endif | 418 #endif |
| 418 | 419 |
| 419 std::set<GURL> origins; | 420 std::set<GURL> origins; |
| 420 GetSecureOriginWhitelist(&origins); | 421 GetSecureOriginWhitelist(&origins); |
| 421 for (const GURL& origin : origins) { | 422 for (const GURL& origin : origins) { |
| 422 WebSecurityPolicy::addOriginTrustworthyWhiteList( | 423 WebSecurityPolicy::addOriginTrustworthyWhiteList( |
| 423 WebSecurityOrigin::create(origin)); | 424 WebSecurityOrigin::create(origin)); |
| 424 } | 425 } |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 516 new subresource_filter::SubresourceFilterAgent( | 517 new subresource_filter::SubresourceFilterAgent( |
| 517 render_frame, subresource_filter_ruleset_dealer_.get()); | 518 render_frame, subresource_filter_ruleset_dealer_.get()); |
| 518 } | 519 } |
| 519 } | 520 } |
| 520 | 521 |
| 521 void ChromeContentRendererClient::RenderViewCreated( | 522 void ChromeContentRendererClient::RenderViewCreated( |
| 522 content::RenderView* render_view) { | 523 content::RenderView* render_view) { |
| 523 #if defined(ENABLE_EXTENSIONS) | 524 #if defined(ENABLE_EXTENSIONS) |
| 524 ChromeExtensionsRendererClient::GetInstance()->RenderViewCreated(render_view); | 525 ChromeExtensionsRendererClient::GetInstance()->RenderViewCreated(render_view); |
| 525 #endif | 526 #endif |
| 526 #if defined(ENABLE_PRINTING) | 527 #if BUILDFLAG(ENABLE_PRINTING) |
| 527 new printing::PrintWebViewHelper( | 528 new printing::PrintWebViewHelper( |
| 528 render_view, std::unique_ptr<printing::PrintWebViewHelper::Delegate>( | 529 render_view, std::unique_ptr<printing::PrintWebViewHelper::Delegate>( |
| 529 new ChromePrintWebViewHelperDelegate())); | 530 new ChromePrintWebViewHelperDelegate())); |
| 530 #endif | 531 #endif |
| 531 #if defined(ENABLE_SPELLCHECK) | 532 #if defined(ENABLE_SPELLCHECK) |
| 532 new SpellCheckProvider(render_view, spellcheck_.get()); | 533 new SpellCheckProvider(render_view, spellcheck_.get()); |
| 533 #endif | 534 #endif |
| 534 new prerender::PrerendererClient(render_view); | 535 new prerender::PrerendererClient(render_view); |
| 535 | 536 |
| 536 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); | 537 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); |
| (...skipping 941 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1478 | 1479 |
| 1479 url::Replacements<char> r; | 1480 url::Replacements<char> r; |
| 1480 r.SetPath(path.c_str(), url::Component(0, path.length())); | 1481 r.SetPath(path.c_str(), url::Component(0, path.length())); |
| 1481 | 1482 |
| 1482 if (result == internal::NUM_PLUGIN_ERROR) | 1483 if (result == internal::NUM_PLUGIN_ERROR) |
| 1483 result = invalid_url ? internal::SUCCESS_PARAMS_REWRITE : internal::SUCCESS; | 1484 result = invalid_url ? internal::SUCCESS_PARAMS_REWRITE : internal::SUCCESS; |
| 1484 | 1485 |
| 1485 RecordYouTubeRewriteUMA(result); | 1486 RecordYouTubeRewriteUMA(result); |
| 1486 return corrected_url.ReplaceComponents(r); | 1487 return corrected_url.ReplaceComponents(r); |
| 1487 } | 1488 } |
| OLD | NEW |