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/strings/string_piece.h" | 10 #include "base/strings/string_piece.h" |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 using content::RenderThread; | 46 using content::RenderThread; |
47 using content::RenderView; | 47 using content::RenderView; |
48 using WebKit::WebContextMenuData; | 48 using WebKit::WebContextMenuData; |
49 using WebKit::WebDocument; | 49 using WebKit::WebDocument; |
50 using WebKit::WebElement; | 50 using WebKit::WebElement; |
51 using WebKit::WebFrame; | 51 using WebKit::WebFrame; |
52 using WebKit::WebMouseEvent; | 52 using WebKit::WebMouseEvent; |
53 using WebKit::WebNode; | 53 using WebKit::WebNode; |
54 using WebKit::WebPlugin; | 54 using WebKit::WebPlugin; |
55 using WebKit::WebPluginContainer; | 55 using WebKit::WebPluginContainer; |
56 using webkit::WebPluginInfo; | |
57 using WebKit::WebPluginParams; | 56 using WebKit::WebPluginParams; |
58 using WebKit::WebPoint; | 57 using WebKit::WebPoint; |
59 using WebKit::WebScriptSource; | 58 using WebKit::WebScriptSource; |
60 using WebKit::WebString; | 59 using WebKit::WebString; |
61 using WebKit::WebURLRequest; | 60 using WebKit::WebURLRequest; |
62 using WebKit::WebVector; | 61 using WebKit::WebVector; |
63 using webkit_glue::CppArgumentList; | 62 using webkit_glue::CppArgumentList; |
64 using webkit_glue::CppVariant; | 63 using webkit_glue::CppVariant; |
65 | 64 |
66 const char* const kPluginPlaceholderDataURL = | 65 const char* const kPluginPlaceholderDataURL = |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 new ChromeViewHostMsg_CouldNotLoadPlugin(plugin->routing_id(), | 142 new ChromeViewHostMsg_CouldNotLoadPlugin(plugin->routing_id(), |
144 file_path)); | 143 file_path)); |
145 return plugin; | 144 return plugin; |
146 } | 145 } |
147 | 146 |
148 // static | 147 // static |
149 PluginPlaceholder* PluginPlaceholder::CreateBlockedPlugin( | 148 PluginPlaceholder* PluginPlaceholder::CreateBlockedPlugin( |
150 RenderView* render_view, | 149 RenderView* render_view, |
151 WebFrame* frame, | 150 WebFrame* frame, |
152 const WebPluginParams& params, | 151 const WebPluginParams& params, |
153 const WebPluginInfo& plugin, | 152 const content::WebPluginInfo& plugin, |
154 const std::string& identifier, | 153 const std::string& identifier, |
155 const string16& name, | 154 const string16& name, |
156 int template_id, | 155 int template_id, |
157 const string16& message) { | 156 const string16& message) { |
158 base::DictionaryValue values; | 157 base::DictionaryValue values; |
159 values.SetString("message", message); | 158 values.SetString("message", message); |
160 values.SetString("name", name); | 159 values.SetString("name", name); |
161 values.SetString("hide", l10n_util::GetStringUTF8(IDS_PLUGIN_HIDE)); | 160 values.SetString("hide", l10n_util::GetStringUTF8(IDS_PLUGIN_HIDE)); |
162 | 161 |
163 const base::StringPiece template_html( | 162 const base::StringPiece template_html( |
(...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
621 bool PluginPlaceholder::IsYouTubeURL(const GURL& url, | 620 bool PluginPlaceholder::IsYouTubeURL(const GURL& url, |
622 const std::string& mime_type) { | 621 const std::string& mime_type) { |
623 std::string host = url.host(); | 622 std::string host = url.host(); |
624 bool is_youtube = EndsWith(host, "youtube.com", true) || | 623 bool is_youtube = EndsWith(host, "youtube.com", true) || |
625 EndsWith(host, "youtube-nocookie.com", true); | 624 EndsWith(host, "youtube-nocookie.com", true); |
626 | 625 |
627 return is_youtube && IsValidYouTubeVideo(url.path()) && | 626 return is_youtube && IsValidYouTubeVideo(url.path()) && |
628 LowerCaseEqualsASCII(mime_type, kFlashPluginSwfMimeType); | 627 LowerCaseEqualsASCII(mime_type, kFlashPluginSwfMimeType); |
629 } | 628 } |
630 #endif | 629 #endif |
OLD | NEW |