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

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

Issue 2643013004: Add data usage tracking for chrome services (Closed)
Patch Set: rebased Created 3 years, 11 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 | « components/signin/core/browser/DEPS ('k') | components/web_resource/BUILD.gn » ('j') | 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/json/json_reader.h" 11 #include "base/json/json_reader.h"
12 #include "base/metrics/histogram_macros.h" 12 #include "base/metrics/histogram_macros.h"
13 #include "base/stl_util.h" 13 #include "base/stl_util.h"
14 #include "base/strings/string_util.h" 14 #include "base/strings/string_util.h"
15 #include "base/strings/stringprintf.h" 15 #include "base/strings/stringprintf.h"
16 #include "base/time/time.h" 16 #include "base/time/time.h"
17 #include "base/values.h" 17 #include "base/values.h"
18 #include "components/data_use_measurement/core/data_use_user_data.h"
18 #include "components/signin/core/browser/account_tracker_service.h" 19 #include "components/signin/core/browser/account_tracker_service.h"
19 #include "components/signin/core/browser/signin_metrics.h" 20 #include "components/signin/core/browser/signin_metrics.h"
20 #include "google_apis/gaia/gaia_auth_fetcher.h" 21 #include "google_apis/gaia/gaia_auth_fetcher.h"
21 #include "google_apis/gaia/gaia_constants.h" 22 #include "google_apis/gaia/gaia_constants.h"
22 #include "google_apis/gaia/gaia_urls.h" 23 #include "google_apis/gaia/gaia_urls.h"
23 #include "google_apis/gaia/oauth2_token_service.h" 24 #include "google_apis/gaia/oauth2_token_service.h"
24 #include "net/base/load_flags.h" 25 #include "net/base/load_flags.h"
25 #include "net/http/http_status_code.h" 26 #include "net/http/http_status_code.h"
26 #include "net/url_request/url_fetcher.h" 27 #include "net/url_request/url_fetcher.h"
27 #include "net/url_request/url_fetcher_delegate.h" 28 #include "net/url_request/url_fetcher_delegate.h"
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 } 217 }
217 218
218 std::unique_ptr<net::URLFetcher> 219 std::unique_ptr<net::URLFetcher>
219 GaiaCookieManagerService::ExternalCcResultFetcher::CreateFetcher( 220 GaiaCookieManagerService::ExternalCcResultFetcher::CreateFetcher(
220 const GURL& url) { 221 const GURL& url) {
221 std::unique_ptr<net::URLFetcher> fetcher = 222 std::unique_ptr<net::URLFetcher> fetcher =
222 net::URLFetcher::Create(0, url, net::URLFetcher::GET, this); 223 net::URLFetcher::Create(0, url, net::URLFetcher::GET, this);
223 fetcher->SetRequestContext(helper_->request_context()); 224 fetcher->SetRequestContext(helper_->request_context());
224 fetcher->SetLoadFlags(net::LOAD_DO_NOT_SEND_COOKIES | 225 fetcher->SetLoadFlags(net::LOAD_DO_NOT_SEND_COOKIES |
225 net::LOAD_DO_NOT_SAVE_COOKIES); 226 net::LOAD_DO_NOT_SAVE_COOKIES);
227 data_use_measurement::DataUseUserData::AttachToFetcher(
228 fetcher.get(), data_use_measurement::DataUseUserData::SIGNIN);
226 229
227 // Fetchers are sometimes cancelled because a network change was detected, 230 // Fetchers are sometimes cancelled because a network change was detected,
228 // especially at startup and after sign-in on ChromeOS. 231 // especially at startup and after sign-in on ChromeOS.
229 fetcher->SetAutomaticallyRetryOnNetworkChanges(1); 232 fetcher->SetAutomaticallyRetryOnNetworkChanges(1);
230 return fetcher; 233 return fetcher;
231 } 234 }
232 235
233 void GaiaCookieManagerService::ExternalCcResultFetcher::OnURLFetchComplete( 236 void GaiaCookieManagerService::ExternalCcResultFetcher::OnURLFetchComplete(
234 const net::URLFetcher* source) { 237 const net::URLFetcher* source) {
235 const GURL& url = source->GetOriginalURL(); 238 const GURL& url = source->GetOriginalURL();
(...skipping 570 matching lines...) Expand 10 before | Expand all | Expand 10 after
806 break; 809 break;
807 case GaiaCookieRequestType::LIST_ACCOUNTS: 810 case GaiaCookieRequestType::LIST_ACCOUNTS:
808 uber_token_fetcher_.reset(); 811 uber_token_fetcher_.reset();
809 signin_client_->DelayNetworkCall( 812 signin_client_->DelayNetworkCall(
810 base::Bind(&GaiaCookieManagerService::StartFetchingListAccounts, 813 base::Bind(&GaiaCookieManagerService::StartFetchingListAccounts,
811 base::Unretained(this))); 814 base::Unretained(this)));
812 break; 815 break;
813 } 816 }
814 } 817 }
815 } 818 }
OLDNEW
« no previous file with comments | « components/signin/core/browser/DEPS ('k') | components/web_resource/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698