Chromium Code Reviews| Index: google_apis/gaia/gaia_auth_util.cc |
| diff --git a/google_apis/gaia/gaia_auth_util.cc b/google_apis/gaia/gaia_auth_util.cc |
| index 93b449690dda9797105d5c6bce7f7662094d0cc6..fa45e5f90e93e495da6c952750f220150ac87cfe 100644 |
| --- a/google_apis/gaia/gaia_auth_util.cc |
| +++ b/google_apis/gaia/gaia_auth_util.cc |
| @@ -14,6 +14,8 @@ |
| #include "base/strings/string_util.h" |
| #include "base/values.h" |
| #include "google_apis/gaia/gaia_urls.h" |
| +#include "net/url_request/url_fetcher.h" |
| +#include "net/url_request/url_request.h" |
| #include "url/gurl.h" |
| namespace gaia { |
| @@ -23,6 +25,8 @@ namespace { |
| const char kGmailDomain[] = "gmail.com"; |
| const char kGooglemailDomain[] = "googlemail.com"; |
| +const void* kURLRequestUserDataKey = &kURLRequestUserDataKey; |
|
msarda
2017/01/23 09:29:28
This is the first time I see this kind of definiti
Raj
2017/01/23 18:47:11
Done.
|
| + |
| std::string CanonicalizeEmailImpl(const std::string& email_address, |
| bool change_googlemail_to_gmail) { |
| std::vector<std::string> parts = base::SplitString( |
| @@ -44,6 +48,13 @@ std::string CanonicalizeEmailImpl(const std::string& email_address, |
| return new_email; |
| } |
| +class GaiaURLRequestUserData : public base::SupportsUserData::Data { |
| + public: |
| + static base::SupportsUserData::Data* Create() { |
| + return new GaiaURLRequestUserData(); |
| + } |
| +}; |
| + |
| } // namespace |
| @@ -180,4 +191,13 @@ bool ParseListAccountsData(const std::string& data, |
| return true; |
| } |
| +bool RequestOriginatedFromGaia(const net::URLRequest& request) { |
| + return request.GetUserData(kURLRequestUserDataKey) != nullptr; |
| +} |
| + |
| +void MarkURLFetcherAsGaia(net::URLFetcher* fetcher) { |
|
msarda
2017/01/23 09:29:28
DCHECK(fetcher);
Raj
2017/01/23 18:47:11
Done.
|
| + fetcher->SetURLRequestUserData(&kURLRequestUserDataKey, |
|
msarda
2017/01/23 09:29:28
Remove the "&"
Raj
2017/01/23 18:47:11
Done.
Raj
2017/01/23 18:47:11
Done.
|
| + base::Bind(&GaiaURLRequestUserData::Create)); |
| +} |
| + |
| } // namespace gaia |