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

Unified Diff: google_apis/gaia/gaia_oauth_client.cc

Issue 2796293003: Network traffic annotation added to google_apis/gaia. (Closed)
Patch Set: Created 3 years, 8 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
Index: google_apis/gaia/gaia_oauth_client.cc
diff --git a/google_apis/gaia/gaia_oauth_client.cc b/google_apis/gaia/gaia_oauth_client.cc
index 8947febbc4dc270bed73f7d7ed2bf00e2be9bfd1..6b5cdaffa68e6aceb5d55aaec9553e16a47d8149 100644
--- a/google_apis/gaia/gaia_oauth_client.cc
+++ b/google_apis/gaia/gaia_oauth_client.cc
@@ -16,6 +16,7 @@
#include "net/base/escape.h"
#include "net/base/load_flags.h"
#include "net/http/http_status_code.h"
+#include "net/traffic_annotation/network_traffic_annotation.h"
#include "net/url_request/url_fetcher.h"
#include "net/url_request/url_fetcher_delegate.h"
#include "net/url_request/url_request_context_getter.h"
@@ -176,9 +177,29 @@ void GaiaOAuthClient::Core::GetUserInfoImpl(
request_type_ = type;
delegate_ = delegate;
num_retries_ = 0;
+ net::NetworkTrafficAnnotationTag traffic_annotation =
+ net::DefineNetworkTrafficAnnotation("...", R"(
+ semantics {
+ sender: "..."
msarda 2017/05/03 09:03:53 OAuth2 client.
Ramin Halavati 2017/05/03 09:45:07 Done.
+ description: "..."
msarda 2017/05/03 09:03:53 This request is used to fetch user information.
Ramin Halavati 2017/05/03 09:45:07 Done.
+ trigger: "..."
msarda 2017/05/03 09:03:53 The main trigger for this request in the AccountTr
Ramin Halavati 2017/05/03 09:45:07 Done.
+ data: "..."
msarda 2017/05/03 09:03:53 The request is authorized, so the header of this r
Ramin Halavati 2017/05/03 09:45:07 Done.
+ destination: WEBSITE/GOOGLE_OWNED_SERVICE/OTHER
msarda 2017/05/03 09:03:53 GOOGLE_OWNED_SERVICE
Ramin Halavati 2017/05/03 09:45:07 Done.
+ }
+ policy {
+ cookies_allowed: false
+ setting: "..."
msarda 2017/05/03 09:03:53 "This feature cannot be disabled in settings."
Ramin Halavati 2017/05/03 09:45:07 Done.
+ chrome_policy {
msarda 2017/05/03 09:03:53 Remove block
Ramin Halavati 2017/05/03 09:45:07 Done.
+ [POLICY_NAME] {
+ policy_options {mode: MANDATORY/RECOMMENDED/UNSET}
+ [POLICY_NAME]: ... //(value to disable it)
+ }
+ }
+ policy_exception_justification: "..."
msarda 2017/05/03 09:03:53 "Not implemented. Disabling this fetcher would bre
Ramin Halavati 2017/05/03 09:45:07 Done.
+ })");
request_ = net::URLFetcher::Create(
kUrlFetcherId, GURL(GaiaUrls::GetInstance()->oauth_user_info_url()),
- net::URLFetcher::GET, this);
+ net::URLFetcher::GET, this, traffic_annotation);
request_->SetRequestContext(request_context_getter_.get());
request_->AddExtraRequestHeader("Authorization: OAuth " + oauth_access_token);
request_->SetMaxRetriesOn5xx(max_retries);
@@ -217,8 +238,28 @@ void GaiaOAuthClient::Core::MakeGaiaRequest(
DCHECK(!request_.get()) << "Tried to fetch two things at once!";
delegate_ = delegate;
num_retries_ = 0;
- request_ =
- net::URLFetcher::Create(kUrlFetcherId, url, net::URLFetcher::POST, this);
+ net::NetworkTrafficAnnotationTag traffic_annotation =
+ net::DefineNetworkTrafficAnnotation("...", R"(
Ramin Halavati 2017/05/03 09:45:07 Should I use the same annotation for this function
+ semantics {
+ sender: "..."
+ description: "..."
+ trigger: "..."
+ data: "..."
+ destination: WEBSITE/GOOGLE_OWNED_SERVICE/OTHER
+ }
+ policy {
+ cookies_allowed: false
+ setting: "..."
+ chrome_policy {
+ [POLICY_NAME] {
+ policy_options {mode: MANDATORY/RECOMMENDED/UNSET}
+ [POLICY_NAME]: ... //(value to disable it)
+ }
+ }
+ policy_exception_justification: "..."
+ })");
+ request_ = net::URLFetcher::Create(kUrlFetcherId, url, net::URLFetcher::POST,
+ this, traffic_annotation);
request_->SetRequestContext(request_context_getter_.get());
request_->SetUploadData("application/x-www-form-urlencoded", post_body);
request_->SetMaxRetriesOn5xx(max_retries);

Powered by Google App Engine
This is Rietveld 408576698