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 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 base::Bind(&ManagedUserImportHandler::SendExistingManagedUsers, | 115 base::Bind(&ManagedUserImportHandler::SendExistingManagedUsers, |
116 weak_ptr_factory_.GetWeakPtr())); | 116 weak_ptr_factory_.GetWeakPtr())); |
117 } | 117 } |
118 } | 118 } |
119 | 119 |
120 void ManagedUserImportHandler::SendExistingManagedUsers( | 120 void ManagedUserImportHandler::SendExistingManagedUsers( |
121 const base::DictionaryValue* dict) { | 121 const base::DictionaryValue* dict) { |
122 DCHECK(dict); | 122 DCHECK(dict); |
123 const ProfileInfoCache& cache = | 123 const ProfileInfoCache& cache = |
124 g_browser_process->profile_manager()->GetProfileInfoCache(); | 124 g_browser_process->profile_manager()->GetProfileInfoCache(); |
| 125 |
| 126 // Collect the ids of local supervised user profiles. |
125 std::set<std::string> managed_user_ids; | 127 std::set<std::string> managed_user_ids; |
126 for (size_t i = 0; i < cache.GetNumberOfProfiles(); ++i) | 128 for (size_t i = 0; i < cache.GetNumberOfProfiles(); ++i) { |
127 managed_user_ids.insert(cache.GetManagedUserIdOfProfileAtIndex(i)); | 129 if (cache.ProfileIsManagedAtIndex(i)) |
| 130 managed_user_ids.insert(cache.GetManagedUserIdOfProfileAtIndex(i)); |
| 131 } |
128 | 132 |
129 base::ListValue managed_users; | 133 base::ListValue managed_users; |
130 for (base::DictionaryValue::Iterator it(*dict); !it.IsAtEnd(); it.Advance()) { | 134 for (base::DictionaryValue::Iterator it(*dict); !it.IsAtEnd(); it.Advance()) { |
131 const base::DictionaryValue* value = NULL; | 135 const base::DictionaryValue* value = NULL; |
132 bool success = it.value().GetAsDictionary(&value); | 136 bool success = it.value().GetAsDictionary(&value); |
133 DCHECK(success); | 137 DCHECK(success); |
134 std::string name; | 138 std::string name; |
135 value->GetString(ManagedUserSyncService::kName, &name); | 139 value->GetString(ManagedUserSyncService::kName, &name); |
136 std::string avatar_str; | 140 std::string avatar_str; |
137 value->GetString(ManagedUserSyncService::kChromeAvatar, &avatar_str); | 141 value->GetString(ManagedUserSyncService::kChromeAvatar, &avatar_str); |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 GoogleServiceAuthError::State state = | 188 GoogleServiceAuthError::State state = |
185 signin_global_error->GetLastAuthError().state(); | 189 signin_global_error->GetLastAuthError().state(); |
186 | 190 |
187 return state == GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS || | 191 return state == GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS || |
188 state == GoogleServiceAuthError::USER_NOT_SIGNED_UP || | 192 state == GoogleServiceAuthError::USER_NOT_SIGNED_UP || |
189 state == GoogleServiceAuthError::ACCOUNT_DELETED || | 193 state == GoogleServiceAuthError::ACCOUNT_DELETED || |
190 state == GoogleServiceAuthError::ACCOUNT_DISABLED; | 194 state == GoogleServiceAuthError::ACCOUNT_DISABLED; |
191 } | 195 } |
192 | 196 |
193 } // namespace options | 197 } // namespace options |
OLD | NEW |