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

Unified Diff: chrome/browser/managed_mode/managed_user_sync_service.h

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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/managed_mode/managed_user_sync_service.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/managed_mode/managed_user_sync_service.h
diff --git a/chrome/browser/managed_mode/managed_user_sync_service.h b/chrome/browser/managed_mode/managed_user_sync_service.h
index b0aa4b8ae3d201bab7ee8de3b655ce87863a3f70..4c7642350af1c672d692ae02fa516eb75bef5973 100644
--- a/chrome/browser/managed_mode/managed_user_sync_service.h
+++ b/chrome/browser/managed_mode/managed_user_sync_service.h
@@ -5,6 +5,9 @@
#ifndef CHROME_BROWSER_MANAGED_MODE_MANAGED_USER_SYNC_SERVICE_H_
#define CHROME_BROWSER_MANAGED_MODE_MANAGED_USER_SYNC_SERVICE_H_
+#include <vector>
+
+#include "base/callback_forward.h"
#include "base/memory/scoped_ptr.h"
#include "base/observer_list.h"
#include "base/prefs/pref_change_registrar.h"
@@ -13,15 +16,23 @@
#include "components/browser_context_keyed_service/browser_context_keyed_service.h"
#include "sync/api/syncable_service.h"
-class PrefService;
+namespace base {
+class DictionaryValue;
+}
namespace user_prefs {
class PrefRegistrySyncable;
}
+class PrefService;
+
class ManagedUserSyncService : public BrowserContextKeyedService,
public syncer::SyncableService {
public:
+ // For use with GetAllManagedUsers() below.
+ typedef base::Callback<void(const base::DictionaryValue*)>
+ ManagedUsersCallback;
+
virtual ~ManagedUserSyncService();
static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry);
@@ -34,6 +45,17 @@ class ManagedUserSyncService : public BrowserContextKeyedService,
const std::string& master_key);
void DeleteManagedUser(const std::string& id);
+ // Returns a dictionary containing all managed users managed by this
+ // custodian. This method should only be called once this service has started
+ // syncing managed users (i.e. has finished its initial merge of local and
+ // server-side data, via MergeDataAndStartSyncing), as the stored data might
+ // be outdated before that.
+ const base::DictionaryValue* GetManagedUsers();
+
+ // Calls the passed |callback| with a dictionary containing all managed users
+ // managed by this custodian.
+ void GetManagedUsersAsync(const ManagedUsersCallback& callback);
+
// BrowserContextKeyedService implementation:
virtual void Shutdown() OVERRIDE;
@@ -62,6 +84,8 @@ class ManagedUserSyncService : public BrowserContextKeyedService,
void NotifyManagedUserAcknowledged(const std::string& managed_user_id);
void NotifyManagedUsersSyncingStopped();
+ void DispatchCallbacks();
+
PrefService* prefs_;
PrefChangeRegistrar pref_change_registrar_;
@@ -70,6 +94,8 @@ class ManagedUserSyncService : public BrowserContextKeyedService,
ObserverList<ManagedUserSyncServiceObserver> observers_;
+ std::vector<ManagedUsersCallback> callbacks_;
+
DISALLOW_COPY_AND_ASSIGN(ManagedUserSyncService);
};
« no previous file with comments | « no previous file | chrome/browser/managed_mode/managed_user_sync_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698