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

Unified Diff: google_apis/gaia/gaia_oauth_client.cc

Issue 2796293003: Network traffic annotation added to google_apis/gaia. (Closed)
Patch Set: Annotation moved to input argument. Created 3 years, 7 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 | « no previous file | google_apis/gaia/oauth2_access_token_fetcher_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
« no previous file with comments | « no previous file | google_apis/gaia/oauth2_access_token_fetcher_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698