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

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

Issue 448853002: Move StringToLowerASCII to 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 return webui::GetI18nTemplateHtml(template_html, &values); 44 return webui::GetI18nTemplateHtml(template_html, &values);
45 } 45 }
46 46
47 bool IsValidYouTubeVideo(const std::string& path) { 47 bool IsValidYouTubeVideo(const std::string& path) {
48 unsigned len = strlen(kSlashVSlash); 48 unsigned len = strlen(kSlashVSlash);
49 49
50 // check for more than just /v/ or /e/. 50 // check for more than just /v/ or /e/.
51 if (path.length() <= len) 51 if (path.length() <= len)
52 return false; 52 return false;
53 53
54 std::string str = StringToLowerASCII(path); 54 std::string str = base::StringToLowerASCII(path);
55 // Youtube flash url can start with /v/ or /e/. 55 // Youtube flash url can start with /v/ or /e/.
56 if (strncmp(str.data(), kSlashVSlash, len) != 0 && 56 if (strncmp(str.data(), kSlashVSlash, len) != 0 &&
57 strncmp(str.data(), kSlashESlash, len) != 0) 57 strncmp(str.data(), kSlashESlash, len) != 0)
58 return false; 58 return false;
59 59
60 // Start after /v/ 60 // Start after /v/
61 for (unsigned i = len; i < path.length(); i++) { 61 for (unsigned i = len; i < path.length(); i++) {
62 char c = str[i]; 62 char c = str[i];
63 if (isalpha(c) || isdigit(c) || c == '_' || c == '-') 63 if (isalpha(c) || isdigit(c) || c == '_' || c == '-')
64 continue; 64 continue;
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 gin::CreateHandle(isolate, this).ToV8()); 119 gin::CreateHandle(isolate, this).ToV8());
120 } 120 }
121 121
122 gin::ObjectTemplateBuilder MobileYouTubePlugin::GetObjectTemplateBuilder( 122 gin::ObjectTemplateBuilder MobileYouTubePlugin::GetObjectTemplateBuilder(
123 v8::Isolate* isolate) { 123 v8::Isolate* isolate) {
124 return PluginPlaceholder::GetObjectTemplateBuilder(isolate) 124 return PluginPlaceholder::GetObjectTemplateBuilder(isolate)
125 .SetMethod("openYoutubeURL", &MobileYouTubePlugin::OpenYoutubeUrlCallback); 125 .SetMethod("openYoutubeURL", &MobileYouTubePlugin::OpenYoutubeUrlCallback);
126 } 126 }
127 127
128 } // namespace plugins 128 } // namespace plugins
OLDNEW
« no previous file with comments | « components/os_crypt/ie7_password_win.cc ('k') | components/policy/core/common/preg_parser_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698