Roll src/third_party/WebKit c63b89c:29324ab (svn 202546:202547)
[chromium-blink-merge.git] / components / plugins / renderer / mobile_youtube_plugin.h
blob9d467002cebb33e300c154872f4701ee26f97041
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.
5 #ifndef COMPONENTS_PLUGINS_RENDERER_MOBILE_YOUTUBE_PLUGIN_H_
6 #define COMPONENTS_PLUGINS_RENDERER_MOBILE_YOUTUBE_PLUGIN_H_
8 #include "components/plugins/renderer/plugin_placeholder.h"
10 namespace plugins {
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
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
16 // mobile youtube app.
17 class MobileYouTubePlugin final : public PluginPlaceholderBase,
18 public gin::Wrappable<MobileYouTubePlugin> {
19 public:
20 static gin::WrapperInfo kWrapperInfo;
22 MobileYouTubePlugin(content::RenderFrame* render_frame,
23 blink::WebLocalFrame* frame,
24 const blink::WebPluginParams& params,
25 base::StringPiece& template_html);
27 // Whether this is a youtube url.
28 static bool IsYouTubeURL(const GURL& url, const std::string& mime_type);
30 private:
31 ~MobileYouTubePlugin() override;
33 // Opens a youtube app in the current tab.
34 void OpenYoutubeUrlCallback();
36 // WebViewPlugin::Delegate methods:
37 v8::Local<v8::Value> GetV8Handle(v8::Isolate* isolate) override;
39 // gin::Wrappable (via PluginPlaceholder) method
40 gin::ObjectTemplateBuilder GetObjectTemplateBuilder(
41 v8::Isolate* isolate) final;
43 DISALLOW_COPY_AND_ASSIGN(MobileYouTubePlugin);
46 } // namespace plugins
48 #endif // COMPONENTS_PLUGINS_RENDERER_MOBILE_YOUTUBE_PLUGIN_H_