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/ui/webui/options/managed_user_import_handler.h" | 5 #include "chrome/browser/ui/webui/options/managed_user_import_handler.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/prefs/pref_service.h" | 10 #include "base/prefs/pref_service.h" |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 weak_ptr_factory_.GetWeakPtr())); | 112 weak_ptr_factory_.GetWeakPtr())); |
113 } | 113 } |
114 } | 114 } |
115 | 115 |
116 void ManagedUserImportHandler::SendExistingManagedUsers( | 116 void ManagedUserImportHandler::SendExistingManagedUsers( |
117 const DictionaryValue* dict) { | 117 const DictionaryValue* dict) { |
118 DCHECK(dict); | 118 DCHECK(dict); |
119 const ProfileInfoCache& cache = | 119 const ProfileInfoCache& cache = |
120 g_browser_process->profile_manager()->GetProfileInfoCache(); | 120 g_browser_process->profile_manager()->GetProfileInfoCache(); |
121 std::set<std::string> managed_user_ids; | 121 std::set<std::string> managed_user_ids; |
122 for (size_t i = 0; i < cache.GetNumberOfProfiles(); ++i) | 122 |
123 managed_user_ids.insert(cache.GetManagedUserIdOfProfileAtIndex(i)); | 123 const std::vector<ProfileInfoEntry> entries(cache.GetProfilesSortedByName()); |
| 124 for (std::vector<ProfileInfoEntry>::const_iterator it = entries.begin(); |
| 125 it != entries.end(); ++it) { |
| 126 managed_user_ids.insert(it->managed_user_id()); |
| 127 } |
124 | 128 |
125 ListValue managed_users; | 129 ListValue managed_users; |
126 for (DictionaryValue::Iterator it(*dict); !it.IsAtEnd(); it.Advance()) { | 130 for (DictionaryValue::Iterator it(*dict); !it.IsAtEnd(); it.Advance()) { |
127 const DictionaryValue* value = NULL; | 131 const DictionaryValue* value = NULL; |
128 bool success = it.value().GetAsDictionary(&value); | 132 bool success = it.value().GetAsDictionary(&value); |
129 DCHECK(success); | 133 DCHECK(success); |
130 std::string name; | 134 std::string name; |
131 value->GetString(ManagedUserSyncService::kName, &name); | 135 value->GetString(ManagedUserSyncService::kName, &name); |
132 std::string avatar_str; | 136 std::string avatar_str; |
133 value->GetString(ManagedUserSyncService::kChromeAvatar, &avatar_str); | 137 value->GetString(ManagedUserSyncService::kChromeAvatar, &avatar_str); |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 GoogleServiceAuthError::State state = | 189 GoogleServiceAuthError::State state = |
186 signin_global_error->GetLastAuthError().state(); | 190 signin_global_error->GetLastAuthError().state(); |
187 | 191 |
188 return state == GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS || | 192 return state == GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS || |
189 state == GoogleServiceAuthError::USER_NOT_SIGNED_UP || | 193 state == GoogleServiceAuthError::USER_NOT_SIGNED_UP || |
190 state == GoogleServiceAuthError::ACCOUNT_DELETED || | 194 state == GoogleServiceAuthError::ACCOUNT_DELETED || |
191 state == GoogleServiceAuthError::ACCOUNT_DISABLED; | 195 state == GoogleServiceAuthError::ACCOUNT_DISABLED; |
192 } | 196 } |
193 | 197 |
194 } // namespace options | 198 } // namespace options |
OLD | NEW |