Index: chrome/browser/profiles/profiles_state.cc |
diff --git a/chrome/browser/profiles/profiles_state.cc b/chrome/browser/profiles/profiles_state.cc |
index 62be3add6d38f38d49c4cbac7e14bf0eda86dec8..5aeb5f09d6c8e0dd0052243ec3742655528d240d 100644 |
--- a/chrome/browser/profiles/profiles_state.cc |
+++ b/chrome/browser/profiles/profiles_state.cc |
@@ -12,6 +12,8 @@ |
#include "chrome/browser/profiles/profile.h" |
#include "chrome/browser/profiles/profile_info_cache.h" |
#include "chrome/browser/profiles/profile_manager.h" |
+#include "chrome/browser/signin/profile_oauth2_token_service.h" |
+#include "chrome/browser/signin/profile_oauth2_token_service_factory.h" |
#include "chrome/browser/ui/browser.h" |
#include "chrome/common/chrome_constants.h" |
#include "chrome/common/pref_names.h" |
@@ -101,4 +103,20 @@ void UpdateProfileName(Profile* profile, |
} |
} |
+std::vector<std::string> GetSecondaryAccountsForProfile( |
+ Profile* profile, const std::string& primary_account) { |
Alexei Svitkine (slow)
2014/01/08 21:28:37
Nit: 1 param per line if your first param is on a
noms (inactive)
2014/01/08 21:35:13
Done.
|
+ std::vector<std::string> accounts = |
+ ProfileOAuth2TokenServiceFactory::GetForProfile(profile)->GetAccounts(); |
+ |
+ // The vector returned by ProfileOAuth2TokenService::GetAccounts() contains |
+ // the primary account too, so we need to remove it from the list. |
+ std::vector<std::string>::iterator primary_index = |
+ std::find_if(accounts.begin(), accounts.end(), |
+ std::bind1st(std::equal_to<std::string>(), primary_account)); |
+ DCHECK(primary_index != accounts.end()); |
+ accounts.erase(primary_index); |
+ |
+ return accounts; |
+} |
+ |
} // namespace profiles |