OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/plugin_placeholder.h" | 5 #include "chrome/renderer/plugins/plugin_placeholder.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/json/string_escape.h" | 9 #include "base/json/string_escape.h" |
10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
(...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
442 if (document.isNull()) | 442 if (document.isNull()) |
443 return; | 443 return; |
444 | 444 |
445 ChromeViewHostMsg_GetPluginInfo_Output output; | 445 ChromeViewHostMsg_GetPluginInfo_Output output; |
446 std::string mime_type(plugin_params_.mimeType.utf8()); | 446 std::string mime_type(plugin_params_.mimeType.utf8()); |
447 render_view()->Send(new ChromeViewHostMsg_GetPluginInfo( | 447 render_view()->Send(new ChromeViewHostMsg_GetPluginInfo( |
448 routing_id(), GURL(plugin_params_.url), document.url(), | 448 routing_id(), GURL(plugin_params_.url), document.url(), |
449 mime_type, &output)); | 449 mime_type, &output)); |
450 if (output.status.value == status_->value) | 450 if (output.status.value == status_->value) |
451 return; | 451 return; |
452 chrome::ChromeContentRendererClient* client = | 452 WebPlugin* new_plugin = chrome::ChromeContentRendererClient::CreatePlugin( |
453 static_cast<chrome::ChromeContentRendererClient*>( | 453 render_view(), frame_, plugin_params_, output); |
454 content::GetContentClient()->renderer()); | |
455 WebPlugin* new_plugin = | |
456 client->CreatePlugin(render_view(), frame_, plugin_params_, output); | |
457 ReplacePlugin(new_plugin); | 454 ReplacePlugin(new_plugin); |
458 } | 455 } |
459 | 456 |
460 void PluginPlaceholder::OnMenuAction(int request_id, unsigned action) { | 457 void PluginPlaceholder::OnMenuAction(int request_id, unsigned action) { |
461 DCHECK_EQ(context_menu_request_id_, request_id); | 458 DCHECK_EQ(context_menu_request_id_, request_id); |
462 if (g_last_active_menu != this) | 459 if (g_last_active_menu != this) |
463 return; | 460 return; |
464 switch (action) { | 461 switch (action) { |
465 case chrome::MENU_COMMAND_PLUGIN_RUN: { | 462 case chrome::MENU_COMMAND_PLUGIN_RUN: { |
466 RenderThread::Get()->RecordUserMetrics("Plugin_Load_Menu"); | 463 RenderThread::Get()->RecordUserMetrics("Plugin_Load_Menu"); |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
638 bool PluginPlaceholder::IsYouTubeURL(const GURL& url, | 635 bool PluginPlaceholder::IsYouTubeURL(const GURL& url, |
639 const std::string& mime_type) { | 636 const std::string& mime_type) { |
640 std::string host = url.host(); | 637 std::string host = url.host(); |
641 bool is_youtube = EndsWith(host, "youtube.com", true) || | 638 bool is_youtube = EndsWith(host, "youtube.com", true) || |
642 EndsWith(host, "youtube-nocookie.com", true); | 639 EndsWith(host, "youtube-nocookie.com", true); |
643 | 640 |
644 return is_youtube && IsValidYouTubeVideo(url.path()) && | 641 return is_youtube && IsValidYouTubeVideo(url.path()) && |
645 LowerCaseEqualsASCII(mime_type, kFlashPluginSwfMimeType); | 642 LowerCaseEqualsASCII(mime_type, kFlashPluginSwfMimeType); |
646 } | 643 } |
647 #endif | 644 #endif |
OLD | NEW |