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

Side by Side Diff: google_apis/gaia/gaia_oauth_client.cc

Issue 2486423002: Add data usage tracking for GAIA auth api and GCM engine service (Closed)
Patch Set: Fixed DEPS Created 4 years, 1 month 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "google_apis/gaia/gaia_oauth_client.h" 5 #include "google_apis/gaia/gaia_oauth_client.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/json/json_reader.h" 10 #include "base/json/json_reader.h"
11 #include "base/logging.h" 11 #include "base/logging.h"
12 #include "base/strings/string_util.h" 12 #include "base/strings/string_util.h"
13 #include "base/values.h" 13 #include "base/values.h"
14 #include "components/data_use_measurement/core/data_use_user_data.h"
14 #include "google_apis/gaia/gaia_urls.h" 15 #include "google_apis/gaia/gaia_urls.h"
15 #include "net/base/escape.h" 16 #include "net/base/escape.h"
16 #include "net/base/load_flags.h" 17 #include "net/base/load_flags.h"
17 #include "net/http/http_status_code.h" 18 #include "net/http/http_status_code.h"
18 #include "net/url_request/url_fetcher.h" 19 #include "net/url_request/url_fetcher.h"
19 #include "net/url_request/url_fetcher_delegate.h" 20 #include "net/url_request/url_fetcher_delegate.h"
20 #include "net/url_request/url_request_context_getter.h" 21 #include "net/url_request/url_request_context_getter.h"
21 #include "url/gurl.h" 22 #include "url/gurl.h"
22 23
23 namespace { 24 namespace {
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 delegate_ = delegate; 177 delegate_ = delegate;
177 num_retries_ = 0; 178 num_retries_ = 0;
178 request_ = net::URLFetcher::Create( 179 request_ = net::URLFetcher::Create(
179 kUrlFetcherId, GURL(GaiaUrls::GetInstance()->oauth_user_info_url()), 180 kUrlFetcherId, GURL(GaiaUrls::GetInstance()->oauth_user_info_url()),
180 net::URLFetcher::GET, this); 181 net::URLFetcher::GET, this);
181 request_->SetRequestContext(request_context_getter_.get()); 182 request_->SetRequestContext(request_context_getter_.get());
182 request_->AddExtraRequestHeader("Authorization: OAuth " + oauth_access_token); 183 request_->AddExtraRequestHeader("Authorization: OAuth " + oauth_access_token);
183 request_->SetMaxRetriesOn5xx(max_retries); 184 request_->SetMaxRetriesOn5xx(max_retries);
184 request_->SetLoadFlags(net::LOAD_DO_NOT_SEND_COOKIES | 185 request_->SetLoadFlags(net::LOAD_DO_NOT_SEND_COOKIES |
185 net::LOAD_DO_NOT_SAVE_COOKIES); 186 net::LOAD_DO_NOT_SAVE_COOKIES);
187 data_use_measurement::DataUseUserData::AttachToFetcher(
188 request_.get(), data_use_measurement::DataUseUserData::GAIA_AUTH_FETCHER);
186 189
187 // Fetchers are sometimes cancelled because a network change was detected, 190 // Fetchers are sometimes cancelled because a network change was detected,
188 // especially at startup and after sign-in on ChromeOS. Retrying once should 191 // especially at startup and after sign-in on ChromeOS. Retrying once should
189 // be enough in those cases; let the fetcher retry up to 3 times just in case. 192 // be enough in those cases; let the fetcher retry up to 3 times just in case.
190 // http://crbug.com/163710 193 // http://crbug.com/163710
191 request_->SetAutomaticallyRetryOnNetworkChanges(3); 194 request_->SetAutomaticallyRetryOnNetworkChanges(3);
192 request_->Start(); 195 request_->Start();
193 } 196 }
194 197
195 void GaiaOAuthClient::Core::GetTokenInfo(const std::string& qualifier, 198 void GaiaOAuthClient::Core::GetTokenInfo(const std::string& qualifier,
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
405 } 408 }
406 409
407 void GaiaOAuthClient::GetTokenHandleInfo(const std::string& token_handle, 410 void GaiaOAuthClient::GetTokenHandleInfo(const std::string& token_handle,
408 int max_retries, 411 int max_retries,
409 Delegate* delegate) { 412 Delegate* delegate) {
410 return core_->GetTokenInfo("token_handle", token_handle, max_retries, 413 return core_->GetTokenInfo("token_handle", token_handle, max_retries,
411 delegate); 414 delegate);
412 } 415 }
413 416
414 } // namespace gaia 417 } // namespace gaia
OLDNEW
« no previous file with comments | « google_apis/gaia/gaia_auth_fetcher.cc ('k') | google_apis/gaia/oauth2_access_token_fetcher_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698