Chromium Code Reviews| Index: chrome/browser/chromeos/login/authenticator.cc |
| diff --git a/chrome/browser/chromeos/login/authenticator.cc b/chrome/browser/chromeos/login/authenticator.cc |
| index 57426b3faed34ad9ab02e41c3e23d33c0ec5cd04..9f9e6056b06c33f5048712abbafff4bb540a6b14 100644 |
| --- a/chrome/browser/chromeos/login/authenticator.cc |
| +++ b/chrome/browser/chromeos/login/authenticator.cc |
| @@ -40,6 +40,13 @@ std::string Authenticator::Canonicalize(const std::string& email_address) { |
| } |
| // static |
| +std::string Authenticator::CanonicalizeDomain(const std::string& domain) { |
| + // Canonicalization of domain names means lower-casing them. Make sure to |
| + // update this function in sync with |Canonicalize| if this ever changes. |
|
Mattias Nissler (ping if slow)
2012/06/18 16:45:17
I think we only use bars for variable names, not f
pastarmovj
2012/06/18 17:12:58
I thought it is generic concept for making identif
|
| + return StringToLowerASCII(domain); |
| +} |
| + |
| +// static |
| std::string Authenticator::Sanitize(const std::string& email_address) { |
| std::string sanitized(email_address); |
| @@ -52,4 +59,16 @@ std::string Authenticator::Sanitize(const std::string& email_address) { |
| return sanitized; |
| } |
| +// static |
| +std::string Authenticator::ExtractDomainName(const std::string& email_address) { |
| + // First canonicalize which will also verify we have proper domain part. |
| + std::string email = Canonicalize(email_address); |
| + size_t separator_pos = email.find('@'); |
| + if (separator_pos != email.npos && separator_pos < email.length() - 1) |
| + return email.substr(separator_pos + 1); |
| + else |
| + NOTREACHED() << "Not a proper email address: " << email; |
| + return std::string(); |
| +} |
| + |
| } // namespace chromeos |