Chromium Code Reviews| 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 "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/debug/crash_logging.h" | 8 #include "base/debug/crash_logging.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/metrics/field_trial.h" | 10 #include "base/metrics/field_trial.h" |
| (...skipping 27 matching lines...) Expand all Loading... | |
| 38 #include "chrome/renderer/media/chrome_key_systems.h" | 38 #include "chrome/renderer/media/chrome_key_systems.h" |
| 39 #include "chrome/renderer/net/net_error_helper.h" | 39 #include "chrome/renderer/net/net_error_helper.h" |
| 40 #include "chrome/renderer/net/prescient_networking_dispatcher.h" | 40 #include "chrome/renderer/net/prescient_networking_dispatcher.h" |
| 41 #include "chrome/renderer/net/renderer_net_predictor.h" | 41 #include "chrome/renderer/net/renderer_net_predictor.h" |
| 42 #include "chrome/renderer/net_benchmarking_extension.h" | 42 #include "chrome/renderer/net_benchmarking_extension.h" |
| 43 #include "chrome/renderer/page_load_histograms.h" | 43 #include "chrome/renderer/page_load_histograms.h" |
| 44 #include "chrome/renderer/pepper/pepper_helper.h" | 44 #include "chrome/renderer/pepper/pepper_helper.h" |
| 45 #include "chrome/renderer/playback_extension.h" | 45 #include "chrome/renderer/playback_extension.h" |
| 46 #include "chrome/renderer/plugins/chrome_plugin_placeholder.h" | 46 #include "chrome/renderer/plugins/chrome_plugin_placeholder.h" |
| 47 #include "chrome/renderer/plugins/plugin_uma.h" | 47 #include "chrome/renderer/plugins/plugin_uma.h" |
| 48 #include "chrome/renderer/plugins/shadow_dom_plugin_placeholder.h" | |
| 48 #include "chrome/renderer/prefetch_helper.h" | 49 #include "chrome/renderer/prefetch_helper.h" |
| 49 #include "chrome/renderer/prerender/prerender_dispatcher.h" | 50 #include "chrome/renderer/prerender/prerender_dispatcher.h" |
| 50 #include "chrome/renderer/prerender/prerender_helper.h" | 51 #include "chrome/renderer/prerender/prerender_helper.h" |
| 51 #include "chrome/renderer/prerender/prerender_media_load_deferrer.h" | 52 #include "chrome/renderer/prerender/prerender_media_load_deferrer.h" |
| 52 #include "chrome/renderer/prerender/prerenderer_client.h" | 53 #include "chrome/renderer/prerender/prerenderer_client.h" |
| 53 #include "chrome/renderer/principals_extension_bindings.h" | 54 #include "chrome/renderer/principals_extension_bindings.h" |
| 54 #include "chrome/renderer/printing/print_web_view_helper.h" | 55 #include "chrome/renderer/printing/print_web_view_helper.h" |
| 55 #include "chrome/renderer/safe_browsing/malware_dom_details.h" | 56 #include "chrome/renderer/safe_browsing/malware_dom_details.h" |
| 56 #include "chrome/renderer/safe_browsing/phishing_classifier_delegate.h" | 57 #include "chrome/renderer/safe_browsing/phishing_classifier_delegate.h" |
| 57 #include "chrome/renderer/searchbox/search_bouncer.h" | 58 #include "chrome/renderer/searchbox/search_bouncer.h" |
| (...skipping 27 matching lines...) Expand all Loading... | |
| 85 #include "third_party/WebKit/public/platform/WebURL.h" | 86 #include "third_party/WebKit/public/platform/WebURL.h" |
| 86 #include "third_party/WebKit/public/platform/WebURLError.h" | 87 #include "third_party/WebKit/public/platform/WebURLError.h" |
| 87 #include "third_party/WebKit/public/platform/WebURLRequest.h" | 88 #include "third_party/WebKit/public/platform/WebURLRequest.h" |
| 88 #include "third_party/WebKit/public/web/WebCache.h" | 89 #include "third_party/WebKit/public/web/WebCache.h" |
| 89 #include "third_party/WebKit/public/web/WebDataSource.h" | 90 #include "third_party/WebKit/public/web/WebDataSource.h" |
| 90 #include "third_party/WebKit/public/web/WebDocument.h" | 91 #include "third_party/WebKit/public/web/WebDocument.h" |
| 91 #include "third_party/WebKit/public/web/WebElement.h" | 92 #include "third_party/WebKit/public/web/WebElement.h" |
| 92 #include "third_party/WebKit/public/web/WebLocalFrame.h" | 93 #include "third_party/WebKit/public/web/WebLocalFrame.h" |
| 93 #include "third_party/WebKit/public/web/WebPluginContainer.h" | 94 #include "third_party/WebKit/public/web/WebPluginContainer.h" |
| 94 #include "third_party/WebKit/public/web/WebPluginParams.h" | 95 #include "third_party/WebKit/public/web/WebPluginParams.h" |
| 96 #include "third_party/WebKit/public/web/WebPluginPlaceholder.h" | |
| 95 #include "third_party/WebKit/public/web/WebSecurityOrigin.h" | 97 #include "third_party/WebKit/public/web/WebSecurityOrigin.h" |
| 96 #include "third_party/WebKit/public/web/WebSecurityPolicy.h" | 98 #include "third_party/WebKit/public/web/WebSecurityPolicy.h" |
| 97 #include "ui/base/l10n/l10n_util.h" | 99 #include "ui/base/l10n/l10n_util.h" |
| 98 #include "ui/base/layout.h" | 100 #include "ui/base/layout.h" |
| 99 #include "ui/base/resource/resource_bundle.h" | 101 #include "ui/base/resource/resource_bundle.h" |
| 100 #include "ui/base/webui/jstemplate_builder.h" | 102 #include "ui/base/webui/jstemplate_builder.h" |
| 101 #include "widevine_cdm_version.h" // In SHARED_INTERMEDIATE_DIR. | 103 #include "widevine_cdm_version.h" // In SHARED_INTERMEDIATE_DIR. |
| 102 | 104 |
| 103 #if !defined(DISABLE_NACL) | 105 #if !defined(DISABLE_NACL) |
| 104 #include "components/nacl/common/nacl_constants.h" | 106 #include "components/nacl/common/nacl_constants.h" |
| (...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 540 const Extension* ChromeContentRendererClient::GetExtensionByOrigin( | 542 const Extension* ChromeContentRendererClient::GetExtensionByOrigin( |
| 541 const WebSecurityOrigin& origin) const { | 543 const WebSecurityOrigin& origin) const { |
| 542 if (!EqualsASCII(origin.protocol(), extensions::kExtensionScheme)) | 544 if (!EqualsASCII(origin.protocol(), extensions::kExtensionScheme)) |
| 543 return NULL; | 545 return NULL; |
| 544 | 546 |
| 545 const std::string extension_id = origin.host().utf8().data(); | 547 const std::string extension_id = origin.host().utf8().data(); |
| 546 return extension_dispatcher_->extensions()->GetByID(extension_id); | 548 return extension_dispatcher_->extensions()->GetByID(extension_id); |
| 547 } | 549 } |
| 548 #endif | 550 #endif |
| 549 | 551 |
| 552 blink::WebPluginPlaceholder* | |
| 553 ChromeContentRendererClient::OverrideCreatePluginPlaceholder( | |
| 554 content::RenderFrame* render_frame, | |
| 555 blink::WebLocalFrame* frame, | |
| 556 const blink::WebPluginParams& orig_params) { | |
| 557 using Status = ChromeViewHostMsg_GetPluginInfo_Status; | |
| 558 | |
| 559 if (!ShadowDOMPluginPlaceholderEnabled()) | |
| 560 return nullptr; | |
| 561 | |
| 562 std::string orig_mime_type = orig_params.mimeType.utf8(); | |
| 563 // TODO(jbroman): Investigate whether browser plugin needs special handling. | |
| 564 ChromeViewHostMsg_GetPluginInfo_Output output; | |
| 565 #if defined(ENABLE_PLUGINS) | |
| 566 render_frame->Send( | |
| 567 new ChromeViewHostMsg_GetPluginInfo(render_frame->GetRoutingID(), | |
| 568 GURL(orig_params.url), | |
| 569 frame->top()->document().url(), | |
| 570 orig_mime_type, | |
| 571 &output)); | |
| 572 #else | |
| 573 output.status.value = Status::kNotFound; | |
| 574 #endif | |
| 575 | |
| 576 Status::Value status = output.status.value; | |
| 577 if (status == Status::kNotFound) { | |
| 578 // TODO(jbroman): Handle YouTube specially here, as in CreatePlugin. | |
| 579 PluginUMAReporter::GetInstance()->ReportPluginMissing(orig_mime_type, | |
| 580 orig_params.url); | |
| 581 return CreateShadowDOMPlaceholderForMissingPlugin().release(); | |
|
Bernhard Bauer
2014/10/29 09:53:05
Urr... if this method passes ownership of its retu
jbroman
2014/10/29 17:14:43
It wasn't clear to me when it should be released f
| |
| 582 } | |
| 583 | |
| 584 return nullptr; | |
| 585 } | |
| 586 | |
| 550 bool ChromeContentRendererClient::OverrideCreatePlugin( | 587 bool ChromeContentRendererClient::OverrideCreatePlugin( |
| 551 content::RenderFrame* render_frame, | 588 content::RenderFrame* render_frame, |
| 552 WebLocalFrame* frame, | 589 WebLocalFrame* frame, |
| 553 const WebPluginParams& params, | 590 const WebPluginParams& params, |
| 554 WebPlugin** plugin) { | 591 WebPlugin** plugin) { |
| 555 std::string orig_mime_type = params.mimeType.utf8(); | 592 std::string orig_mime_type = params.mimeType.utf8(); |
| 556 #if defined(ENABLE_EXTENSIONS) | 593 #if defined(ENABLE_EXTENSIONS) |
| 557 if (orig_mime_type == content::kBrowserPluginMimeType) { | 594 if (orig_mime_type == content::kBrowserPluginMimeType) { |
| 558 bool guest_view_api_available = false; | 595 bool guest_view_api_available = false; |
| 559 extension_dispatcher_->script_context_set().ForEach( | 596 extension_dispatcher_->script_context_set().ForEach( |
| (...skipping 1025 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1585 content::BrowserPluginDelegate* | 1622 content::BrowserPluginDelegate* |
| 1586 ChromeContentRendererClient::CreateBrowserPluginDelegate( | 1623 ChromeContentRendererClient::CreateBrowserPluginDelegate( |
| 1587 content::RenderFrame* render_frame, | 1624 content::RenderFrame* render_frame, |
| 1588 const std::string& mime_type) { | 1625 const std::string& mime_type) { |
| 1589 #if defined(ENABLE_EXTENSIONS) | 1626 #if defined(ENABLE_EXTENSIONS) |
| 1590 return new extensions::GuestViewContainer(render_frame, mime_type); | 1627 return new extensions::GuestViewContainer(render_frame, mime_type); |
| 1591 #else | 1628 #else |
| 1592 return NULL; | 1629 return NULL; |
| 1593 #endif | 1630 #endif |
| 1594 } | 1631 } |
| OLD | NEW |