OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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/manage_profile_handler.h" | 5 #include "chrome/browser/ui/webui/options/manage_profile_handler.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/prefs/pref_service.h" | 10 #include "base/prefs/pref_service.h" |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
224 Profile* profile = Profile::FromWebUI(web_ui()); | 224 Profile* profile = Profile::FromWebUI(web_ui()); |
225 if (profile->IsManaged()) | 225 if (profile->IsManaged()) |
226 return; | 226 return; |
227 | 227 |
228 const ProfileInfoCache& cache = | 228 const ProfileInfoCache& cache = |
229 g_browser_process->profile_manager()->GetProfileInfoCache(); | 229 g_browser_process->profile_manager()->GetProfileInfoCache(); |
230 std::set<std::string> managed_user_ids; | 230 std::set<std::string> managed_user_ids; |
231 for (size_t i = 0; i < cache.GetNumberOfProfiles(); ++i) | 231 for (size_t i = 0; i < cache.GetNumberOfProfiles(); ++i) |
232 managed_user_ids.insert(cache.GetManagedUserIdOfProfileAtIndex(i)); | 232 managed_user_ids.insert(cache.GetManagedUserIdOfProfileAtIndex(i)); |
233 | 233 |
234 DictionaryValue* dict = | 234 const DictionaryValue* dict = |
235 DictionaryPrefUpdate(profile->GetPrefs(), prefs::kManagedUsers).Get(); | 235 profile->GetPrefs()->GetDictionary(prefs::kManagedUsers); |
236 DictionaryValue id_names_dict; | 236 DictionaryValue id_names_dict; |
237 for (DictionaryValue::Iterator it(*dict); !it.IsAtEnd(); it.Advance()) { | 237 for (DictionaryValue::Iterator it(*dict); !it.IsAtEnd(); it.Advance()) { |
238 if (managed_user_ids.find(it.key()) != managed_user_ids.end()) | 238 if (managed_user_ids.find(it.key()) != managed_user_ids.end()) |
239 continue; | 239 continue; |
240 const DictionaryValue* value = NULL; | 240 const DictionaryValue* value = NULL; |
241 bool success = it.value().GetAsDictionary(&value); | 241 bool success = it.value().GetAsDictionary(&value); |
242 DCHECK(success); | 242 DCHECK(success); |
243 std::string name; | 243 std::string name; |
244 value->GetString("name", &name); | 244 value->GetString("name", &name); |
245 id_names_dict.SetString(it.key(), name); | 245 id_names_dict.SetString(it.key(), name); |
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
495 g_browser_process->profile_manager()->profile_shortcut_manager(); | 495 g_browser_process->profile_manager()->profile_shortcut_manager(); |
496 DCHECK(shortcut_manager); | 496 DCHECK(shortcut_manager); |
497 | 497 |
498 shortcut_manager->RemoveProfileShortcuts(profile_file_path); | 498 shortcut_manager->RemoveProfileShortcuts(profile_file_path); |
499 | 499 |
500 // Update the UI buttons. | 500 // Update the UI buttons. |
501 OnHasProfileShortcuts(false); | 501 OnHasProfileShortcuts(false); |
502 } | 502 } |
503 | 503 |
504 } // namespace options | 504 } // namespace options |
OLD | NEW |