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 | 9 |
10 namespace plugins { | 10 namespace plugins { |
11 | 11 |
12 // Class representing placeholders for old style embedded youtube video on | 12 // 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 | 13 // 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 | 14 // 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 | 15 // a simple html page and clicking the play image redirects the user to the |
16 // mobile youtube app. | 16 // mobile youtube app. |
17 class MobileYouTubePlugin : public PluginPlaceholder { | 17 class MobileYouTubePlugin final : public PluginPlaceholderBase, |
| 18 public gin::Wrappable<MobileYouTubePlugin> { |
18 public: | 19 public: |
| 20 static gin::WrapperInfo kWrapperInfo; |
| 21 |
19 MobileYouTubePlugin(content::RenderFrame* render_frame, | 22 MobileYouTubePlugin(content::RenderFrame* render_frame, |
20 blink::WebLocalFrame* frame, | 23 blink::WebLocalFrame* frame, |
21 const blink::WebPluginParams& params, | 24 const blink::WebPluginParams& params, |
22 base::StringPiece& template_html, | 25 base::StringPiece& template_html); |
23 GURL placeholderDataUrl); | |
24 | 26 |
25 // Whether this is a youtube url. | 27 // Whether this is a youtube url. |
26 static bool IsYouTubeURL(const GURL& url, const std::string& mime_type); | 28 static bool IsYouTubeURL(const GURL& url, const std::string& mime_type); |
27 | 29 |
28 private: | 30 private: |
29 ~MobileYouTubePlugin() override; | 31 ~MobileYouTubePlugin() override; |
30 | 32 |
31 // Opens a youtube app in the current tab. | 33 // Opens a youtube app in the current tab. |
32 void OpenYoutubeUrlCallback(); | 34 void OpenYoutubeUrlCallback(); |
33 | 35 |
34 // WebViewPlugin::Delegate (via PluginPlaceholder) method | 36 // WebViewPlugin::Delegate methods: |
35 void BindWebFrame(blink::WebFrame* frame) override; | 37 v8::Local<v8::Value> GetV8Handle(v8::Isolate* isolate) override; |
36 | 38 |
37 // gin::Wrappable (via PluginPlaceholder) method | 39 // gin::Wrappable (via PluginPlaceholder) method |
38 gin::ObjectTemplateBuilder GetObjectTemplateBuilder( | 40 gin::ObjectTemplateBuilder GetObjectTemplateBuilder( |
39 v8::Isolate* isolate) override; | 41 v8::Isolate* isolate) final; |
40 | 42 |
41 DISALLOW_COPY_AND_ASSIGN(MobileYouTubePlugin); | 43 DISALLOW_COPY_AND_ASSIGN(MobileYouTubePlugin); |
42 }; | 44 }; |
43 | 45 |
44 } // namespace plugins | 46 } // namespace plugins |
45 | 47 |
46 #endif // COMPONENTS_PLUGINS_RENDERER_MOBILE_YOUTUBE_PLUGIN_H_ | 48 #endif // COMPONENTS_PLUGINS_RENDERER_MOBILE_YOUTUBE_PLUGIN_H_ |
OLD | NEW |