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