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

Side by Side Diff: chrome/browser/extensions/api/identity/account_tracker.cc

Issue 240453006: Fix sign-in error strings. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Put error in button Created 6 years, 7 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "chrome/browser/extensions/api/identity/account_tracker.h" 5 #include "chrome/browser/extensions/api/identity/account_tracker.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/stl_util.h" 8 #include "base/stl_util.h"
9 #include "chrome/browser/browser_process.h" 9 #include "chrome/browser/browser_process.h"
10 #include "chrome/browser/chrome_notification_types.h" 10 #include "chrome/browser/chrome_notification_types.h"
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 StopTrackingAccount(key); 199 StopTrackingAccount(key);
200 } 200 }
201 201
202 std::string AccountTracker::GetAccountId() const { 202 std::string AccountTracker::GetAccountId() const {
203 if (account_errors_.size() == 0) 203 if (account_errors_.size() == 0)
204 return std::string(); 204 return std::string();
205 else 205 else
206 return account_errors_.begin()->first; 206 return account_errors_.begin()->first;
207 } 207 }
208 208
209 std::string AccountTracker::GetUsername() const {
210 if (account_errors_.size() > 0) {
211 std::map<std::string, AccountState>::const_iterator it =
212 accounts_.find(account_errors_.begin()->first);
213 if (it != accounts_.end())
214 return it->second.ids.email;
215 }
216 return std::string();
217 }
218
209 GoogleServiceAuthError AccountTracker::GetAuthStatus() const { 219 GoogleServiceAuthError AccountTracker::GetAuthStatus() const {
210 if (account_errors_.size() == 0) 220 if (account_errors_.size() == 0)
211 return GoogleServiceAuthError::AuthErrorNone(); 221 return GoogleServiceAuthError::AuthErrorNone();
212 else 222 else
213 return account_errors_.begin()->second; 223 return account_errors_.begin()->second;
214 } 224 }
215 225
216 void AccountTracker::DeleteFetcher(AccountIdFetcher* fetcher) { 226 void AccountTracker::DeleteFetcher(AccountIdFetcher* fetcher) {
217 const std::string& account_key = fetcher->account_key(); 227 const std::string& account_key = fetcher->account_key();
218 DCHECK(ContainsKey(user_info_requests_, account_key)); 228 DCHECK(ContainsKey(user_info_requests_, account_key));
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 LOG(ERROR) << "OnOAuthError"; 277 LOG(ERROR) << "OnOAuthError";
268 tracker_->OnUserInfoFetchFailure(this); 278 tracker_->OnUserInfoFetchFailure(this);
269 } 279 }
270 280
271 void AccountIdFetcher::OnNetworkError(int response_code) { 281 void AccountIdFetcher::OnNetworkError(int response_code) {
272 LOG(ERROR) << "OnNetworkError " << response_code; 282 LOG(ERROR) << "OnNetworkError " << response_code;
273 tracker_->OnUserInfoFetchFailure(this); 283 tracker_->OnUserInfoFetchFailure(this);
274 } 284 }
275 285
276 } // namespace extensions 286 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698