| 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 17 matching lines...) Expand all Loading... |
| 28 #include "chrome/common/crash_keys.h" | 28 #include "chrome/common/crash_keys.h" |
| 29 #include "chrome/common/pepper_permission_util.h" | 29 #include "chrome/common/pepper_permission_util.h" |
| 30 #include "chrome/common/prerender_types.h" | 30 #include "chrome/common/prerender_types.h" |
| 31 #include "chrome/common/render_messages.h" | 31 #include "chrome/common/render_messages.h" |
| 32 #include "chrome/common/secure_origin_whitelist.h" | 32 #include "chrome/common/secure_origin_whitelist.h" |
| 33 #include "chrome/common/url_constants.h" | 33 #include "chrome/common/url_constants.h" |
| 34 #include "chrome/grit/generated_resources.h" | 34 #include "chrome/grit/generated_resources.h" |
| 35 #include "chrome/grit/locale_settings.h" | 35 #include "chrome/grit/locale_settings.h" |
| 36 #include "chrome/grit/renderer_resources.h" | 36 #include "chrome/grit/renderer_resources.h" |
| 37 #include "chrome/renderer/app_categorizer.h" | 37 #include "chrome/renderer/app_categorizer.h" |
| 38 #include "chrome/renderer/banners/app_banner_client.h" | |
| 39 #include "chrome/renderer/benchmarking_extension.h" | 38 #include "chrome/renderer/benchmarking_extension.h" |
| 40 #include "chrome/renderer/chrome_render_frame_observer.h" | 39 #include "chrome/renderer/chrome_render_frame_observer.h" |
| 41 #include "chrome/renderer/chrome_render_thread_observer.h" | 40 #include "chrome/renderer/chrome_render_thread_observer.h" |
| 42 #include "chrome/renderer/chrome_render_view_observer.h" | 41 #include "chrome/renderer/chrome_render_view_observer.h" |
| 43 #include "chrome/renderer/content_settings_observer.h" | 42 #include "chrome/renderer/content_settings_observer.h" |
| 44 #include "chrome/renderer/loadtimes_extension_bindings.h" | 43 #include "chrome/renderer/loadtimes_extension_bindings.h" |
| 45 #include "chrome/renderer/media/chrome_key_systems.h" | 44 #include "chrome/renderer/media/chrome_key_systems.h" |
| 46 #include "chrome/renderer/net/net_error_helper.h" | 45 #include "chrome/renderer/net/net_error_helper.h" |
| 47 #include "chrome/renderer/net_benchmarking_extension.h" | 46 #include "chrome/renderer/net_benchmarking_extension.h" |
| 48 #include "chrome/renderer/page_load_histograms.h" | 47 #include "chrome/renderer/page_load_histograms.h" |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 #include "content/public/renderer/render_frame.h" | 89 #include "content/public/renderer/render_frame.h" |
| 91 #include "content/public/renderer/render_thread.h" | 90 #include "content/public/renderer/render_thread.h" |
| 92 #include "content/public/renderer/render_view.h" | 91 #include "content/public/renderer/render_view.h" |
| 93 #include "content/public/renderer/render_view_visitor.h" | 92 #include "content/public/renderer/render_view_visitor.h" |
| 94 #include "extensions/common/constants.h" | 93 #include "extensions/common/constants.h" |
| 95 #include "ipc/ipc_sync_channel.h" | 94 #include "ipc/ipc_sync_channel.h" |
| 96 #include "net/base/net_errors.h" | 95 #include "net/base/net_errors.h" |
| 97 #include "ppapi/c/private/ppb_pdf.h" | 96 #include "ppapi/c/private/ppb_pdf.h" |
| 98 #include "ppapi/shared_impl/ppapi_switches.h" | 97 #include "ppapi/shared_impl/ppapi_switches.h" |
| 99 #include "services/shell/public/cpp/interface_provider.h" | 98 #include "services/shell/public/cpp/interface_provider.h" |
| 99 #include "services/shell/public/cpp/interface_registry.h" |
| 100 #include "third_party/WebKit/public/platform/URLConversion.h" | 100 #include "third_party/WebKit/public/platform/URLConversion.h" |
| 101 #include "third_party/WebKit/public/platform/WebCachePolicy.h" | 101 #include "third_party/WebKit/public/platform/WebCachePolicy.h" |
| 102 #include "third_party/WebKit/public/platform/WebSecurityOrigin.h" | 102 #include "third_party/WebKit/public/platform/WebSecurityOrigin.h" |
| 103 #include "third_party/WebKit/public/platform/WebURL.h" | 103 #include "third_party/WebKit/public/platform/WebURL.h" |
| 104 #include "third_party/WebKit/public/platform/WebURLError.h" | 104 #include "third_party/WebKit/public/platform/WebURLError.h" |
| 105 #include "third_party/WebKit/public/platform/WebURLRequest.h" | 105 #include "third_party/WebKit/public/platform/WebURLRequest.h" |
| 106 #include "third_party/WebKit/public/platform/WebURLResponse.h" | 106 #include "third_party/WebKit/public/platform/WebURLResponse.h" |
| 107 #include "third_party/WebKit/public/web/WebCache.h" | 107 #include "third_party/WebKit/public/web/WebCache.h" |
| 108 #include "third_party/WebKit/public/web/WebDataSource.h" | 108 #include "third_party/WebKit/public/web/WebDataSource.h" |
| 109 #include "third_party/WebKit/public/web/WebDocument.h" | 109 #include "third_party/WebKit/public/web/WebDocument.h" |
| (...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 427 } | 427 } |
| 428 | 428 |
| 429 #if defined(OS_CHROMEOS) | 429 #if defined(OS_CHROMEOS) |
| 430 leak_detector_remote_client_.reset(new LeakDetectorRemoteClient()); | 430 leak_detector_remote_client_.reset(new LeakDetectorRemoteClient()); |
| 431 thread->AddObserver(leak_detector_remote_client_.get()); | 431 thread->AddObserver(leak_detector_remote_client_.get()); |
| 432 #endif | 432 #endif |
| 433 } | 433 } |
| 434 | 434 |
| 435 void ChromeContentRendererClient::RenderFrameCreated( | 435 void ChromeContentRendererClient::RenderFrameCreated( |
| 436 content::RenderFrame* render_frame) { | 436 content::RenderFrame* render_frame) { |
| 437 new ChromeRenderFrameObserver(render_frame); | 437 ChromeRenderFrameObserver* observer = |
| 438 new ChromeRenderFrameObserver(render_frame); |
| 439 |
| 440 render_frame->GetInterfaceRegistry()->AddInterface( |
| 441 base::Bind(&ChromeRenderFrameObserver::BindBannerClient, |
| 442 base::Unretained(observer))); |
| 438 | 443 |
| 439 bool should_whitelist_for_content_settings = | 444 bool should_whitelist_for_content_settings = |
| 440 base::CommandLine::ForCurrentProcess()->HasSwitch( | 445 base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 441 switches::kInstantProcess); | 446 switches::kInstantProcess); |
| 442 extensions::Dispatcher* ext_dispatcher = NULL; | 447 extensions::Dispatcher* ext_dispatcher = NULL; |
| 443 #if defined(ENABLE_EXTENSIONS) | 448 #if defined(ENABLE_EXTENSIONS) |
| 444 ext_dispatcher = | 449 ext_dispatcher = |
| 445 ChromeExtensionsRendererClient::GetInstance()->extension_dispatcher(); | 450 ChromeExtensionsRendererClient::GetInstance()->extension_dispatcher(); |
| 446 #endif | 451 #endif |
| 447 ContentSettingsObserver* content_settings = new ContentSettingsObserver( | 452 ContentSettingsObserver* content_settings = new ContentSettingsObserver( |
| (...skipping 881 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1329 void ChromeContentRendererClient::RecordRappor(const std::string& metric, | 1334 void ChromeContentRendererClient::RecordRappor(const std::string& metric, |
| 1330 const std::string& sample) { | 1335 const std::string& sample) { |
| 1331 RenderThread::Get()->Send(new ChromeViewHostMsg_RecordRappor(metric, sample)); | 1336 RenderThread::Get()->Send(new ChromeViewHostMsg_RecordRappor(metric, sample)); |
| 1332 } | 1337 } |
| 1333 | 1338 |
| 1334 void ChromeContentRendererClient::RecordRapporURL(const std::string& metric, | 1339 void ChromeContentRendererClient::RecordRapporURL(const std::string& metric, |
| 1335 const GURL& url) { | 1340 const GURL& url) { |
| 1336 RenderThread::Get()->Send(new ChromeViewHostMsg_RecordRapporURL(metric, url)); | 1341 RenderThread::Get()->Send(new ChromeViewHostMsg_RecordRapporURL(metric, url)); |
| 1337 } | 1342 } |
| 1338 | 1343 |
| 1339 std::unique_ptr<blink::WebAppBannerClient> | |
| 1340 ChromeContentRendererClient::CreateAppBannerClient( | |
| 1341 content::RenderFrame* render_frame) { | |
| 1342 return std::unique_ptr<blink::WebAppBannerClient>( | |
| 1343 new AppBannerClient(render_frame)); | |
| 1344 } | |
| 1345 | |
| 1346 void ChromeContentRendererClient::AddImageContextMenuProperties( | 1344 void ChromeContentRendererClient::AddImageContextMenuProperties( |
| 1347 const WebURLResponse& response, | 1345 const WebURLResponse& response, |
| 1348 std::map<std::string, std::string>* properties) { | 1346 std::map<std::string, std::string>* properties) { |
| 1349 DCHECK(properties); | 1347 DCHECK(properties); |
| 1350 WebString header_key(ASCIIToUTF16( | 1348 WebString header_key(ASCIIToUTF16( |
| 1351 data_reduction_proxy::chrome_proxy_header())); | 1349 data_reduction_proxy::chrome_proxy_header())); |
| 1352 if (!response.httpHeaderField(header_key).isNull() && | 1350 if (!response.httpHeaderField(header_key).isNull() && |
| 1353 response.httpHeaderField(header_key).utf8().find( | 1351 response.httpHeaderField(header_key).utf8().find( |
| 1354 data_reduction_proxy::chrome_proxy_lo_fi_directive()) != | 1352 data_reduction_proxy::chrome_proxy_lo_fi_directive()) != |
| 1355 std::string::npos) { | 1353 std::string::npos) { |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1470 | 1468 |
| 1471 url::Replacements<char> r; | 1469 url::Replacements<char> r; |
| 1472 r.SetPath(path.c_str(), url::Component(0, path.length())); | 1470 r.SetPath(path.c_str(), url::Component(0, path.length())); |
| 1473 | 1471 |
| 1474 if (result == internal::NUM_PLUGIN_ERROR) | 1472 if (result == internal::NUM_PLUGIN_ERROR) |
| 1475 result = invalid_url ? internal::SUCCESS_PARAMS_REWRITE : internal::SUCCESS; | 1473 result = invalid_url ? internal::SUCCESS_PARAMS_REWRITE : internal::SUCCESS; |
| 1476 | 1474 |
| 1477 RecordYouTubeRewriteUMA(result); | 1475 RecordYouTubeRewriteUMA(result); |
| 1478 return corrected_url.ReplaceComponents(r); | 1476 return corrected_url.ReplaceComponents(r); |
| 1479 } | 1477 } |
| OLD | NEW |