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

Side by Side Diff: google_apis/gaia/gaia_auth_util.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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "google_apis/gaia/gaia_auth_util.h" 5 #include "google_apis/gaia/gaia_auth_util.h"
6 6
7 #include "base/json/json_reader.h" 7 #include "base/json/json_reader.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/strings/string_split.h" 9 #include "base/strings/string_split.h"
10 #include "base/strings/string_util.h" 10 #include "base/strings/string_util.h"
(...skipping 17 matching lines...) Expand all
28 NOTREACHED() << "expecting exactly one @, but got " << parts.size()-1 << 28 NOTREACHED() << "expecting exactly one @, but got " << parts.size()-1 <<
29 " : " << email_address; 29 " : " << email_address;
30 } else { 30 } else {
31 if (change_googlemail_to_gmail && parts[1] == kGooglemailDomain) 31 if (change_googlemail_to_gmail && parts[1] == kGooglemailDomain)
32 parts[1] = kGmailDomain; 32 parts[1] = kGmailDomain;
33 33
34 if (parts[1] == kGmailDomain) // only strip '.' for gmail accounts. 34 if (parts[1] == kGmailDomain) // only strip '.' for gmail accounts.
35 base::RemoveChars(parts[0], ".", &parts[0]); 35 base::RemoveChars(parts[0], ".", &parts[0]);
36 } 36 }
37 37
38 std::string new_email = StringToLowerASCII(JoinString(parts, at)); 38 std::string new_email = base::StringToLowerASCII(JoinString(parts, at));
39 VLOG(1) << "Canonicalized " << email_address << " to " << new_email; 39 VLOG(1) << "Canonicalized " << email_address << " to " << new_email;
40 return new_email; 40 return new_email;
41 } 41 }
42 42
43 } // namespace 43 } // namespace
44 44
45 std::string CanonicalizeEmail(const std::string& email_address) { 45 std::string CanonicalizeEmail(const std::string& email_address) {
46 // CanonicalizeEmail() is called to process email strings that are eventually 46 // CanonicalizeEmail() is called to process email strings that are eventually
47 // shown to the user, and may also be used in persisting email strings. To 47 // shown to the user, and may also be used in persisting email strings. To
48 // avoid breaking this existing behavior, this function will not try to 48 // avoid breaking this existing behavior, this function will not try to
49 // change googlemail to gmail. 49 // change googlemail to gmail.
50 return CanonicalizeEmailImpl(email_address, false); 50 return CanonicalizeEmailImpl(email_address, false);
51 } 51 }
52 52
53 std::string CanonicalizeDomain(const std::string& domain) { 53 std::string CanonicalizeDomain(const std::string& domain) {
54 // Canonicalization of domain names means lower-casing them. Make sure to 54 // Canonicalization of domain names means lower-casing them. Make sure to
55 // update this function in sync with Canonicalize if this ever changes. 55 // update this function in sync with Canonicalize if this ever changes.
56 return StringToLowerASCII(domain); 56 return base::StringToLowerASCII(domain);
57 } 57 }
58 58
59 std::string SanitizeEmail(const std::string& email_address) { 59 std::string SanitizeEmail(const std::string& email_address) {
60 std::string sanitized(email_address); 60 std::string sanitized(email_address);
61 61
62 // Apply a default domain if necessary. 62 // Apply a default domain if necessary.
63 if (sanitized.find('@') == std::string::npos) { 63 if (sanitized.find('@') == std::string::npos) {
64 sanitized += '@'; 64 sanitized += '@';
65 sanitized += kGmailDomain; 65 sanitized += kGmailDomain;
66 } 66 }
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 accounts->push_back( 130 accounts->push_back(
131 std::make_pair(CanonicalizeEmail(email), is_email_valid != 0)); 131 std::make_pair(CanonicalizeEmail(email), is_email_valid != 0));
132 } 132 }
133 } 133 }
134 } 134 }
135 135
136 return true; 136 return true;
137 } 137 }
138 138
139 } // namespace gaia 139 } // namespace gaia
OLDNEW
« no previous file with comments | « extensions/common/permissions/socket_permission_entry.cc ('k') | google_apis/gcm/engine/gservices_settings.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698