| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/account_info_fetcher.h" | 5 #include "components/signin/core/browser/account_info_fetcher.h" |
| 6 | 6 |
| 7 #include <utility> |
| 8 |
| 7 #include "base/trace_event/trace_event.h" | 9 #include "base/trace_event/trace_event.h" |
| 8 #include "components/signin/core/browser/account_fetcher_service.h" | 10 #include "components/signin/core/browser/account_fetcher_service.h" |
| 9 #include "google_apis/gaia/gaia_constants.h" | 11 #include "google_apis/gaia/gaia_constants.h" |
| 10 | 12 |
| 11 AccountInfoFetcher::AccountInfoFetcher( | 13 AccountInfoFetcher::AccountInfoFetcher( |
| 12 OAuth2TokenService* token_service, | 14 OAuth2TokenService* token_service, |
| 13 net::URLRequestContextGetter* request_context_getter, | 15 net::URLRequestContextGetter* request_context_getter, |
| 14 AccountFetcherService* service, | 16 AccountFetcherService* service, |
| 15 const std::string& account_id) | 17 const std::string& account_id) |
| 16 : OAuth2TokenService::Consumer("gaia_account_tracker"), | 18 : OAuth2TokenService::Consumer("gaia_account_tracker"), |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 LOG(ERROR) << "OnGetTokenFailure: " << error.ToString(); | 58 LOG(ERROR) << "OnGetTokenFailure: " << error.ToString(); |
| 57 DCHECK_EQ(request, login_token_request_.get()); | 59 DCHECK_EQ(request, login_token_request_.get()); |
| 58 service_->OnUserInfoFetchFailure(account_id_); | 60 service_->OnUserInfoFetchFailure(account_id_); |
| 59 } | 61 } |
| 60 | 62 |
| 61 void AccountInfoFetcher::OnGetUserInfoResponse( | 63 void AccountInfoFetcher::OnGetUserInfoResponse( |
| 62 scoped_ptr<base::DictionaryValue> user_info) { | 64 scoped_ptr<base::DictionaryValue> user_info) { |
| 63 TRACE_EVENT_ASYNC_STEP_PAST1("AccountFetcherService", "AccountIdFetcher", | 65 TRACE_EVENT_ASYNC_STEP_PAST1("AccountFetcherService", "AccountIdFetcher", |
| 64 this, "OnGetUserInfoResponse", "account_id", | 66 this, "OnGetUserInfoResponse", "account_id", |
| 65 account_id_); | 67 account_id_); |
| 66 service_->OnUserInfoFetchSuccess(account_id_, user_info.Pass()); | 68 service_->OnUserInfoFetchSuccess(account_id_, std::move(user_info)); |
| 67 } | 69 } |
| 68 | 70 |
| 69 void AccountInfoFetcher::OnOAuthError() { | 71 void AccountInfoFetcher::OnOAuthError() { |
| 70 TRACE_EVENT_ASYNC_STEP_PAST0("AccountFetcherService", "AccountIdFetcher", | 72 TRACE_EVENT_ASYNC_STEP_PAST0("AccountFetcherService", "AccountIdFetcher", |
| 71 this, "OnOAuthError"); | 73 this, "OnOAuthError"); |
| 72 LOG(ERROR) << "OnOAuthError"; | 74 LOG(ERROR) << "OnOAuthError"; |
| 73 service_->OnUserInfoFetchFailure(account_id_); | 75 service_->OnUserInfoFetchFailure(account_id_); |
| 74 } | 76 } |
| 75 | 77 |
| 76 void AccountInfoFetcher::OnNetworkError(int response_code) { | 78 void AccountInfoFetcher::OnNetworkError(int response_code) { |
| 77 TRACE_EVENT_ASYNC_STEP_PAST1("AccountFetcherService", "AccountIdFetcher", | 79 TRACE_EVENT_ASYNC_STEP_PAST1("AccountFetcherService", "AccountIdFetcher", |
| 78 this, "OnNetworkError", "response_code", | 80 this, "OnNetworkError", "response_code", |
| 79 response_code); | 81 response_code); |
| 80 LOG(ERROR) << "OnNetworkError " << response_code; | 82 LOG(ERROR) << "OnNetworkError " << response_code; |
| 81 service_->OnUserInfoFetchFailure(account_id_); | 83 service_->OnUserInfoFetchFailure(account_id_); |
| 82 } | 84 } |
| OLD | NEW |