Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 |
| (...skipping 631 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 642 const std::string& service) { | 642 const std::string& service) { |
| 643 DCHECK(!fetch_pending_) << "Tried to fetch two things at once!"; | 643 DCHECK(!fetch_pending_) << "Tried to fetch two things at once!"; |
| 644 | 644 |
| 645 request_body_ = MakeOAuthLoginBody(service, source_); | 645 request_body_ = MakeOAuthLoginBody(service, source_); |
| 646 std::string authentication_header = | 646 std::string authentication_header = |
| 647 base::StringPrintf(kOAuth2BearerHeaderFormat, access_token.c_str()); | 647 base::StringPrintf(kOAuth2BearerHeaderFormat, access_token.c_str()); |
| 648 CreateAndStartGaiaFetcher(request_body_, authentication_header, | 648 CreateAndStartGaiaFetcher(request_body_, authentication_header, |
| 649 oauth_login_gurl_, net::LOAD_NORMAL); | 649 oauth_login_gurl_, net::LOAD_NORMAL); |
| 650 } | 650 } |
| 651 | 651 |
| 652 void GaiaAuthFetcher::StartListAccounts() { | 652 void GaiaAuthFetcher::StartListAccounts(const base::Time& profile_load_time) { |
| 653 DCHECK(!fetch_pending_) << "Tried to fetch two things at once!"; | 653 DCHECK(!fetch_pending_) << "Tried to fetch two things at once!"; |
| 654 | 654 |
| 655 // Report the time since the profile was loaded and the number of this request | |
| 656 // in order to debug channel ID issues observed on Gaia. | |
| 657 static int32_t list_accounts_request_counter = 0; | |
| 658 std::string extra_headers = base::StringPrintf( | |
| 659 "Origin: %s \r\n RequestCount: %d \r\n TimeSinceProfileLoad: %ld", | |
| 660 "https://www.google.com", list_accounts_request_counter++, | |
| 661 (base::Time::Now() - profile_load_time).InMilliseconds()); | |
| 655 CreateAndStartGaiaFetcher(" ", // To force an HTTP POST. | 662 CreateAndStartGaiaFetcher(" ", // To force an HTTP POST. |
| 656 "Origin: https://www.google.com", | 663 extra_headers, list_accounts_gurl_, |
|
vanupam
2017/02/15 03:08:28
list_accounts_gurl_ is assigned in the constructor
msarda
2017/03/01 10:26:36
Done.
| |
| 657 list_accounts_gurl_, net::LOAD_NORMAL); | 664 net::LOAD_NORMAL); |
| 658 } | 665 } |
| 659 | 666 |
| 660 void GaiaAuthFetcher::StartLogOut() { | 667 void GaiaAuthFetcher::StartLogOut() { |
| 661 DCHECK(!fetch_pending_) << "Tried to fetch two things at once!"; | 668 DCHECK(!fetch_pending_) << "Tried to fetch two things at once!"; |
| 662 | 669 |
| 663 CreateAndStartGaiaFetcher(std::string(), logout_headers_, logout_gurl_, | 670 CreateAndStartGaiaFetcher(std::string(), logout_headers_, logout_gurl_, |
| 664 net::LOAD_NORMAL); | 671 net::LOAD_NORMAL); |
| 665 } | 672 } |
| 666 | 673 |
| 667 void GaiaAuthFetcher::StartGetCheckConnectionInfo() { | 674 void GaiaAuthFetcher::StartGetCheckConnectionInfo() { |
| (...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1013 return alleged_error.find(kSecondFactor) != | 1020 return alleged_error.find(kSecondFactor) != |
| 1014 std::string::npos; | 1021 std::string::npos; |
| 1015 } | 1022 } |
| 1016 | 1023 |
| 1017 // static | 1024 // static |
| 1018 bool GaiaAuthFetcher::IsWebLoginRequiredSuccess( | 1025 bool GaiaAuthFetcher::IsWebLoginRequiredSuccess( |
| 1019 const std::string& alleged_error) { | 1026 const std::string& alleged_error) { |
| 1020 return alleged_error.find(kWebLoginRequired) != | 1027 return alleged_error.find(kWebLoginRequired) != |
| 1021 std::string::npos; | 1028 std::string::npos; |
| 1022 } | 1029 } |
| OLD | NEW |