OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #ifndef COMPONENTS_PLUGINS_RENDERER_MOBILE_YOUTUBE_PLUGIN_H_ | 5 #ifndef COMPONENTS_PLUGINS_RENDERER_MOBILE_YOUTUBE_PLUGIN_H_ |
6 #define COMPONENTS_PLUGINS_RENDERER_MOBILE_YOUTUBE_PLUGIN_H_ | 6 #define COMPONENTS_PLUGINS_RENDERER_MOBILE_YOUTUBE_PLUGIN_H_ |
7 | 7 |
8 #include "components/plugins/renderer/plugin_placeholder.h" | 8 #include "components/plugins/renderer/plugin_placeholder.h" |
| 9 #include "gin/wrappable.h" |
9 | 10 |
10 namespace plugins { | 11 namespace plugins { |
11 | 12 |
12 // Class representing placeholders for old style embedded youtube video on | 13 // Class representing placeholders for old style embedded youtube video on |
13 // mobile device. For old style embedded youtube video, it has a url in the form | 14 // mobile device. For old style embedded youtube video, it has a url in the form |
14 // of http://www.youtube.com/v/VIDEO_ID. This placeholder replaces the url with | 15 // of http://www.youtube.com/v/VIDEO_ID. This placeholder replaces the url with |
15 // a simple html page and clicking the play image redirects the user to the | 16 // a simple html page and clicking the play image redirects the user to the |
16 // mobile youtube app. | 17 // mobile youtube app. |
17 class MobileYouTubePlugin : public PluginPlaceholder { | 18 class MobileYouTubePlugin : public PluginPlaceholder { |
18 public: | 19 public: |
19 MobileYouTubePlugin(content::RenderFrame* render_frame, | 20 MobileYouTubePlugin(content::RenderFrame* render_frame, |
20 blink::WebFrame* frame, | 21 blink::WebFrame* frame, |
21 const blink::WebPluginParams& params, | 22 const blink::WebPluginParams& params, |
22 base::StringPiece& template_html, | 23 base::StringPiece& template_html, |
23 GURL placeholderDataUrl); | 24 GURL placeholderDataUrl); |
24 | 25 |
25 // Whether this is a youtube url. | 26 // Whether this is a youtube url. |
26 static bool IsYouTubeURL(const GURL& url, const std::string& mime_type); | 27 static bool IsYouTubeURL(const GURL& url, const std::string& mime_type); |
27 | 28 |
28 private: | 29 private: |
| 30 virtual gin::ObjectTemplateBuilder GetObjectTemplateBuilder(v8::Isolate* isola
te) OVERRIDE; |
| 31 |
| 32 virtual ~MobileYouTubePlugin(); |
| 33 |
29 // Opens a youtube app in the current tab. | 34 // Opens a youtube app in the current tab. |
30 void OpenYoutubeUrlCallback(const webkit_glue::CppArgumentList& args, | 35 void OpenYoutubeUrlCallback(); |
31 webkit_glue::CppVariant* result); | |
32 | 36 |
33 // WebViewPlugin::Delegate (via PluginPlaceholder) method | 37 // WebViewPlugin::Delegate (via PluginPlaceholder) method |
34 virtual void BindWebFrame(blink::WebFrame* frame) OVERRIDE; | 38 virtual void BindWebFrame(blink::WebFrame* frame) OVERRIDE; |
35 | 39 |
36 DISALLOW_COPY_AND_ASSIGN(MobileYouTubePlugin); | 40 DISALLOW_COPY_AND_ASSIGN(MobileYouTubePlugin); |
37 }; | 41 }; |
38 | 42 |
39 } // namespace plugins | 43 } // namespace plugins |
40 | 44 |
41 #endif // COMPONENTS_PLUGINS_RENDERER_MOBILE_YOUTUBE_PLUGIN_H_ | 45 #endif // COMPONENTS_PLUGINS_RENDERER_MOBILE_YOUTUBE_PLUGIN_H_ |
OLD | NEW |