| 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_piece.h" | 10 #include "base/string_piece.h" |
| (...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 426 } | 426 } |
| 427 #endif // defined(ENABLE_PLUGIN_INSTALLATION) | 427 #endif // defined(ENABLE_PLUGIN_INSTALLATION) |
| 428 | 428 |
| 429 void PluginPlaceholder::PluginListChanged() { | 429 void PluginPlaceholder::PluginListChanged() { |
| 430 if (!frame_) | 430 if (!frame_) |
| 431 return; | 431 return; |
| 432 WebDocument document = frame_->top()->document(); | 432 WebDocument document = frame_->top()->document(); |
| 433 if (document.isNull()) | 433 if (document.isNull()) |
| 434 return; | 434 return; |
| 435 | 435 |
| 436 ChromeViewHostMsg_GetPluginInfo_Status status; | 436 ChromeViewHostMsg_GetPluginInfo_Output output; |
| 437 webkit::WebPluginInfo plugin_info; | |
| 438 std::string mime_type(plugin_params_.mimeType.utf8()); | 437 std::string mime_type(plugin_params_.mimeType.utf8()); |
| 439 std::string actual_mime_type; | |
| 440 render_view()->Send(new ChromeViewHostMsg_GetPluginInfo( | 438 render_view()->Send(new ChromeViewHostMsg_GetPluginInfo( |
| 441 routing_id(), GURL(plugin_params_.url), document.url(), | 439 routing_id(), GURL(plugin_params_.url), document.url(), |
| 442 mime_type, &status, &plugin_info, &actual_mime_type)); | 440 mime_type, &output)); |
| 443 if (status.value == status_->value) | 441 |
| 442 if (output.status.value == status_->value) |
| 444 return; | 443 return; |
| 445 chrome::ChromeContentRendererClient* client = | 444 chrome::ChromeContentRendererClient* client = |
| 446 static_cast<chrome::ChromeContentRendererClient*>( | 445 static_cast<chrome::ChromeContentRendererClient*>( |
| 447 content::GetContentClient()->renderer()); | 446 content::GetContentClient()->renderer()); |
| 448 WebPlugin* new_plugin = | 447 WebPlugin* new_plugin = |
| 449 client->CreatePlugin(render_view(), frame_, plugin_params_, | 448 client->CreatePlugin(render_view(), frame_, plugin_params_, output); |
| 450 status, plugin_info, actual_mime_type); | |
| 451 ReplacePlugin(new_plugin); | 449 ReplacePlugin(new_plugin); |
| 452 } | 450 } |
| 453 | 451 |
| 454 void PluginPlaceholder::SetMessage(const string16& message) { | 452 void PluginPlaceholder::SetMessage(const string16& message) { |
| 455 message_ = message; | 453 message_ = message; |
| 456 if (finished_loading_) | 454 if (finished_loading_) |
| 457 UpdateMessage(); | 455 UpdateMessage(); |
| 458 } | 456 } |
| 459 | 457 |
| 460 void PluginPlaceholder::UpdateMessage() { | 458 void PluginPlaceholder::UpdateMessage() { |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 629 bool PluginPlaceholder::IsYouTubeURL(const GURL& url, | 627 bool PluginPlaceholder::IsYouTubeURL(const GURL& url, |
| 630 const std::string& mime_type) { | 628 const std::string& mime_type) { |
| 631 std::string host = url.host(); | 629 std::string host = url.host(); |
| 632 bool is_youtube = EndsWith(host, "youtube.com", true) || | 630 bool is_youtube = EndsWith(host, "youtube.com", true) || |
| 633 EndsWith(host, "youtube-nocookie.com", true); | 631 EndsWith(host, "youtube-nocookie.com", true); |
| 634 | 632 |
| 635 return is_youtube && IsValidYouTubeVideo(url.path()) && | 633 return is_youtube && IsValidYouTubeVideo(url.path()) && |
| 636 LowerCaseEqualsASCII(mime_type, "application/x-shockwave-flash"); | 634 LowerCaseEqualsASCII(mime_type, "application/x-shockwave-flash"); |
| 637 } | 635 } |
| 638 #endif | 636 #endif |
| OLD | NEW |