| 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 "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
| 8 #include "base/values.h" | 8 #include "base/values.h" |
| 9 #include "chrome/common/prerender_messages.h" | 9 #include "chrome/common/prerender_messages.h" |
| 10 #include "chrome/common/render_messages.h" | 10 #include "chrome/common/render_messages.h" |
| (...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 274 | 274 |
| 275 void ChromePluginPlaceholder::OnCancelledDownloadingPlugin() { | 275 void ChromePluginPlaceholder::OnCancelledDownloadingPlugin() { |
| 276 SetMessage( | 276 SetMessage( |
| 277 l10n_util::GetStringFUTF16(IDS_PLUGIN_DOWNLOAD_CANCELLED, plugin_name_)); | 277 l10n_util::GetStringFUTF16(IDS_PLUGIN_DOWNLOAD_CANCELLED, plugin_name_)); |
| 278 } | 278 } |
| 279 #endif // defined(ENABLE_PLUGIN_INSTALLATION) | 279 #endif // defined(ENABLE_PLUGIN_INSTALLATION) |
| 280 | 280 |
| 281 void ChromePluginPlaceholder::PluginListChanged() { | 281 void ChromePluginPlaceholder::PluginListChanged() { |
| 282 if (!GetFrame() || !plugin()) | 282 if (!GetFrame() || !plugin()) |
| 283 return; | 283 return; |
| 284 WebDocument document = GetFrame()->top()->document(); | 284 blink::WebSecurityOrigin top_level_origin = |
| 285 if (document.isNull()) | 285 GetFrame()->top()->securityOrigin(); |
| 286 if (top_level_origin.isNull()) |
| 286 return; | 287 return; |
| 287 | 288 |
| 288 ChromeViewHostMsg_GetPluginInfo_Output output; | 289 ChromeViewHostMsg_GetPluginInfo_Output output; |
| 289 std::string mime_type(GetPluginParams().mimeType.utf8()); | 290 std::string mime_type(GetPluginParams().mimeType.utf8()); |
| 290 render_frame()->Send( | 291 render_frame()->Send( |
| 291 new ChromeViewHostMsg_GetPluginInfo(routing_id(), | 292 new ChromeViewHostMsg_GetPluginInfo(routing_id(), |
| 292 GURL(GetPluginParams().url), | 293 GURL(GetPluginParams().url), |
| 293 document.url(), | 294 GURL(top_level_origin.toString()), |
| 294 mime_type, | 295 mime_type, |
| 295 &output)); | 296 &output)); |
| 296 if (output.status.value == status_->value) | 297 if (output.status.value == status_->value) |
| 297 return; | 298 return; |
| 298 WebPlugin* new_plugin = ChromeContentRendererClient::CreatePlugin( | 299 WebPlugin* new_plugin = ChromeContentRendererClient::CreatePlugin( |
| 299 render_frame(), GetFrame(), GetPluginParams(), output); | 300 render_frame(), GetFrame(), GetPluginParams(), output); |
| 300 ReplacePlugin(new_plugin); | 301 ReplacePlugin(new_plugin); |
| 301 if (!new_plugin) { | 302 if (!new_plugin) { |
| 302 PluginUMAReporter::GetInstance()->ReportPluginMissing( | 303 PluginUMAReporter::GetInstance()->ReportPluginMissing( |
| 303 GetPluginParams().mimeType.utf8(), GURL(GetPluginParams().url)); | 304 GetPluginParams().mimeType.utf8(), GURL(GetPluginParams().url)); |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 377 v8::Handle<v8::Object> global = context->Global(); | 378 v8::Handle<v8::Object> global = context->Global(); |
| 378 global->Set(gin::StringToV8(isolate, "plugin"), | 379 global->Set(gin::StringToV8(isolate, "plugin"), |
| 379 gin::CreateHandle(isolate, this).ToV8()); | 380 gin::CreateHandle(isolate, this).ToV8()); |
| 380 } | 381 } |
| 381 | 382 |
| 382 gin::ObjectTemplateBuilder ChromePluginPlaceholder::GetObjectTemplateBuilder( | 383 gin::ObjectTemplateBuilder ChromePluginPlaceholder::GetObjectTemplateBuilder( |
| 383 v8::Isolate* isolate) { | 384 v8::Isolate* isolate) { |
| 384 return PluginPlaceholder::GetObjectTemplateBuilder(isolate).SetMethod( | 385 return PluginPlaceholder::GetObjectTemplateBuilder(isolate).SetMethod( |
| 385 "openAboutPlugins", &ChromePluginPlaceholder::OpenAboutPluginsCallback); | 386 "openAboutPlugins", &ChromePluginPlaceholder::OpenAboutPluginsCallback); |
| 386 } | 387 } |
| OLD | NEW |