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

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: 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("...", R"(
msarda 2017/04/24 12:01:52 gaia_cookie_manager::external_cc_result
Ramin Halavati 2017/04/25 05:22:28 Done.
219 semantics {
220 sender: "..."
msarda 2017/04/24 12:01:52 GaiaCookieManagerService::ExternalCcResultFetcher
Ramin Halavati 2017/04/25 05:22:28 We usually use shorter names, representing the com
msarda 2017/04/25 07:50:49 SGTM.
Ramin Halavati 2017/04/25 07:56:26 Acknowledged.
221 description: "..."
msarda 2017/04/24 12:01:52 GaiaCookieManager::ExternalCcResultFetcher is used
Ramin Halavati 2017/04/25 05:22:28 Done.
222 trigger: "..."
msarda 2017/04/24 12:01:52 GaiaCookieManager::ExternalCcResultFetcher is used
Ramin Halavati 2017/04/25 05:22:28 Done.
223 data: "..."
msarda 2017/04/24 12:01:52 No user-specific data (see https://cs.chromium.org
Ramin Halavati 2017/04/25 05:22:28 Isn't there anything else sent? If yes, please bri
msarda 2017/04/25 07:50:49 I read again the code in https://cs.chromium.org/c
Ramin Halavati 2017/04/25 07:56:26 Thank you for confirmation.
224 destination: WEBSITE/GOOGLE_OWNED_SERVICE/OTHER
msarda 2017/04/24 12:01:52 GOOGLE_OWNED_SERVICE
Ramin Halavati 2017/04/25 05:22:28 Done.
225 }
226 policy {
227 cookies_allowed: false/true
msarda 2017/04/24 12:01:52 false.
Ramin Halavati 2017/04/25 05:22:28 Done.
228 cookies_store: "..."
229 setting: "..."
msarda 2017/04/24 12:01:52 This feature cannot be disabled.
Ramin Halavati 2017/04/25 05:22:28 Done.
230 chrome_policy {
231 [POLICY_NAME] {
msarda 2017/04/24 12:01:52 This feature cannot be enabled or disabled by poli
Ramin Halavati 2017/04/25 05:22:29 Done.
232 policy_options {mode: MANDATORY/RECOMMENDED/UNSET}
233 [POLICY_NAME]: ... //(value to disable it)
234 }
235 }
236 policy_exception_justification: "..."
msarda 2017/04/24 12:01:52 Not implemented. Disabling GaiaCookieManager would
Ramin Halavati 2017/04/25 05:22:29 Done.
237 })");
238 std::unique_ptr<net::URLFetcher> fetcher = net::URLFetcher::Create(
239 0, url, net::URLFetcher::GET, this, traffic_annotation);
218 fetcher->SetRequestContext(helper_->request_context()); 240 fetcher->SetRequestContext(helper_->request_context());
219 fetcher->SetLoadFlags(net::LOAD_DO_NOT_SEND_COOKIES | 241 fetcher->SetLoadFlags(net::LOAD_DO_NOT_SEND_COOKIES |
220 net::LOAD_DO_NOT_SAVE_COOKIES); 242 net::LOAD_DO_NOT_SAVE_COOKIES);
221 data_use_measurement::DataUseUserData::AttachToFetcher( 243 data_use_measurement::DataUseUserData::AttachToFetcher(
222 fetcher.get(), data_use_measurement::DataUseUserData::SIGNIN); 244 fetcher.get(), data_use_measurement::DataUseUserData::SIGNIN);
223 245
224 // Fetchers are sometimes cancelled because a network change was detected, 246 // Fetchers are sometimes cancelled because a network change was detected,
225 // especially at startup and after sign-in on ChromeOS. 247 // especially at startup and after sign-in on ChromeOS.
226 fetcher->SetAutomaticallyRetryOnNetworkChanges(1); 248 fetcher->SetAutomaticallyRetryOnNetworkChanges(1);
227 return fetcher; 249 return fetcher;
(...skipping 588 matching lines...) Expand 10 before | Expand all | Expand 10 after
816 break; 838 break;
817 case GaiaCookieRequestType::LIST_ACCOUNTS: 839 case GaiaCookieRequestType::LIST_ACCOUNTS:
818 uber_token_fetcher_.reset(); 840 uber_token_fetcher_.reset();
819 signin_client_->DelayNetworkCall( 841 signin_client_->DelayNetworkCall(
820 base::Bind(&GaiaCookieManagerService::StartFetchingListAccounts, 842 base::Bind(&GaiaCookieManagerService::StartFetchingListAccounts,
821 base::Unretained(this))); 843 base::Unretained(this)));
822 break; 844 break;
823 } 845 }
824 } 846 }
825 } 847 }
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