Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(262)

Unified Diff: google_apis/gaia/gaia_auth_util.cc

Issue 2575603002: Add data usage tracking for GAIA auth api (Closed)
Patch Set: Addressed tbansal comments Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « google_apis/gaia/gaia_auth_util.h ('k') | google_apis/gaia/gaia_oauth_client.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « google_apis/gaia/gaia_auth_util.h ('k') | google_apis/gaia/gaia_oauth_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698