Index: chrome/browser/extensions/api/identity/account_tracker.cc |
diff --git a/chrome/browser/extensions/api/identity/account_tracker.cc b/chrome/browser/extensions/api/identity/account_tracker.cc |
index fd0834ddc5b04d97ab00f3afeddfad7d9c455928..6afc9f97c9aacd384e0ce131226baae4cf58a376 100644 |
--- a/chrome/browser/extensions/api/identity/account_tracker.cc |
+++ b/chrome/browser/extensions/api/identity/account_tracker.cc |
@@ -247,6 +247,17 @@ std::string AccountTracker::GetAccountId() const { |
return account_errors_.begin()->first; |
} |
+std::string AccountTracker::GetUsername() const { |
+ std::string id = GetAccountId(); |
+ if (!id.empty()) { |
+ std::map<std::string, AccountState>::const_iterator it = |
+ accounts_.find(id); |
+ if (it != accounts_.end()) |
+ return it->second.ids.email; |
+ } |
+ return std::string(); |
+} |
+ |
GoogleServiceAuthError AccountTracker::GetAuthStatus() const { |
if (account_errors_.size() == 0) |
return GoogleServiceAuthError::AuthErrorNone(); |