Chromium Code Reviews| 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) { |
| + 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); |
|
rpetterson
2014/01/08 18:12:33
You could do it one go with:
accounts.erase(std::r
noms (inactive)
2014/01/08 19:13:21
The original code also explicitly DCHECK'ed that t
|
| + |
| + return accounts; |
| +} |
| + |
| } // namespace profiles |