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 "base/strings/string_split.h" | 7 #include "base/strings/string_split.h" |
8 #include "base/trace_event/trace_event.h" | 8 #include "base/trace_event/trace_event.h" |
9 #include "components/signin/core/browser/account_fetcher_service.h" | 9 #include "components/signin/core/browser/account_fetcher_service.h" |
10 #include "components/signin/core/browser/signin_client.h" | 10 #include "components/signin/core/browser/signin_client.h" |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 | 89 |
90 void AccountInfoFetcher::OnClientLoginFailure( | 90 void AccountInfoFetcher::OnClientLoginFailure( |
91 const GoogleServiceAuthError& error) { | 91 const GoogleServiceAuthError& error) { |
92 service_->OnUserInfoFetchFailure(account_id_); | 92 service_->OnUserInfoFetchFailure(account_id_); |
93 } | 93 } |
94 | 94 |
95 void AccountInfoFetcher::OnGetUserInfoSuccess(const UserInfoMap& data) { | 95 void AccountInfoFetcher::OnGetUserInfoSuccess(const UserInfoMap& data) { |
96 fetched_service_flags_.reset(new std::vector<std::string>); | 96 fetched_service_flags_.reset(new std::vector<std::string>); |
97 UserInfoMap::const_iterator services_iter = data.find("allServices"); | 97 UserInfoMap::const_iterator services_iter = data.find("allServices"); |
98 if (services_iter != data.end()) { | 98 if (services_iter != data.end()) { |
99 base::SplitString(services_iter->second, ',', fetched_service_flags_.get()); | 99 *fetched_service_flags_.get() = base::SplitString( |
| 100 services_iter->second, ",", |
| 101 base::KEEP_WHITESPACE, base::SPLIT_WANT_ALL); |
100 SendSuccessIfDoneFetching(); | 102 SendSuccessIfDoneFetching(); |
101 } else { | 103 } else { |
102 DLOG(WARNING) << "AccountInfoFetcher::OnGetUserInfoSuccess: " | 104 DLOG(WARNING) << "AccountInfoFetcher::OnGetUserInfoSuccess: " |
103 << "GetUserInfo response didn't include allServices field."; | 105 << "GetUserInfo response didn't include allServices field."; |
104 service_->OnUserInfoFetchFailure(account_id_); | 106 service_->OnUserInfoFetchFailure(account_id_); |
105 } | 107 } |
106 } | 108 } |
107 | 109 |
108 void AccountInfoFetcher::OnGetUserInfoFailure( | 110 void AccountInfoFetcher::OnGetUserInfoFailure( |
109 const GoogleServiceAuthError& error) { | 111 const GoogleServiceAuthError& error) { |
110 service_->OnUserInfoFetchFailure(account_id_); | 112 service_->OnUserInfoFetchFailure(account_id_); |
111 } | 113 } |
112 | 114 |
113 void AccountInfoFetcher::OnOAuthError() { | 115 void AccountInfoFetcher::OnOAuthError() { |
114 TRACE_EVENT_ASYNC_STEP_PAST0("AccountFetcherService", "AccountIdFetcher", | 116 TRACE_EVENT_ASYNC_STEP_PAST0("AccountFetcherService", "AccountIdFetcher", |
115 this, "OnOAuthError"); | 117 this, "OnOAuthError"); |
116 LOG(ERROR) << "OnOAuthError"; | 118 LOG(ERROR) << "OnOAuthError"; |
117 service_->OnUserInfoFetchFailure(account_id_); | 119 service_->OnUserInfoFetchFailure(account_id_); |
118 } | 120 } |
119 | 121 |
120 void AccountInfoFetcher::OnNetworkError(int response_code) { | 122 void AccountInfoFetcher::OnNetworkError(int response_code) { |
121 TRACE_EVENT_ASYNC_STEP_PAST1("AccountFetcherService", "AccountIdFetcher", | 123 TRACE_EVENT_ASYNC_STEP_PAST1("AccountFetcherService", "AccountIdFetcher", |
122 this, "OnNetworkError", "response_code", | 124 this, "OnNetworkError", "response_code", |
123 response_code); | 125 response_code); |
124 LOG(ERROR) << "OnNetworkError " << response_code; | 126 LOG(ERROR) << "OnNetworkError " << response_code; |
125 service_->OnUserInfoFetchFailure(account_id_); | 127 service_->OnUserInfoFetchFailure(account_id_); |
126 } | 128 } |
OLD | NEW |