| 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 28 matching lines...) Expand all Loading... |
| 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 std::string orig_mime_type = orig_params.mimeType.utf8(); | 45 std::string orig_mime_type = orig_params.mimeType.utf8(); |
| 46 // TODO(jbroman): Investigate whether browser plugin needs special handling. | 46 // TODO(jbroman): Investigate whether browser plugin needs special handling. |
| 47 ChromeViewHostMsg_GetPluginInfo_Output output; | 47 ChromeViewHostMsg_GetPluginInfo_Output output; |
| 48 #if defined(ENABLE_PLUGINS) | 48 #if defined(ENABLE_PLUGINS) |
| 49 blink::WebString top_origin = frame->top()->securityOrigin().toString(); |
| 49 render_frame->Send( | 50 render_frame->Send( |
| 50 new ChromeViewHostMsg_GetPluginInfo(render_frame->GetRoutingID(), | 51 new ChromeViewHostMsg_GetPluginInfo(render_frame->GetRoutingID(), |
| 51 GURL(orig_params.url), | 52 GURL(orig_params.url), |
| 52 frame->top()->document().url(), | 53 GURL(top_origin), |
| 53 orig_mime_type, | 54 orig_mime_type, |
| 54 &output)); | 55 &output)); |
| 55 #else | 56 #else |
| 56 output.status = Status::kNotFound; | 57 output.status = Status::kNotFound; |
| 57 #endif | 58 #endif |
| 58 | 59 |
| 59 if (output.status == Status::kNotFound) { | 60 if (output.status == Status::kNotFound) { |
| 60 // TODO(jbroman): Handle YouTube specially here, as in | 61 // TODO(jbroman): Handle YouTube specially here, as in |
| 61 // ChromeContentRendererClient::CreatePlugin. | 62 // ChromeContentRendererClient::CreatePlugin. |
| 62 PluginUMAReporter::GetInstance()->ReportPluginMissing(orig_mime_type, | 63 PluginUMAReporter::GetInstance()->ReportPluginMissing(orig_mime_type, |
| 63 orig_params.url); | 64 orig_params.url); |
| 64 return CreateShadowDOMPlaceholderForMissingPlugin(); | 65 return CreateShadowDOMPlaceholderForMissingPlugin(); |
| 65 } | 66 } |
| 66 | 67 |
| 67 return nullptr; | 68 return nullptr; |
| 68 } | 69 } |
| 69 | 70 |
| 70 scoped_ptr<blink::WebPluginPlaceholder> | 71 scoped_ptr<blink::WebPluginPlaceholder> |
| 71 CreateShadowDOMPlaceholderForMissingPlugin() { | 72 CreateShadowDOMPlaceholderForMissingPlugin() { |
| 72 return make_scoped_ptr(new MissingPluginPlaceholder); | 73 return make_scoped_ptr(new MissingPluginPlaceholder); |
| 73 } | 74 } |
| OLD | NEW |