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" |
11 #include "base/strings/string_util.h" | 11 #include "base/strings/string_util.h" |
12 #include "base/strings/utf_string_conversions.h" | 12 #include "base/strings/utf_string_conversions.h" |
13 #include "base/values.h" | 13 #include "base/values.h" |
14 #include "chrome/common/prerender_messages.h" | 14 #include "chrome/common/prerender_messages.h" |
15 #include "chrome/common/render_messages.h" | 15 #include "chrome/common/render_messages.h" |
16 #include "chrome/renderer/chrome_content_renderer_client.h" | 16 #include "chrome/renderer/chrome_content_renderer_client.h" |
17 #include "chrome/renderer/custom_menu_commands.h" | 17 #include "chrome/renderer/custom_menu_commands.h" |
18 #include "chrome/renderer/plugins/plugin_uma.h" | 18 #include "chrome/renderer/plugins/plugin_uma.h" |
| 19 #include "content/public/common/content_constants.h" |
19 #include "content/public/common/context_menu_params.h" | 20 #include "content/public/common/context_menu_params.h" |
20 #include "content/public/renderer/render_thread.h" | 21 #include "content/public/renderer/render_thread.h" |
21 #include "content/public/renderer/render_view.h" | 22 #include "content/public/renderer/render_view.h" |
22 #include "grit/generated_resources.h" | 23 #include "grit/generated_resources.h" |
23 #include "grit/renderer_resources.h" | 24 #include "grit/renderer_resources.h" |
24 #include "grit/webkit_strings.h" | 25 #include "grit/webkit_strings.h" |
25 #include "third_party/WebKit/public/platform/WebData.h" | 26 #include "third_party/WebKit/public/platform/WebData.h" |
26 #include "third_party/WebKit/public/platform/WebPoint.h" | 27 #include "third_party/WebKit/public/platform/WebPoint.h" |
27 #include "third_party/WebKit/public/platform/WebURLRequest.h" | 28 #include "third_party/WebKit/public/platform/WebURLRequest.h" |
28 #include "third_party/WebKit/public/platform/WebVector.h" | 29 #include "third_party/WebKit/public/platform/WebVector.h" |
29 #include "third_party/WebKit/public/web/WebContextMenuData.h" | 30 #include "third_party/WebKit/public/web/WebContextMenuData.h" |
30 #include "third_party/WebKit/public/web/WebDocument.h" | 31 #include "third_party/WebKit/public/web/WebDocument.h" |
31 #include "third_party/WebKit/public/web/WebElement.h" | 32 #include "third_party/WebKit/public/web/WebElement.h" |
32 #include "third_party/WebKit/public/web/WebFrame.h" | 33 #include "third_party/WebKit/public/web/WebFrame.h" |
33 #include "third_party/WebKit/public/web/WebInputEvent.h" | 34 #include "third_party/WebKit/public/web/WebInputEvent.h" |
34 #include "third_party/WebKit/public/web/WebPluginContainer.h" | 35 #include "third_party/WebKit/public/web/WebPluginContainer.h" |
35 #include "third_party/WebKit/public/web/WebScriptSource.h" | 36 #include "third_party/WebKit/public/web/WebScriptSource.h" |
36 #include "third_party/WebKit/public/web/WebView.h" | 37 #include "third_party/WebKit/public/web/WebView.h" |
37 #include "third_party/re2/re2/re2.h" | 38 #include "third_party/re2/re2/re2.h" |
38 #include "ui/base/l10n/l10n_util.h" | 39 #include "ui/base/l10n/l10n_util.h" |
39 #include "ui/base/resource/resource_bundle.h" | 40 #include "ui/base/resource/resource_bundle.h" |
40 #include "ui/webui/jstemplate_builder.h" | 41 #include "ui/webui/jstemplate_builder.h" |
41 | 42 |
42 #if defined(ENABLE_MOBILE_YOUTUBE_PLUGIN) | |
43 #include "webkit/plugins/plugin_constants.h" | |
44 #endif | |
45 | |
46 using content::RenderThread; | 43 using content::RenderThread; |
47 using content::RenderView; | 44 using content::RenderView; |
48 using WebKit::WebContextMenuData; | 45 using WebKit::WebContextMenuData; |
49 using WebKit::WebDocument; | 46 using WebKit::WebDocument; |
50 using WebKit::WebElement; | 47 using WebKit::WebElement; |
51 using WebKit::WebFrame; | 48 using WebKit::WebFrame; |
52 using WebKit::WebMouseEvent; | 49 using WebKit::WebMouseEvent; |
53 using WebKit::WebNode; | 50 using WebKit::WebNode; |
54 using WebKit::WebPlugin; | 51 using WebKit::WebPlugin; |
55 using WebKit::WebPluginContainer; | 52 using WebKit::WebPluginContainer; |
(...skipping 561 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
617 return true; | 614 return true; |
618 } | 615 } |
619 | 616 |
620 bool PluginPlaceholder::IsYouTubeURL(const GURL& url, | 617 bool PluginPlaceholder::IsYouTubeURL(const GURL& url, |
621 const std::string& mime_type) { | 618 const std::string& mime_type) { |
622 std::string host = url.host(); | 619 std::string host = url.host(); |
623 bool is_youtube = EndsWith(host, "youtube.com", true) || | 620 bool is_youtube = EndsWith(host, "youtube.com", true) || |
624 EndsWith(host, "youtube-nocookie.com", true); | 621 EndsWith(host, "youtube-nocookie.com", true); |
625 | 622 |
626 return is_youtube && IsValidYouTubeVideo(url.path()) && | 623 return is_youtube && IsValidYouTubeVideo(url.path()) && |
627 LowerCaseEqualsASCII(mime_type, kFlashPluginSwfMimeType); | 624 LowerCaseEqualsASCII(mime_type, content::kFlashPluginSwfMimeType); |
628 } | 625 } |
629 #endif | 626 #endif |
OLD | NEW |