| 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..2bbee2a8060b3dbea42872a24ad0ce85e6a9c20b 100644
|
| --- a/google_apis/gaia/gaia_auth_util.cc
|
| +++ b/google_apis/gaia/gaia_auth_util.cc
|
| @@ -8,12 +8,15 @@
|
|
|
| #include <memory>
|
|
|
| +#include "base/bind.h"
|
| #include "base/json/json_reader.h"
|
| #include "base/logging.h"
|
| #include "base/strings/string_split.h"
|
| #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 +26,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 +50,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 +193,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));
|
| +}
|
| +
|
| } // namespace gaia
|
|
|