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

Side by Side Diff: google_apis/gaia/gaia_auth_util.cc

Issue 656283002: [session_manager] Move user session initialization code out of ExistingUserController (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add PerformPreLoginActions, PerformLoginFinishedActions methods Created 6 years, 2 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
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"
11 #include "base/values.h" 11 #include "base/values.h"
12 #include "google_apis/gaia/gaia_urls.h" 12 #include "google_apis/gaia/gaia_urls.h"
13 #include "url/gurl.h" 13 #include "url/gurl.h"
14 14
15 namespace gaia { 15 namespace gaia {
16 16
17 namespace { 17 namespace {
18 18
19 const char kGmailDomain[] = "gmail.com"; 19 const char kGmailDomain[] = "gmail.com";
20 const char kGooglemailDomain[] = "googlemail.com"; 20 const char kGooglemailDomain[] = "googlemail.com";
21 21
22 std::string CanonicalizeEmailImpl(const std::string& email_address, 22 std::string CanonicalizeEmailImpl(const std::string& email_address,
23 bool change_googlemail_to_gmail) { 23 bool change_googlemail_to_gmail) {
24 std::vector<std::string> parts; 24 std::vector<std::string> parts;
25 char at = '@'; 25 char at = '@';
26 base::SplitString(email_address, at, &parts); 26 base::SplitString(email_address, at, &parts);
27 if (parts.size() != 2U) { 27 if (parts.size() != 2U) {
28 NOTREACHED() << "expecting exactly one @, but got " << parts.size()-1 << 28 NOTREACHED() << "expecting exactly one @, but got "
29 " : " << email_address; 29 << (parts.size() ? parts.size() - 1 : parts.size())
Denis Kuznetsov (DE-MUC) 2014/10/20 13:38:59 Use 0 in else-case (it look weird otherwise). And
Nikita (slow) 2014/10/20 13:52:11 Done.
30 << " : " << email_address;
30 } else { 31 } else {
31 if (change_googlemail_to_gmail && parts[1] == kGooglemailDomain) 32 if (change_googlemail_to_gmail && parts[1] == kGooglemailDomain)
32 parts[1] = kGmailDomain; 33 parts[1] = kGmailDomain;
33 34
34 if (parts[1] == kGmailDomain) // only strip '.' for gmail accounts. 35 if (parts[1] == kGmailDomain) // only strip '.' for gmail accounts.
35 base::RemoveChars(parts[0], ".", &parts[0]); 36 base::RemoveChars(parts[0], ".", &parts[0]);
36 } 37 }
37 38
38 std::string new_email = base::StringToLowerASCII(JoinString(parts, at)); 39 std::string new_email = base::StringToLowerASCII(JoinString(parts, at));
39 VLOG(1) << "Canonicalized " << email_address << " to " << new_email; 40 VLOG(1) << "Canonicalized " << email_address << " to " << new_email;
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 accounts->push_back( 131 accounts->push_back(
131 std::make_pair(CanonicalizeEmail(email), is_email_valid != 0)); 132 std::make_pair(CanonicalizeEmail(email), is_email_valid != 0));
132 } 133 }
133 } 134 }
134 } 135 }
135 136
136 return true; 137 return true;
137 } 138 }
138 139
139 } // namespace gaia 140 } // namespace gaia
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698