| 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 <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
| 11 #include "base/strings/utf_string_conversions.h" | 11 #include "base/strings/utf_string_conversions.h" |
| 12 #include "base/values.h" | 12 #include "base/values.h" |
| 13 #include "chrome/common/prerender_messages.h" | 13 #include "chrome/common/prerender_messages.h" |
| 14 #include "chrome/common/render_messages.h" | 14 #include "chrome/common/render_messages.h" |
| 15 #include "chrome/grit/generated_resources.h" | 15 #include "chrome/grit/generated_resources.h" |
| 16 #include "chrome/grit/renderer_resources.h" | 16 #include "chrome/grit/renderer_resources.h" |
| 17 #include "chrome/renderer/chrome_content_renderer_client.h" | 17 #include "chrome/renderer/chrome_content_renderer_client.h" |
| 18 #include "chrome/renderer/custom_menu_commands.h" | 18 #include "chrome/renderer/custom_menu_commands.h" |
| 19 #include "chrome/renderer/plugins/plugin_preroller.h" | 19 #include "chrome/renderer/plugins/plugin_preroller.h" |
| 20 #include "chrome/renderer/plugins/plugin_uma.h" | 20 #include "chrome/renderer/plugins/plugin_uma.h" |
| 21 #include "components/content_settings/content/common/content_settings_messages.h
" | 21 #include "components/content_settings/content/common/content_settings_messages.h
" |
| 22 #include "content/public/child/url_conversion.h" |
| 22 #include "content/public/common/content_switches.h" | 23 #include "content/public/common/content_switches.h" |
| 23 #include "content/public/common/context_menu_params.h" | 24 #include "content/public/common/context_menu_params.h" |
| 24 #include "content/public/renderer/render_frame.h" | 25 #include "content/public/renderer/render_frame.h" |
| 25 #include "content/public/renderer/render_thread.h" | 26 #include "content/public/renderer/render_thread.h" |
| 26 #include "gin/object_template_builder.h" | 27 #include "gin/object_template_builder.h" |
| 27 #include "third_party/WebKit/public/web/WebDocument.h" | 28 #include "third_party/WebKit/public/web/WebDocument.h" |
| 28 #include "third_party/WebKit/public/web/WebInputEvent.h" | 29 #include "third_party/WebKit/public/web/WebInputEvent.h" |
| 29 #include "third_party/WebKit/public/web/WebLocalFrame.h" | 30 #include "third_party/WebKit/public/web/WebLocalFrame.h" |
| 30 #include "third_party/WebKit/public/web/WebScriptSource.h" | 31 #include "third_party/WebKit/public/web/WebScriptSource.h" |
| 31 #include "third_party/WebKit/public/web/WebView.h" | 32 #include "third_party/WebKit/public/web/WebView.h" |
| (...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 255 blink::WebDocument document = GetFrame()->top()->document(); | 256 blink::WebDocument document = GetFrame()->top()->document(); |
| 256 if (document.isNull()) | 257 if (document.isNull()) |
| 257 return; | 258 return; |
| 258 | 259 |
| 259 ChromeViewHostMsg_GetPluginInfo_Output output; | 260 ChromeViewHostMsg_GetPluginInfo_Output output; |
| 260 std::string mime_type(GetPluginParams().mimeType.utf8()); | 261 std::string mime_type(GetPluginParams().mimeType.utf8()); |
| 261 blink::WebString top_origin = GetFrame()->top()->securityOrigin().toString(); | 262 blink::WebString top_origin = GetFrame()->top()->securityOrigin().toString(); |
| 262 render_frame()->Send( | 263 render_frame()->Send( |
| 263 new ChromeViewHostMsg_GetPluginInfo(routing_id(), | 264 new ChromeViewHostMsg_GetPluginInfo(routing_id(), |
| 264 GURL(GetPluginParams().url), | 265 GURL(GetPluginParams().url), |
| 265 GURL(top_origin), | 266 content::WebStringToGURL(top_origin), |
| 266 mime_type, | 267 mime_type, |
| 267 &output)); | 268 &output)); |
| 268 if (output.status == status_) | 269 if (output.status == status_) |
| 269 return; | 270 return; |
| 270 blink::WebPlugin* new_plugin = ChromeContentRendererClient::CreatePlugin( | 271 blink::WebPlugin* new_plugin = ChromeContentRendererClient::CreatePlugin( |
| 271 render_frame(), GetFrame(), GetPluginParams(), output); | 272 render_frame(), GetFrame(), GetPluginParams(), output); |
| 272 ReplacePlugin(new_plugin); | 273 ReplacePlugin(new_plugin); |
| 273 if (!new_plugin) { | 274 if (!new_plugin) { |
| 274 PluginUMAReporter::GetInstance()->ReportPluginMissing( | 275 PluginUMAReporter::GetInstance()->ReportPluginMissing( |
| 275 GetPluginParams().mimeType.utf8(), GURL(GetPluginParams().url)); | 276 GetPluginParams().mimeType.utf8(), GURL(GetPluginParams().url)); |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 382 | 383 |
| 383 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 384 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 384 switches::kEnablePluginPlaceholderTesting)) { | 385 switches::kEnablePluginPlaceholderTesting)) { |
| 385 builder.SetMethod<void (ChromePluginPlaceholder::*)()>( | 386 builder.SetMethod<void (ChromePluginPlaceholder::*)()>( |
| 386 "didFinishIconRepositionForTesting", | 387 "didFinishIconRepositionForTesting", |
| 387 &ChromePluginPlaceholder::DidFinishIconRepositionForTestingCallback); | 388 &ChromePluginPlaceholder::DidFinishIconRepositionForTestingCallback); |
| 388 } | 389 } |
| 389 | 390 |
| 390 return builder; | 391 return builder; |
| 391 } | 392 } |
| OLD | NEW |