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

Side by Side Diff: components/signin/core/browser/gaia_cookie_manager_service.cc

Issue 2797173003: Network traffic annotation added to gaia_cookie_manager_service. (Closed)
Patch Set: Annotation updated. 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "components/signin/core/browser/gaia_cookie_manager_service.h" 5 #include "components/signin/core/browser/gaia_cookie_manager_service.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <queue> 9 #include <queue>
10 10
11 #include "base/format_macros.h" 11 #include "base/format_macros.h"
12 #include "base/json/json_reader.h" 12 #include "base/json/json_reader.h"
13 #include "base/metrics/histogram_macros.h" 13 #include "base/metrics/histogram_macros.h"
14 #include "base/stl_util.h" 14 #include "base/stl_util.h"
15 #include "base/strings/string_util.h" 15 #include "base/strings/string_util.h"
16 #include "base/strings/stringprintf.h" 16 #include "base/strings/stringprintf.h"
17 #include "base/time/time.h" 17 #include "base/time/time.h"
18 #include "base/values.h" 18 #include "base/values.h"
19 #include "components/data_use_measurement/core/data_use_user_data.h" 19 #include "components/data_use_measurement/core/data_use_user_data.h"
20 #include "components/signin/core/browser/account_tracker_service.h" 20 #include "components/signin/core/browser/account_tracker_service.h"
21 #include "components/signin/core/browser/signin_metrics.h" 21 #include "components/signin/core/browser/signin_metrics.h"
22 #include "google_apis/gaia/gaia_auth_fetcher.h" 22 #include "google_apis/gaia/gaia_auth_fetcher.h"
23 #include "google_apis/gaia/gaia_constants.h" 23 #include "google_apis/gaia/gaia_constants.h"
24 #include "google_apis/gaia/gaia_urls.h" 24 #include "google_apis/gaia/gaia_urls.h"
25 #include "google_apis/gaia/oauth2_token_service.h" 25 #include "google_apis/gaia/oauth2_token_service.h"
26 #include "net/base/load_flags.h" 26 #include "net/base/load_flags.h"
27 #include "net/http/http_status_code.h" 27 #include "net/http/http_status_code.h"
28 #include "net/traffic_annotation/network_traffic_annotation.h"
28 #include "net/url_request/url_fetcher.h" 29 #include "net/url_request/url_fetcher.h"
29 #include "net/url_request/url_fetcher_delegate.h" 30 #include "net/url_request/url_fetcher_delegate.h"
30 31
31 namespace { 32 namespace {
32 33
33 // In case of an error while fetching using the GaiaAuthFetcher or URLFetcher, 34 // In case of an error while fetching using the GaiaAuthFetcher or URLFetcher,
34 // retry with exponential backoff. Try up to 7 times within 15 minutes. 35 // retry with exponential backoff. Try up to 7 times within 15 minutes.
35 const net::BackoffEntry::Policy kBackoffPolicy = { 36 const net::BackoffEntry::Policy kBackoffPolicy = {
36 // Number of initial errors (in sequence) to ignore before applying 37 // Number of initial errors (in sequence) to ignore before applying
37 // exponential back-off rules. 38 // exponential back-off rules.
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 // * The result of merging accounts to Gaia cookies will not be affected. 207 // * The result of merging accounts to Gaia cookies will not be affected.
207 // * Gaia will need make its own call about whether to check them itself, 208 // * Gaia will need make its own call about whether to check them itself,
208 // of make some other assumptions. 209 // of make some other assumptions.
209 CleanupTransientState(); 210 CleanupTransientState();
210 GetCheckConnectionInfoCompleted(false); 211 GetCheckConnectionInfoCompleted(false);
211 } 212 }
212 213
213 std::unique_ptr<net::URLFetcher> 214 std::unique_ptr<net::URLFetcher>
214 GaiaCookieManagerService::ExternalCcResultFetcher::CreateFetcher( 215 GaiaCookieManagerService::ExternalCcResultFetcher::CreateFetcher(
215 const GURL& url) { 216 const GURL& url) {
216 std::unique_ptr<net::URLFetcher> fetcher = 217 net::NetworkTrafficAnnotationTag traffic_annotation =
217 net::URLFetcher::Create(0, url, net::URLFetcher::GET, this); 218 net::DefineNetworkTrafficAnnotation(
219 "gaia_cookie_manager_external_cc_result", R"(
220 semantics {
221 sender: "Gaia Cookie Manager"
222 description:
223 "This request is used by the GaiaCookieManager when adding an "
224 "account to the Gaia cookie. It checks the server connection "
msarda 2017/04/25 07:50:49 s/cookie/cookies
Ramin Halavati 2017/04/25 07:56:26 Done.
225 "state."
226 trigger:
227 "This is used only once in the first merge session flow by the "
228 "GaiaCookieManager. The value of the first fetch is stored for "
229 "future uses."
230 data: "None."
231 destination: GOOGLE_OWNED_SERVICE
232 }
233 policy {
234 cookies_allowed: false
235 setting: "This feature cannot be disabled in settings."
236 policy_exception_justification:
237 "Not implemented. Disabling GaiaCookieManager would break "
238 "features that depend on it (like account consistency and "
239 "support for child accounts). It makes sense to control top "
240 "level features that use the GaiaCookieManager."
241 })");
242 std::unique_ptr<net::URLFetcher> fetcher = net::URLFetcher::Create(
243 0, url, net::URLFetcher::GET, this, traffic_annotation);
218 fetcher->SetRequestContext(helper_->request_context()); 244 fetcher->SetRequestContext(helper_->request_context());
219 fetcher->SetLoadFlags(net::LOAD_DO_NOT_SEND_COOKIES | 245 fetcher->SetLoadFlags(net::LOAD_DO_NOT_SEND_COOKIES |
220 net::LOAD_DO_NOT_SAVE_COOKIES); 246 net::LOAD_DO_NOT_SAVE_COOKIES);
221 data_use_measurement::DataUseUserData::AttachToFetcher( 247 data_use_measurement::DataUseUserData::AttachToFetcher(
222 fetcher.get(), data_use_measurement::DataUseUserData::SIGNIN); 248 fetcher.get(), data_use_measurement::DataUseUserData::SIGNIN);
223 249
224 // Fetchers are sometimes cancelled because a network change was detected, 250 // Fetchers are sometimes cancelled because a network change was detected,
225 // especially at startup and after sign-in on ChromeOS. 251 // especially at startup and after sign-in on ChromeOS.
226 fetcher->SetAutomaticallyRetryOnNetworkChanges(1); 252 fetcher->SetAutomaticallyRetryOnNetworkChanges(1);
227 return fetcher; 253 return fetcher;
(...skipping 588 matching lines...) Expand 10 before | Expand all | Expand 10 after
816 break; 842 break;
817 case GaiaCookieRequestType::LIST_ACCOUNTS: 843 case GaiaCookieRequestType::LIST_ACCOUNTS:
818 uber_token_fetcher_.reset(); 844 uber_token_fetcher_.reset();
819 signin_client_->DelayNetworkCall( 845 signin_client_->DelayNetworkCall(
820 base::Bind(&GaiaCookieManagerService::StartFetchingListAccounts, 846 base::Bind(&GaiaCookieManagerService::StartFetchingListAccounts,
821 base::Unretained(this))); 847 base::Unretained(this)));
822 break; 848 break;
823 } 849 }
824 } 850 }
825 } 851 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698