Chromium Code Reviews| 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..17abc59275d86a03c755c5cf5cff71659e4bbf65 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("gaia_core_get_user_info", R"( |
| + semantics { |
| + sender: "OAuth2 Client" |
| + description: "This request is used to fetch user information." |
| + trigger: |
| + "The main trigger for this request in the AccountTrackerService " |
| + "that fetches the user info soon after the user signs in." |
| + data: |
| + "The OAUth2 access token of the account." |
| + destination: GOOGLE_OWNED_SERVICE |
| + } |
| + policy { |
| + cookies_allowed: false |
| + setting: "This feature cannot be disabled in settings." |
| + policy_exception_justification: |
| + "Not implemented. Disabling this fetcher would break features that " |
| + "require user information about of the account that is signed in (" |
| + "e.g. the profile switcher UI, the settings UI etc)." |
| + })"); |
| 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 = |
|
msarda
2017/05/16 13:38:29
This is again one of these cases when this is a ge
|
| + net::DefineNetworkTrafficAnnotation("...", R"( |
| + 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); |