OLD | NEW |
---|---|
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/profiles/profiles_state.h" | 5 #include "chrome/browser/profiles/profiles_state.h" |
6 | 6 |
7 #include "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
8 #include "base/prefs/pref_registry_simple.h" | 8 #include "base/prefs/pref_registry_simple.h" |
9 #include "base/prefs/pref_service.h" | 9 #include "base/prefs/pref_service.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
11 #include "chrome/browser/browser_process.h" | 11 #include "chrome/browser/browser_process.h" |
12 #include "chrome/browser/profiles/profile.h" | 12 #include "chrome/browser/profiles/profile.h" |
13 #include "chrome/browser/profiles/profile_info_cache.h" | 13 #include "chrome/browser/profiles/profile_info_cache.h" |
14 #include "chrome/browser/profiles/profile_manager.h" | 14 #include "chrome/browser/profiles/profile_manager.h" |
15 #include "chrome/browser/signin/profile_oauth2_token_service.h" | |
16 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" | |
15 #include "chrome/browser/ui/browser.h" | 17 #include "chrome/browser/ui/browser.h" |
16 #include "chrome/common/chrome_constants.h" | 18 #include "chrome/common/chrome_constants.h" |
17 #include "chrome/common/pref_names.h" | 19 #include "chrome/common/pref_names.h" |
18 #include "grit/generated_resources.h" | 20 #include "grit/generated_resources.h" |
19 #include "ui/base/l10n/l10n_util.h" | 21 #include "ui/base/l10n/l10n_util.h" |
20 | 22 |
21 #if defined(OS_CHROMEOS) | 23 #if defined(OS_CHROMEOS) |
22 #include "chrome/browser/chromeos/login/user_manager.h" | 24 #include "chrome/browser/chromeos/login/user_manager.h" |
23 #endif | 25 #endif |
24 | 26 |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
94 | 96 |
95 // Changing the profile name can invalidate the profile index. | 97 // Changing the profile name can invalidate the profile index. |
96 profile_index = cache.GetIndexOfProfileWithPath(profile_file_path); | 98 profile_index = cache.GetIndexOfProfileWithPath(profile_file_path); |
97 if (profile_index == std::string::npos) | 99 if (profile_index == std::string::npos) |
98 return; | 100 return; |
99 | 101 |
100 cache.SetIsUsingGAIANameOfProfileAtIndex(profile_index, false); | 102 cache.SetIsUsingGAIANameOfProfileAtIndex(profile_index, false); |
101 } | 103 } |
102 } | 104 } |
103 | 105 |
106 std::vector<std::string> GetSecondaryAccountsForProfile( | |
107 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.
| |
108 std::vector<std::string> accounts = | |
109 ProfileOAuth2TokenServiceFactory::GetForProfile(profile)->GetAccounts(); | |
110 | |
111 // The vector returned by ProfileOAuth2TokenService::GetAccounts() contains | |
112 // the primary account too, so we need to remove it from the list. | |
113 std::vector<std::string>::iterator primary_index = | |
114 std::find_if(accounts.begin(), accounts.end(), | |
115 std::bind1st(std::equal_to<std::string>(), primary_account)); | |
116 DCHECK(primary_index != accounts.end()); | |
117 accounts.erase(primary_index); | |
118 | |
119 return accounts; | |
120 } | |
121 | |
104 } // namespace profiles | 122 } // namespace profiles |
OLD | NEW |