| 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/chrome_plugin_placeholder.h" | 5 #include "chrome/renderer/plugins/chrome_plugin_placeholder.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 21 matching lines...) Expand all Loading... |
| 32 #include "third_party/WebKit/public/platform/URLConversion.h" | 32 #include "third_party/WebKit/public/platform/URLConversion.h" |
| 33 #include "third_party/WebKit/public/web/WebDocument.h" | 33 #include "third_party/WebKit/public/web/WebDocument.h" |
| 34 #include "third_party/WebKit/public/web/WebInputEvent.h" | 34 #include "third_party/WebKit/public/web/WebInputEvent.h" |
| 35 #include "third_party/WebKit/public/web/WebLocalFrame.h" | 35 #include "third_party/WebKit/public/web/WebLocalFrame.h" |
| 36 #include "third_party/WebKit/public/web/WebScriptSource.h" | 36 #include "third_party/WebKit/public/web/WebScriptSource.h" |
| 37 #include "third_party/WebKit/public/web/WebView.h" | 37 #include "third_party/WebKit/public/web/WebView.h" |
| 38 #include "ui/base/l10n/l10n_util.h" | 38 #include "ui/base/l10n/l10n_util.h" |
| 39 #include "ui/base/resource/resource_bundle.h" | 39 #include "ui/base/resource/resource_bundle.h" |
| 40 #include "ui/base/webui/jstemplate_builder.h" | 40 #include "ui/base/webui/jstemplate_builder.h" |
| 41 #include "ui/gfx/geometry/size.h" | 41 #include "ui/gfx/geometry/size.h" |
| 42 #include "url/origin.h" |
| 42 #include "url/url_util.h" | 43 #include "url/url_util.h" |
| 43 | 44 |
| 44 using base::UserMetricsAction; | 45 using base::UserMetricsAction; |
| 45 using content::RenderThread; | 46 using content::RenderThread; |
| 46 using content::RenderView; | 47 using content::RenderView; |
| 47 | 48 |
| 48 namespace { | 49 namespace { |
| 49 const ChromePluginPlaceholder* g_last_active_menu = NULL; | 50 const ChromePluginPlaceholder* g_last_active_menu = NULL; |
| 50 } // namespace | 51 } // namespace |
| 51 | 52 |
| (...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 283 prerender::PrerenderMode mode) { | 284 prerender::PrerenderMode mode) { |
| 284 OnSetIsPrerendering(mode != prerender::NO_PRERENDER); | 285 OnSetIsPrerendering(mode != prerender::NO_PRERENDER); |
| 285 } | 286 } |
| 286 | 287 |
| 287 void ChromePluginPlaceholder::PluginListChanged() { | 288 void ChromePluginPlaceholder::PluginListChanged() { |
| 288 if (!GetFrame() || !plugin()) | 289 if (!GetFrame() || !plugin()) |
| 289 return; | 290 return; |
| 290 | 291 |
| 291 ChromeViewHostMsg_GetPluginInfo_Output output; | 292 ChromeViewHostMsg_GetPluginInfo_Output output; |
| 292 std::string mime_type(GetPluginParams().mimeType.utf8()); | 293 std::string mime_type(GetPluginParams().mimeType.utf8()); |
| 293 blink::WebString top_origin = | 294 const url::Origin& top_origin(GetFrame()->top()->getSecurityOrigin()); |
| 294 GetFrame()->top()->getSecurityOrigin().toString(); | 295 render_frame()->Send(new ChromeViewHostMsg_GetPluginInfo( |
| 295 render_frame()->Send( | 296 routing_id(), GURL(GetPluginParams().url), top_origin.GetURL(), mime_type, |
| 296 new ChromeViewHostMsg_GetPluginInfo(routing_id(), | 297 &output)); |
| 297 GURL(GetPluginParams().url), | |
| 298 blink::WebStringToGURL(top_origin), | |
| 299 mime_type, | |
| 300 &output)); | |
| 301 if (output.status == status_) | 298 if (output.status == status_) |
| 302 return; | 299 return; |
| 303 blink::WebPlugin* new_plugin = ChromeContentRendererClient::CreatePlugin( | 300 blink::WebPlugin* new_plugin = ChromeContentRendererClient::CreatePlugin( |
| 304 render_frame(), GetFrame(), GetPluginParams(), output); | 301 render_frame(), GetFrame(), GetPluginParams(), output); |
| 305 ReplacePlugin(new_plugin); | 302 ReplacePlugin(new_plugin); |
| 306 if (!new_plugin) { | 303 if (!new_plugin) { |
| 307 PluginUMAReporter::GetInstance()->ReportPluginMissing( | 304 PluginUMAReporter::GetInstance()->ReportPluginMissing( |
| 308 GetPluginParams().mimeType.utf8(), GURL(GetPluginParams().url)); | 305 GetPluginParams().mimeType.utf8(), GURL(GetPluginParams().url)); |
| 309 } | 306 } |
| 310 } | 307 } |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 428 | 425 |
| 429 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 426 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 430 switches::kEnablePluginPlaceholderTesting)) { | 427 switches::kEnablePluginPlaceholderTesting)) { |
| 431 builder.SetMethod<void (ChromePluginPlaceholder::*)()>( | 428 builder.SetMethod<void (ChromePluginPlaceholder::*)()>( |
| 432 "didFinishIconRepositionForTesting", | 429 "didFinishIconRepositionForTesting", |
| 433 &ChromePluginPlaceholder::DidFinishIconRepositionForTestingCallback); | 430 &ChromePluginPlaceholder::DidFinishIconRepositionForTestingCallback); |
| 434 } | 431 } |
| 435 | 432 |
| 436 return builder; | 433 return builder; |
| 437 } | 434 } |
| OLD | NEW |