Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(138)

Side by Side Diff: components/plugins/renderer/mobile_youtube_plugin.cc

Issue 448143008: Move StringToUpperASCII and LowerCaseEqualsASCII to the base namespace (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/strings/string_piece.h" 9 #include "base/strings/string_piece.h"
10 #include "base/strings/string_util.h" 10 #include "base/strings/string_util.h"
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 MobileYouTubePlugin::~MobileYouTubePlugin() {} 87 MobileYouTubePlugin::~MobileYouTubePlugin() {}
88 88
89 // static 89 // static
90 bool MobileYouTubePlugin::IsYouTubeURL(const GURL& url, 90 bool MobileYouTubePlugin::IsYouTubeURL(const GURL& url,
91 const std::string& mime_type) { 91 const std::string& mime_type) {
92 std::string host = url.host(); 92 std::string host = url.host();
93 bool is_youtube = EndsWith(host, "youtube.com", true) || 93 bool is_youtube = EndsWith(host, "youtube.com", true) ||
94 EndsWith(host, "youtube-nocookie.com", true); 94 EndsWith(host, "youtube-nocookie.com", true);
95 95
96 return is_youtube && IsValidYouTubeVideo(url.path()) && 96 return is_youtube && IsValidYouTubeVideo(url.path()) &&
97 LowerCaseEqualsASCII(mime_type, content::kFlashPluginSwfMimeType); 97 base::LowerCaseEqualsASCII(mime_type,
98 content::kFlashPluginSwfMimeType);
98 } 99 }
99 100
100 void MobileYouTubePlugin::OpenYoutubeUrlCallback() { 101 void MobileYouTubePlugin::OpenYoutubeUrlCallback() {
101 std::string youtube("vnd.youtube:"); 102 std::string youtube("vnd.youtube:");
102 GURL url(youtube.append(GetYoutubeVideoId(GetPluginParams()))); 103 GURL url(youtube.append(GetYoutubeVideoId(GetPluginParams())));
103 WebURLRequest request; 104 WebURLRequest request;
104 request.initialize(); 105 request.initialize();
105 request.setURL(url); 106 request.setURL(url);
106 render_frame()->LoadURLExternally( 107 render_frame()->LoadURLExternally(
107 GetFrame(), request, blink::WebNavigationPolicyNewForegroundTab); 108 GetFrame(), request, blink::WebNavigationPolicyNewForegroundTab);
(...skipping 11 matching lines...) Expand all
119 gin::CreateHandle(isolate, this).ToV8()); 120 gin::CreateHandle(isolate, this).ToV8());
120 } 121 }
121 122
122 gin::ObjectTemplateBuilder MobileYouTubePlugin::GetObjectTemplateBuilder( 123 gin::ObjectTemplateBuilder MobileYouTubePlugin::GetObjectTemplateBuilder(
123 v8::Isolate* isolate) { 124 v8::Isolate* isolate) {
124 return PluginPlaceholder::GetObjectTemplateBuilder(isolate) 125 return PluginPlaceholder::GetObjectTemplateBuilder(isolate)
125 .SetMethod("openYoutubeURL", &MobileYouTubePlugin::OpenYoutubeUrlCallback); 126 .SetMethod("openYoutubeURL", &MobileYouTubePlugin::OpenYoutubeUrlCallback);
126 } 127 }
127 128
128 } // namespace plugins 129 } // namespace plugins
OLDNEW
« no previous file with comments | « components/omnibox/autocomplete_input.cc ('k') | components/policy/core/common/cloud/cloud_policy_validator_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698