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" |
11 #include "base/string_util.h" | 11 #include "base/string_util.h" |
12 #include "base/utf_string_conversions.h" | 12 #include "base/utf_string_conversions.h" |
13 #include "base/values.h" | 13 #include "base/values.h" |
14 #include "chrome/common/jstemplate_builder.h" | |
15 #include "chrome/common/prerender_messages.h" | 14 #include "chrome/common/prerender_messages.h" |
16 #include "chrome/common/render_messages.h" | 15 #include "chrome/common/render_messages.h" |
17 #include "chrome/renderer/chrome_content_renderer_client.h" | 16 #include "chrome/renderer/chrome_content_renderer_client.h" |
18 #include "chrome/renderer/custom_menu_commands.h" | 17 #include "chrome/renderer/custom_menu_commands.h" |
19 #include "chrome/renderer/plugins/plugin_uma.h" | 18 #include "chrome/renderer/plugins/plugin_uma.h" |
20 #include "content/public/common/context_menu_params.h" | 19 #include "content/public/common/context_menu_params.h" |
21 #include "content/public/renderer/render_thread.h" | 20 #include "content/public/renderer/render_thread.h" |
22 #include "content/public/renderer/render_view.h" | 21 #include "content/public/renderer/render_view.h" |
23 #include "grit/generated_resources.h" | 22 #include "grit/generated_resources.h" |
24 #include "grit/renderer_resources.h" | 23 #include "grit/renderer_resources.h" |
25 #include "grit/webkit_strings.h" | 24 #include "grit/webkit_strings.h" |
26 #include "third_party/WebKit/Source/Platform/chromium/public/WebData.h" | 25 #include "third_party/WebKit/Source/Platform/chromium/public/WebData.h" |
27 #include "third_party/WebKit/Source/Platform/chromium/public/WebPoint.h" | 26 #include "third_party/WebKit/Source/Platform/chromium/public/WebPoint.h" |
28 #include "third_party/WebKit/Source/Platform/chromium/public/WebURLRequest.h" | 27 #include "third_party/WebKit/Source/Platform/chromium/public/WebURLRequest.h" |
29 #include "third_party/WebKit/Source/Platform/chromium/public/WebVector.h" | 28 #include "third_party/WebKit/Source/Platform/chromium/public/WebVector.h" |
30 #include "third_party/WebKit/Source/WebKit/chromium/public/WebContextMenuData.h" | 29 #include "third_party/WebKit/Source/WebKit/chromium/public/WebContextMenuData.h" |
31 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" | 30 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" |
32 #include "third_party/WebKit/Source/WebKit/chromium/public/WebElement.h" | 31 #include "third_party/WebKit/Source/WebKit/chromium/public/WebElement.h" |
33 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" | 32 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" |
34 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h" | 33 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h" |
35 #include "third_party/WebKit/Source/WebKit/chromium/public/WebMenuItemInfo.h" | 34 #include "third_party/WebKit/Source/WebKit/chromium/public/WebMenuItemInfo.h" |
36 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPluginContainer.h" | 35 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPluginContainer.h" |
37 #include "third_party/WebKit/Source/WebKit/chromium/public/WebRegularExpression.
h" | 36 #include "third_party/WebKit/Source/WebKit/chromium/public/WebRegularExpression.
h" |
38 #include "third_party/WebKit/Source/WebKit/chromium/public/WebScriptSource.h" | 37 #include "third_party/WebKit/Source/WebKit/chromium/public/WebScriptSource.h" |
39 #include "third_party/WebKit/Source/WebKit/chromium/public/WebTextCaseSensitivit
y.h" | 38 #include "third_party/WebKit/Source/WebKit/chromium/public/WebTextCaseSensitivit
y.h" |
40 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" | 39 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" |
41 #include "ui/base/l10n/l10n_util.h" | 40 #include "ui/base/l10n/l10n_util.h" |
42 #include "ui/base/resource/resource_bundle.h" | 41 #include "ui/base/resource/resource_bundle.h" |
| 42 #include "ui/webui/jstemplate_builder.h" |
43 #include "webkit/glue/webpreferences.h" | 43 #include "webkit/glue/webpreferences.h" |
44 #include "webkit/plugins/npapi/plugin_list.h" | 44 #include "webkit/plugins/npapi/plugin_list.h" |
45 #include "webkit/plugins/webview_plugin.h" | 45 #include "webkit/plugins/webview_plugin.h" |
46 | 46 |
47 #if defined(ENABLE_MOBILE_YOUTUBE_PLUGIN) | 47 #if defined(ENABLE_MOBILE_YOUTUBE_PLUGIN) |
48 #include "webkit/plugins/plugin_constants.h" | 48 #include "webkit/plugins/plugin_constants.h" |
49 #endif | 49 #endif |
50 | 50 |
51 using content::RenderThread; | 51 using content::RenderThread; |
52 using content::RenderView; | 52 using content::RenderView; |
(...skipping 595 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
648 bool PluginPlaceholder::IsYouTubeURL(const GURL& url, | 648 bool PluginPlaceholder::IsYouTubeURL(const GURL& url, |
649 const std::string& mime_type) { | 649 const std::string& mime_type) { |
650 std::string host = url.host(); | 650 std::string host = url.host(); |
651 bool is_youtube = EndsWith(host, "youtube.com", true) || | 651 bool is_youtube = EndsWith(host, "youtube.com", true) || |
652 EndsWith(host, "youtube-nocookie.com", true); | 652 EndsWith(host, "youtube-nocookie.com", true); |
653 | 653 |
654 return is_youtube && IsValidYouTubeVideo(url.path()) && | 654 return is_youtube && IsValidYouTubeVideo(url.path()) && |
655 LowerCaseEqualsASCII(mime_type, kFlashPluginSwfMimeType); | 655 LowerCaseEqualsASCII(mime_type, kFlashPluginSwfMimeType); |
656 } | 656 } |
657 #endif | 657 #endif |
OLD | NEW |