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
3 // found in the LICENSE file.
5 #ifndef GOOGLE_APIS_GAIA_GAIA_AUTH_UTIL_H_
6 #define GOOGLE_APIS_GAIA_GAIA_AUTH_UTIL_H_
14 // Perform basic canonicalization of |email_address|, taking into account that
15 // gmail does not consider '.' or caps inside a username to matter. It also
16 // ignores everything after a '+'. For example, c.masone+abc@gmail.com ==
17 // cMaSone@gmail.com, per
18 // http://mail.google.com/support/bin/answer.py?hl=en&ctx=mail&answer=10313#
19 std::string
CanonicalizeEmail(const std::string
& email_address
);
21 // Returns the canonical form of the given domain.
22 std::string
CanonicalizeDomain(const std::string
& domain
);
24 // Sanitize emails. Currently, it only ensures all emails have a domain by
25 // adding gmail.com if no domain is present.
26 std::string
SanitizeEmail(const std::string
& email_address
);
28 // Returns true if the two specified email addresses are the same. Both
29 // addresses are first sanitized and then canoncialized before comparing.
30 bool AreEmailsSame(const std::string
& email1
, const std::string
& email2
);
32 // Extract the domain part from the canonical form of the given email.
33 std::string
ExtractDomainName(const std::string
& email
);
35 bool IsGaiaSignonRealm(const GURL
& url
);
39 #endif // GOOGLE_APIS_GAIA_GAIA_AUTH_UTIL_H_