| 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 #include "components/plugins/renderer/mobile_youtube_plugin.h" | 5 #include "components/plugins/renderer/mobile_youtube_plugin.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 | 99 |
| 100 return is_youtube && IsValidYouTubeVideo(url.path()) && | 100 return is_youtube && IsValidYouTubeVideo(url.path()) && |
| 101 base::LowerCaseEqualsASCII(mime_type, | 101 base::LowerCaseEqualsASCII(mime_type, |
| 102 content::kFlashPluginSwfMimeType); | 102 content::kFlashPluginSwfMimeType); |
| 103 } | 103 } |
| 104 | 104 |
| 105 void MobileYouTubePlugin::OpenYoutubeUrlCallback() { | 105 void MobileYouTubePlugin::OpenYoutubeUrlCallback() { |
| 106 std::string youtube("vnd.youtube:"); | 106 std::string youtube("vnd.youtube:"); |
| 107 GURL url(youtube.append(GetYoutubeVideoId(GetPluginParams()))); | 107 GURL url(youtube.append(GetYoutubeVideoId(GetPluginParams()))); |
| 108 WebURLRequest request; | 108 WebURLRequest request; |
| 109 request.initialize(); | |
| 110 request.setURL(url); | 109 request.setURL(url); |
| 111 render_frame()->LoadURLExternally(request, | 110 render_frame()->LoadURLExternally(request, |
| 112 blink::WebNavigationPolicyNewForegroundTab); | 111 blink::WebNavigationPolicyNewForegroundTab); |
| 113 } | 112 } |
| 114 | 113 |
| 115 v8::Local<v8::Value> MobileYouTubePlugin::GetV8Handle(v8::Isolate* isolate) { | 114 v8::Local<v8::Value> MobileYouTubePlugin::GetV8Handle(v8::Isolate* isolate) { |
| 116 return gin::CreateHandle(isolate, this).ToV8(); | 115 return gin::CreateHandle(isolate, this).ToV8(); |
| 117 } | 116 } |
| 118 | 117 |
| 119 gin::ObjectTemplateBuilder MobileYouTubePlugin::GetObjectTemplateBuilder( | 118 gin::ObjectTemplateBuilder MobileYouTubePlugin::GetObjectTemplateBuilder( |
| 120 v8::Isolate* isolate) { | 119 v8::Isolate* isolate) { |
| 121 return gin::Wrappable<MobileYouTubePlugin>::GetObjectTemplateBuilder(isolate) | 120 return gin::Wrappable<MobileYouTubePlugin>::GetObjectTemplateBuilder(isolate) |
| 122 .SetMethod("openYoutubeURL", | 121 .SetMethod("openYoutubeURL", |
| 123 &MobileYouTubePlugin::OpenYoutubeUrlCallback); | 122 &MobileYouTubePlugin::OpenYoutubeUrlCallback); |
| 124 } | 123 } |
| 125 | 124 |
| 126 } // namespace plugins | 125 } // namespace plugins |
| OLD | NEW |