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

Unified Diff: google_apis/gaia/gaia_auth_util.cc

Issue 2575603002: Add data usage tracking for GAIA auth api (Closed)
Patch Set: rebased Created 4 years 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
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

Powered by Google App Engine
This is Rietveld 408576698