Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(218)

Side by Side Diff: chrome/browser/ui/webui/options/browser_options_handler.cc

Issue 23910002: Add synchronous and asynchronous methods to ManagedUserSyncService to get the list of managed users. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: comment Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/browser_options_handler.h" 5 #include "chrome/browser/ui/webui/options/browser_options_handler.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 13 matching lines...) Expand all
24 #include "chrome/browser/browser_process.h" 24 #include "chrome/browser/browser_process.h"
25 #include "chrome/browser/chrome_notification_types.h" 25 #include "chrome/browser/chrome_notification_types.h"
26 #include "chrome/browser/chrome_page_zoom.h" 26 #include "chrome/browser/chrome_page_zoom.h"
27 #include "chrome/browser/custom_home_pages_table_model.h" 27 #include "chrome/browser/custom_home_pages_table_model.h"
28 #include "chrome/browser/download/download_prefs.h" 28 #include "chrome/browser/download/download_prefs.h"
29 #include "chrome/browser/gpu/gpu_mode_manager.h" 29 #include "chrome/browser/gpu/gpu_mode_manager.h"
30 #include "chrome/browser/lifetime/application_lifetime.h" 30 #include "chrome/browser/lifetime/application_lifetime.h"
31 #include "chrome/browser/managed_mode/managed_user_registration_utility.h" 31 #include "chrome/browser/managed_mode/managed_user_registration_utility.h"
32 #include "chrome/browser/managed_mode/managed_user_service.h" 32 #include "chrome/browser/managed_mode/managed_user_service.h"
33 #include "chrome/browser/managed_mode/managed_user_service_factory.h" 33 #include "chrome/browser/managed_mode/managed_user_service_factory.h"
34 #include "chrome/browser/managed_mode/managed_user_sync_service.h"
35 #include "chrome/browser/managed_mode/managed_user_sync_service_factory.h"
34 #include "chrome/browser/prefs/scoped_user_pref_update.h" 36 #include "chrome/browser/prefs/scoped_user_pref_update.h"
35 #include "chrome/browser/prefs/session_startup_pref.h" 37 #include "chrome/browser/prefs/session_startup_pref.h"
36 #include "chrome/browser/printing/cloud_print/cloud_print_proxy_service.h" 38 #include "chrome/browser/printing/cloud_print/cloud_print_proxy_service.h"
37 #include "chrome/browser/printing/cloud_print/cloud_print_proxy_service_factory. h" 39 #include "chrome/browser/printing/cloud_print/cloud_print_proxy_service_factory. h"
38 #include "chrome/browser/printing/cloud_print/cloud_print_url.h" 40 #include "chrome/browser/printing/cloud_print/cloud_print_url.h"
39 #include "chrome/browser/profiles/profile.h" 41 #include "chrome/browser/profiles/profile.h"
40 #include "chrome/browser/profiles/profile_info_cache.h" 42 #include "chrome/browser/profiles/profile_info_cache.h"
41 #include "chrome/browser/profiles/profile_info_util.h" 43 #include "chrome/browser/profiles/profile_info_util.h"
42 #include "chrome/browser/profiles/profile_metrics.h" 44 #include "chrome/browser/profiles/profile_metrics.h"
43 #include "chrome/browser/profiles/profile_shortcut_manager.h" 45 #include "chrome/browser/profiles/profile_shortcut_manager.h"
(...skipping 1794 matching lines...) Expand 10 before | Expand all | Expand 10 after
1838 bool BrowserOptionsHandler::IsValidExistingManagedUserId( 1840 bool BrowserOptionsHandler::IsValidExistingManagedUserId(
1839 const std::string& existing_managed_user_id) const { 1841 const std::string& existing_managed_user_id) const {
1840 if (existing_managed_user_id.empty()) 1842 if (existing_managed_user_id.empty())
1841 return true; 1843 return true;
1842 1844
1843 if (!CommandLine::ForCurrentProcess()->HasSwitch( 1845 if (!CommandLine::ForCurrentProcess()->HasSwitch(
1844 switches::kAllowCreateExistingManagedUsers)) { 1846 switches::kAllowCreateExistingManagedUsers)) {
1845 return false; 1847 return false;
1846 } 1848 }
1847 1849
1848 DictionaryPrefUpdate update(Profile::FromWebUI(web_ui())->GetPrefs(), 1850 Profile* profile = Profile::FromWebUI(web_ui());
1849 prefs::kManagedUsers); 1851 const DictionaryValue* dict =
1850 DictionaryValue* dict = update.Get(); 1852 ManagedUserSyncServiceFactory::GetForProfile(profile)->GetManagedUsers();
1851 if (!dict->HasKey(existing_managed_user_id)) 1853 if (!dict->HasKey(existing_managed_user_id))
1852 return false; 1854 return false;
1853 1855
1854 // Check if this managed user already exists on this machine. 1856 // Check if this managed user already exists on this machine.
1855 const ProfileInfoCache& cache = 1857 const ProfileInfoCache& cache =
1856 g_browser_process->profile_manager()->GetProfileInfoCache(); 1858 g_browser_process->profile_manager()->GetProfileInfoCache();
1857 for (size_t i = 0; i < cache.GetNumberOfProfiles(); ++i) { 1859 for (size_t i = 0; i < cache.GetNumberOfProfiles(); ++i) {
1858 if (existing_managed_user_id == cache.GetManagedUserIdOfProfileAtIndex(i)) 1860 if (existing_managed_user_id == cache.GetManagedUserIdOfProfileAtIndex(i))
1859 return false; 1861 return false;
1860 } 1862 }
1861 return true; 1863 return true;
1862 } 1864 }
1863 1865
1864 } // namespace options 1866 } // namespace options
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698