| 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 23 matching lines...) Expand all  Loading... | 
| 34 #include "third_party/WebKit/Source/WebKit/chromium/public/WebScriptSource.h" | 34 #include "third_party/WebKit/Source/WebKit/chromium/public/WebScriptSource.h" | 
| 35 #include "third_party/WebKit/Source/WebKit/chromium/public/WebTextCaseSensitivit
     y.h" | 35 #include "third_party/WebKit/Source/WebKit/chromium/public/WebTextCaseSensitivit
     y.h" | 
| 36 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" | 36 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" | 
| 37 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebData.h" | 37 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebData.h" | 
| 38 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebPoint.h" | 38 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebPoint.h" | 
| 39 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebVector.h" | 39 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebVector.h" | 
| 40 #include "ui/base/l10n/l10n_util.h" | 40 #include "ui/base/l10n/l10n_util.h" | 
| 41 #include "ui/base/layout.h" | 41 #include "ui/base/layout.h" | 
| 42 #include "ui/base/resource/resource_bundle.h" | 42 #include "ui/base/resource/resource_bundle.h" | 
| 43 #include "webkit/glue/webpreferences.h" | 43 #include "webkit/glue/webpreferences.h" | 
| 44 #include "webkit/plugins/npapi/plugin_group.h" |  | 
| 45 #include "webkit/plugins/npapi/plugin_list.h" | 44 #include "webkit/plugins/npapi/plugin_list.h" | 
| 46 #include "webkit/plugins/webview_plugin.h" | 45 #include "webkit/plugins/webview_plugin.h" | 
| 47 | 46 | 
| 48 using content::RenderThread; | 47 using content::RenderThread; | 
| 49 using content::RenderView; | 48 using content::RenderView; | 
| 50 using WebKit::WebContextMenuData; | 49 using WebKit::WebContextMenuData; | 
| 51 using WebKit::WebDocument; | 50 using WebKit::WebDocument; | 
| 52 using WebKit::WebElement; | 51 using WebKit::WebElement; | 
| 53 using WebKit::WebFrame; | 52 using WebKit::WebFrame; | 
| 54 using WebKit::WebMenuItemInfo; | 53 using WebKit::WebMenuItemInfo; | 
| (...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 432     return; | 431     return; | 
| 433   WebDocument document = frame_->top()->document(); | 432   WebDocument document = frame_->top()->document(); | 
| 434   if (document.isNull()) | 433   if (document.isNull()) | 
| 435     return; | 434     return; | 
| 436 | 435 | 
| 437   ChromeViewHostMsg_GetPluginInfo_Output output; | 436   ChromeViewHostMsg_GetPluginInfo_Output output; | 
| 438   std::string mime_type(plugin_params_.mimeType.utf8()); | 437   std::string mime_type(plugin_params_.mimeType.utf8()); | 
| 439   render_view()->Send(new ChromeViewHostMsg_GetPluginInfo( | 438   render_view()->Send(new ChromeViewHostMsg_GetPluginInfo( | 
| 440       routing_id(), GURL(plugin_params_.url), document.url(), | 439       routing_id(), GURL(plugin_params_.url), document.url(), | 
| 441       mime_type, &output)); | 440       mime_type, &output)); | 
| 442 |  | 
| 443   if (output.status.value == status_->value) | 441   if (output.status.value == status_->value) | 
| 444     return; | 442     return; | 
| 445   chrome::ChromeContentRendererClient* client = | 443   chrome::ChromeContentRendererClient* client = | 
| 446       static_cast<chrome::ChromeContentRendererClient*>( | 444       static_cast<chrome::ChromeContentRendererClient*>( | 
| 447           content::GetContentClient()->renderer()); | 445           content::GetContentClient()->renderer()); | 
| 448   WebPlugin* new_plugin = | 446   WebPlugin* new_plugin = | 
| 449       client->CreatePlugin(render_view(), frame_, plugin_params_, output); | 447       client->CreatePlugin(render_view(), frame_, plugin_params_, output); | 
| 450   ReplacePlugin(new_plugin); | 448   ReplacePlugin(new_plugin); | 
| 451 } | 449 } | 
| 452 | 450 | 
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 628 bool PluginPlaceholder::IsYouTubeURL(const GURL& url, | 626 bool PluginPlaceholder::IsYouTubeURL(const GURL& url, | 
| 629                                        const std::string& mime_type) { | 627                                        const std::string& mime_type) { | 
| 630   std::string host = url.host(); | 628   std::string host = url.host(); | 
| 631   bool is_youtube = EndsWith(host, "youtube.com", true) || | 629   bool is_youtube = EndsWith(host, "youtube.com", true) || | 
| 632       EndsWith(host, "youtube-nocookie.com", true); | 630       EndsWith(host, "youtube-nocookie.com", true); | 
| 633 | 631 | 
| 634   return is_youtube && IsValidYouTubeVideo(url.path()) && | 632   return is_youtube && IsValidYouTubeVideo(url.path()) && | 
| 635       LowerCaseEqualsASCII(mime_type, "application/x-shockwave-flash"); | 633       LowerCaseEqualsASCII(mime_type, "application/x-shockwave-flash"); | 
| 636 } | 634 } | 
| 637 #endif | 635 #endif | 
| OLD | NEW | 
|---|