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

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

Issue 288813003: Add username of account that has an auth error. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased 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 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 StopTrackingAccount(key); 240 StopTrackingAccount(key);
241 } 241 }
242 242
243 std::string AccountTracker::GetAccountId() const { 243 std::string AccountTracker::GetAccountId() const {
244 if (account_errors_.size() == 0) 244 if (account_errors_.size() == 0)
245 return std::string(); 245 return std::string();
246 else 246 else
247 return account_errors_.begin()->first; 247 return account_errors_.begin()->first;
248 } 248 }
249 249
250 std::string AccountTracker::GetUsername() const {
251 if (account_errors_.size() > 0) {
Michael Courage 2014/05/15 17:18:54 Might be clearer to call id = GetAccountId() here
Roger Tawa OOO till Jul 10th 2014/05/15 18:24:09 Done.
252 std::map<std::string, AccountState>::const_iterator it =
253 accounts_.find(account_errors_.begin()->first);
254 if (it != accounts_.end())
255 return it->second.ids.email;
256 }
257 return std::string();
258 }
259
250 GoogleServiceAuthError AccountTracker::GetAuthStatus() const { 260 GoogleServiceAuthError AccountTracker::GetAuthStatus() const {
251 if (account_errors_.size() == 0) 261 if (account_errors_.size() == 0)
252 return GoogleServiceAuthError::AuthErrorNone(); 262 return GoogleServiceAuthError::AuthErrorNone();
253 else 263 else
254 return account_errors_.begin()->second; 264 return account_errors_.begin()->second;
255 } 265 }
256 266
257 void AccountTracker::DeleteFetcher(AccountIdFetcher* fetcher) { 267 void AccountTracker::DeleteFetcher(AccountIdFetcher* fetcher) {
258 const std::string& account_key = fetcher->account_key(); 268 const std::string& account_key = fetcher->account_key();
259 DCHECK(ContainsKey(user_info_requests_, account_key)); 269 DCHECK(ContainsKey(user_info_requests_, account_key));
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
308 LOG(ERROR) << "OnOAuthError"; 318 LOG(ERROR) << "OnOAuthError";
309 tracker_->OnUserInfoFetchFailure(this); 319 tracker_->OnUserInfoFetchFailure(this);
310 } 320 }
311 321
312 void AccountIdFetcher::OnNetworkError(int response_code) { 322 void AccountIdFetcher::OnNetworkError(int response_code) {
313 LOG(ERROR) << "OnNetworkError " << response_code; 323 LOG(ERROR) << "OnNetworkError " << response_code;
314 tracker_->OnUserInfoFetchFailure(this); 324 tracker_->OnUserInfoFetchFailure(this);
315 } 325 }
316 326
317 } // namespace extensions 327 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698