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

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: Address review comments 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 std::string id = GetAccountId();
252 if (!id.empty()) {
253 std::map<std::string, AccountState>::const_iterator it =
254 accounts_.find(id);
255 if (it != accounts_.end())
256 return it->second.ids.email;
257 }
258 return std::string();
259 }
260
250 GoogleServiceAuthError AccountTracker::GetAuthStatus() const { 261 GoogleServiceAuthError AccountTracker::GetAuthStatus() const {
251 if (account_errors_.size() == 0) 262 if (account_errors_.size() == 0)
252 return GoogleServiceAuthError::AuthErrorNone(); 263 return GoogleServiceAuthError::AuthErrorNone();
253 else 264 else
254 return account_errors_.begin()->second; 265 return account_errors_.begin()->second;
255 } 266 }
256 267
257 void AccountTracker::DeleteFetcher(AccountIdFetcher* fetcher) { 268 void AccountTracker::DeleteFetcher(AccountIdFetcher* fetcher) {
258 const std::string& account_key = fetcher->account_key(); 269 const std::string& account_key = fetcher->account_key();
259 DCHECK(ContainsKey(user_info_requests_, account_key)); 270 DCHECK(ContainsKey(user_info_requests_, account_key));
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
308 LOG(ERROR) << "OnOAuthError"; 319 LOG(ERROR) << "OnOAuthError";
309 tracker_->OnUserInfoFetchFailure(this); 320 tracker_->OnUserInfoFetchFailure(this);
310 } 321 }
311 322
312 void AccountIdFetcher::OnNetworkError(int response_code) { 323 void AccountIdFetcher::OnNetworkError(int response_code) {
313 LOG(ERROR) << "OnNetworkError " << response_code; 324 LOG(ERROR) << "OnNetworkError " << response_code;
314 tracker_->OnUserInfoFetchFailure(this); 325 tracker_->OnUserInfoFetchFailure(this);
315 } 326 }
316 327
317 } // namespace extensions 328 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/api/identity/account_tracker.h ('k') | chrome/browser/extensions/api/identity/identity_api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698