| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef COMPONENTS_PLUGINS_RENDERER_MOBILE_YOUTUBE_PLUGIN_H_ | |
| 6 #define COMPONENTS_PLUGINS_RENDERER_MOBILE_YOUTUBE_PLUGIN_H_ | |
| 7 | |
| 8 #include "base/macros.h" | |
| 9 #include "components/plugins/renderer/plugin_placeholder.h" | |
| 10 | |
| 11 namespace plugins { | |
| 12 | |
| 13 // Class representing placeholders for old style embedded youtube video on | |
| 14 // mobile device. For old style embedded youtube video, it has a url in the form | |
| 15 // of http://www.youtube.com/v/VIDEO_ID. This placeholder replaces the url with | |
| 16 // a simple html page and clicking the play image redirects the user to the | |
| 17 // mobile youtube app. | |
| 18 class MobileYouTubePlugin final : public PluginPlaceholderBase, | |
| 19 public gin::Wrappable<MobileYouTubePlugin> { | |
| 20 public: | |
| 21 static gin::WrapperInfo kWrapperInfo; | |
| 22 | |
| 23 MobileYouTubePlugin(content::RenderFrame* render_frame, | |
| 24 blink::WebLocalFrame* frame, | |
| 25 const blink::WebPluginParams& params, | |
| 26 base::StringPiece& template_html); | |
| 27 | |
| 28 // Whether this is a youtube url. | |
| 29 static bool IsYouTubeURL(const GURL& url, const std::string& mime_type); | |
| 30 | |
| 31 private: | |
| 32 ~MobileYouTubePlugin() override; | |
| 33 | |
| 34 // Opens a youtube app in the current tab. | |
| 35 void OpenYoutubeUrlCallback(); | |
| 36 | |
| 37 // WebViewPlugin::Delegate methods: | |
| 38 v8::Local<v8::Value> GetV8Handle(v8::Isolate* isolate) override; | |
| 39 | |
| 40 // gin::Wrappable (via PluginPlaceholder) method | |
| 41 gin::ObjectTemplateBuilder GetObjectTemplateBuilder( | |
| 42 v8::Isolate* isolate) final; | |
| 43 | |
| 44 DISALLOW_COPY_AND_ASSIGN(MobileYouTubePlugin); | |
| 45 }; | |
| 46 | |
| 47 } // namespace plugins | |
| 48 | |
| 49 #endif // COMPONENTS_PLUGINS_RENDERER_MOBILE_YOUTUBE_PLUGIN_H_ | |
| OLD | NEW |