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

Side by Side Diff: chrome/browser/chromeos/login/authenticator.cc

Issue 3436031: [Chrome OS] Refactor Canonicalize() method into base class to prepare for new Authenticator subclass (Closed)
Patch Set: aaaaand fix one more header Created 10 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
(Empty)
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "chrome/browser/chromeos/login/authenticator.h"
6
7 #include <string>
8 #include <vector>
9
10 #include "base/logging.h"
11 #include "base/string_split.h"
12 #include "base/string_util.h"
13
14 namespace chromeos {
15 class LoginStatusConsumer;
16
17 Authenticator::Authenticator(LoginStatusConsumer* consumer)
18 : consumer_(consumer) {
19 }
20
21 Authenticator::~Authenticator() {}
22
23 // static
24 std::string Authenticator::Canonicalize(const std::string& email_address) {
25 std::vector<std::string> parts;
26 char at = '@';
27 SplitString(email_address, at, &parts);
28 DCHECK_EQ(parts.size(), 2U) << "email_address should have only one @";
29 RemoveChars(parts[0], ".", &parts[0]);
30 if (parts[0].find('+') != std::string::npos)
31 parts[0].erase(parts[0].find('+'));
32 std::string new_email = StringToLowerASCII(JoinString(parts, at));
33 LOG(INFO) << "Canonicalized " << email_address << " to " << new_email;
34 return new_email;
35 }
36
37 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698