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..06655ea2df040e5d9953ab84aecb5919c61f2cb5 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,9 @@ namespace { |
| const char kGmailDomain[] = "gmail.com"; |
| const char kGooglemailDomain[] = "googlemail.com"; |
| +const void* kURLRequestUserDataKey = |
| + static_cast<const void*>(&kURLRequestUserDataKey); |
| + |
| std::string CanonicalizeEmailImpl(const std::string& email_address, |
| bool change_googlemail_to_gmail) { |
| std::vector<std::string> parts = base::SplitString( |
| @@ -44,6 +49,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(); |
|
tbansal1
2017/01/23 21:03:05
qq, who frees up this data? (I do not know enough
Raj
2017/01/23 21:53:02
It will be owned by SupportsUserData and freed in
|
| + } |
| +}; |
| + |
| } // namespace |
| @@ -180,4 +192,14 @@ bool ParseListAccountsData(const std::string& data, |
| return true; |
| } |
| +bool RequestOriginatedFromGaia(const net::URLRequest& request) { |
| + return request.GetUserData(kURLRequestUserDataKey) != nullptr; |
| +} |
| + |
| +void MarkURLFetcherAsGaia(net::URLFetcher* fetcher) { |
| + DCHECK(fetcher); |
| + fetcher->SetURLRequestUserData(kURLRequestUserDataKey, |
| + base::Bind(&GaiaURLRequestUserData::Create)); |
|
tbansal1
2017/01/23 21:03:05
#include "base/bind.h"
Raj
2017/01/23 21:53:02
Done.
|
| +} |
| + |
| } // namespace gaia |