| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/plugins/shadow_dom_plugin_placeholder.h" | 5 #include "chrome/renderer/plugins/shadow_dom_plugin_placeholder.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "chrome/common/chrome_switches.h" | 8 #include "chrome/common/chrome_switches.h" |
| 9 #include "chrome/common/render_messages.h" | 9 #include "chrome/common/render_messages.h" |
| 10 #include "chrome/grit/generated_resources.h" | 10 #include "chrome/grit/generated_resources.h" |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 | 35 |
| 36 scoped_ptr<blink::WebPluginPlaceholder> CreateShadowDOMPlaceholderForPluginInfo( | 36 scoped_ptr<blink::WebPluginPlaceholder> CreateShadowDOMPlaceholderForPluginInfo( |
| 37 content::RenderFrame* render_frame, | 37 content::RenderFrame* render_frame, |
| 38 blink::WebLocalFrame* frame, | 38 blink::WebLocalFrame* frame, |
| 39 const blink::WebPluginParams& orig_params) { | 39 const blink::WebPluginParams& orig_params) { |
| 40 using Status = ChromeViewHostMsg_GetPluginInfo_Status; | 40 using Status = ChromeViewHostMsg_GetPluginInfo_Status; |
| 41 | 41 |
| 42 if (!ShadowDOMPluginPlaceholderEnabled()) | 42 if (!ShadowDOMPluginPlaceholderEnabled()) |
| 43 return nullptr; | 43 return nullptr; |
| 44 | 44 |
| 45 blink::WebSecurityOrigin top_level_origin = frame->top()->securityOrigin(); |
| 46 DCHECK(!top_level_origin.isNull()); |
| 45 std::string orig_mime_type = orig_params.mimeType.utf8(); | 47 std::string orig_mime_type = orig_params.mimeType.utf8(); |
| 46 // TODO(jbroman): Investigate whether browser plugin needs special handling. | 48 // TODO(jbroman): Investigate whether browser plugin needs special handling. |
| 47 ChromeViewHostMsg_GetPluginInfo_Output output; | 49 ChromeViewHostMsg_GetPluginInfo_Output output; |
| 48 #if defined(ENABLE_PLUGINS) | 50 #if defined(ENABLE_PLUGINS) |
| 49 render_frame->Send( | 51 render_frame->Send( |
| 50 new ChromeViewHostMsg_GetPluginInfo(render_frame->GetRoutingID(), | 52 new ChromeViewHostMsg_GetPluginInfo(render_frame->GetRoutingID(), |
| 51 GURL(orig_params.url), | 53 GURL(orig_params.url), |
| 52 frame->top()->document().url(), | 54 GURL(top_level_origin.toString()), |
| 53 orig_mime_type, | 55 orig_mime_type, |
| 54 &output)); | 56 &output)); |
| 55 #else | 57 #else |
| 56 output.status.value = Status::kNotFound; | 58 output.status.value = Status::kNotFound; |
| 57 #endif | 59 #endif |
| 58 | 60 |
| 59 if (output.status.value == Status::kNotFound) { | 61 if (output.status.value == Status::kNotFound) { |
| 60 // TODO(jbroman): Handle YouTube specially here, as in | 62 // TODO(jbroman): Handle YouTube specially here, as in |
| 61 // ChromeContentRendererClient::CreatePlugin. | 63 // ChromeContentRendererClient::CreatePlugin. |
| 62 PluginUMAReporter::GetInstance()->ReportPluginMissing(orig_mime_type, | 64 PluginUMAReporter::GetInstance()->ReportPluginMissing(orig_mime_type, |
| 63 orig_params.url); | 65 orig_params.url); |
| 64 return CreateShadowDOMPlaceholderForMissingPlugin(); | 66 return CreateShadowDOMPlaceholderForMissingPlugin(); |
| 65 } | 67 } |
| 66 | 68 |
| 67 return nullptr; | 69 return nullptr; |
| 68 } | 70 } |
| 69 | 71 |
| 70 scoped_ptr<blink::WebPluginPlaceholder> | 72 scoped_ptr<blink::WebPluginPlaceholder> |
| 71 CreateShadowDOMPlaceholderForMissingPlugin() { | 73 CreateShadowDOMPlaceholderForMissingPlugin() { |
| 72 return make_scoped_ptr(new MissingPluginPlaceholder); | 74 return make_scoped_ptr(new MissingPluginPlaceholder); |
| 73 } | 75 } |
| OLD | NEW |