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

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

Issue 2575603002: Add data usage tracking for GAIA auth api (Closed)
Patch Set: Addressed tbansal comments 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
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_auth_fetcher.h" 5 #include "google_apis/gaia/gaia_auth_fetcher.h"
6 6
7 #include <string> 7 #include <string>
8 #include <utility> 8 #include <utility>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/json/json_reader.h" 11 #include "base/json/json_reader.h"
12 #include "base/json/json_writer.h" 12 #include "base/json/json_writer.h"
13 #include "base/macros.h" 13 #include "base/macros.h"
14 #include "base/profiler/scoped_tracker.h" 14 #include "base/profiler/scoped_tracker.h"
15 #include "base/strings/string_split.h" 15 #include "base/strings/string_split.h"
16 #include "base/strings/string_util.h" 16 #include "base/strings/string_util.h"
17 #include "base/strings/stringprintf.h" 17 #include "base/strings/stringprintf.h"
18 #include "base/values.h" 18 #include "base/values.h"
19 #include "google_apis/gaia/gaia_auth_consumer.h" 19 #include "google_apis/gaia/gaia_auth_consumer.h"
20 #include "google_apis/gaia/gaia_auth_util.h"
20 #include "google_apis/gaia/gaia_constants.h" 21 #include "google_apis/gaia/gaia_constants.h"
21 #include "google_apis/gaia/gaia_urls.h" 22 #include "google_apis/gaia/gaia_urls.h"
22 #include "google_apis/gaia/google_service_auth_error.h" 23 #include "google_apis/gaia/google_service_auth_error.h"
23 #include "net/base/escape.h" 24 #include "net/base/escape.h"
24 #include "net/base/load_flags.h" 25 #include "net/base/load_flags.h"
25 #include "net/http/http_response_headers.h" 26 #include "net/http/http_response_headers.h"
26 #include "net/http/http_status_code.h" 27 #include "net/http/http_status_code.h"
27 #include "net/url_request/url_fetcher.h" 28 #include "net/url_request/url_fetcher.h"
28 #include "net/url_request/url_request_context_getter.h" 29 #include "net/url_request/url_request_context_getter.h"
29 #include "net/url_request/url_request_status.h" 30 #include "net/url_request/url_request_status.h"
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 void GaiaAuthFetcher::CreateAndStartGaiaFetcher(const std::string& body, 221 void GaiaAuthFetcher::CreateAndStartGaiaFetcher(const std::string& body,
221 const std::string& headers, 222 const std::string& headers,
222 const GURL& gaia_gurl, 223 const GURL& gaia_gurl,
223 int load_flags) { 224 int load_flags) {
224 DCHECK(!fetch_pending_) << "Tried to fetch two things at once!"; 225 DCHECK(!fetch_pending_) << "Tried to fetch two things at once!";
225 fetcher_ = net::URLFetcher::Create( 226 fetcher_ = net::URLFetcher::Create(
226 0, gaia_gurl, body.empty() ? net::URLFetcher::GET : net::URLFetcher::POST, 227 0, gaia_gurl, body.empty() ? net::URLFetcher::GET : net::URLFetcher::POST,
227 this); 228 this);
228 fetcher_->SetRequestContext(getter_); 229 fetcher_->SetRequestContext(getter_);
229 fetcher_->SetUploadData("application/x-www-form-urlencoded", body); 230 fetcher_->SetUploadData("application/x-www-form-urlencoded", body);
231 gaia::MarkURLFetcherAsGaia(fetcher_.get());
230 232
231 VLOG(2) << "Gaia fetcher URL: " << gaia_gurl.spec(); 233 VLOG(2) << "Gaia fetcher URL: " << gaia_gurl.spec();
232 VLOG(2) << "Gaia fetcher headers: " << headers; 234 VLOG(2) << "Gaia fetcher headers: " << headers;
233 VLOG(2) << "Gaia fetcher body: " << body; 235 VLOG(2) << "Gaia fetcher body: " << body;
234 236
235 // The Gaia token exchange requests do not require any cookie-based 237 // The Gaia token exchange requests do not require any cookie-based
236 // identification as part of requests. We suppress sending any cookies to 238 // identification as part of requests. We suppress sending any cookies to
237 // maintain a separation between the user's browsing and Chrome's internal 239 // maintain a separation between the user's browsing and Chrome's internal
238 // services. Where such mixing is desired (MergeSession or OAuthLogin), it 240 // services. Where such mixing is desired (MergeSession or OAuthLogin), it
239 // will be done explicitly. 241 // will be done explicitly.
(...skipping 771 matching lines...) Expand 10 before | Expand all | Expand 10 after
1011 return alleged_error.find(kSecondFactor) != 1013 return alleged_error.find(kSecondFactor) !=
1012 std::string::npos; 1014 std::string::npos;
1013 } 1015 }
1014 1016
1015 // static 1017 // static
1016 bool GaiaAuthFetcher::IsWebLoginRequiredSuccess( 1018 bool GaiaAuthFetcher::IsWebLoginRequiredSuccess(
1017 const std::string& alleged_error) { 1019 const std::string& alleged_error) {
1018 return alleged_error.find(kWebLoginRequired) != 1020 return alleged_error.find(kWebLoginRequired) !=
1019 std::string::npos; 1021 std::string::npos;
1020 } 1022 }
OLDNEW
« no previous file with comments | « components/data_use_measurement/core/data_use_user_data.cc ('k') | google_apis/gaia/gaia_auth_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698