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

Side by Side Diff: chrome/browser/managed_mode/managed_user_settings_service.h

Issue 23466004: Add ManagedUserSettingsService and a SupervisedUserPrefStore using it. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_MANAGED_MODE_MANAGED_USER_SETTINGS_SERVICE_H_
6 #define CHROME_BROWSER_MANAGED_MODE_MANAGED_USER_SETTINGS_SERVICE_H_
7
8 #include <string>
9 #include <vector>
10
11 #include "base/basictypes.h"
12 #include "base/callback.h"
13 #include "base/memory/scoped_ptr.h"
14 #include "base/values.h"
15 #include "chrome/browser/managed_mode/managed_users.h"
16
17 // Defines an abstract base class for a service that stores managed user
Pam (message me for reviews) 2013/09/03 10:45:32 It doesn't just store the settings -- that would b
Bernhard Bauer 2013/09/03 10:53:43 Well, it does store the settings in the sense that
18 // settings, which are key-value pairs configured by a different user to
19 // control certain browser behaviors for managed users.
20 // Setting names are defined in managed_user_constants.h.
21 class ManagedUserSettingsService {
22 public:
23 // A callback whose first parameter is a dictionary containing all managed
24 // user settings. If the dictionary is NULL, it means that the service is
25 // inactive, i.e. the user is not managed.
26 typedef base::Callback<void(const base::DictionaryValue*)> SettingsCallback;
27
28 // Adds a callback to be called when managed user settings are initially
29 // available, or when they change.
30 void Subscribe(const SettingsCallback& callback);
31
32 // Activates the service. This happens when the user is managed.
33 void Activate();
34
35 protected:
36 ManagedUserSettingsService();
37 virtual ~ManagedUserSettingsService();
38
39 // Sends the settings to all subscribers. This method should be called by the
40 // subclass whenever the settings change.
41 void InformSubscribers();
42
43 private:
44 // Whether managed user settings are available.
45 virtual bool IsReady() const = 0;
46
47 // Returns a dictionary with all managed user settings. This method will
48 // only be called once IsReady() returns true.
49 virtual scoped_ptr<base::DictionaryValue> GetSettings() const = 0;
50
51 // Returns the dictionary produced by GetSettings() above if the service is
52 // active, or NULL otherwise.
53 scoped_ptr<base::DictionaryValue> GetSettingsIfActive();
54
55 bool active_;
56
57 std::vector<SettingsCallback> subscribers_;
58
59 DISALLOW_COPY_AND_ASSIGN(ManagedUserSettingsService);
60 };
61
62 #endif // CHROME_BROWSER_MANAGED_MODE_MANAGED_USER_SETTINGS_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698