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

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
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_settings.h.
21 class ManagedUserSettingsService {
22 public:
23 // A callback with all managed user settings. If the dictionary is NULL, it
Pam (message me for reviews) 2013/08/30 13:35:53 What does "with" mean here?
Bernhard Bauer 2013/08/30 14:54:27 It's the first parameter. "A callback whose first
Pam (message me for reviews) 2013/09/02 09:38:41 A little bulky, but it would be clearer.
Bernhard Bauer 2013/09/02 11:01:07 Done.
24 // means that the service is inactive, i.e. the user is not managed.
25 typedef base::Callback<void(const base::DictionaryValue*)> SettingsCallback;
26
27 // Adds a callback to be called when managed user settings are initially
28 // available, or when they change.
29 void Subscribe(const SettingsCallback& callback);
Pam (message me for reviews) 2013/08/30 13:35:53 Do we really need Yet Another Settings Notifier? A
Bernhard Bauer 2013/08/30 14:54:27 You mean in general, do we need a mechanism for th
Pam (message me for reviews) 2013/09/02 09:38:41 Will anything besides the PrefStore be subscribing
Bernhard Bauer 2013/09/02 11:01:07 The only other implementation is in tests. Testing
Bernhard Bauer 2013/09/04 09:29:05 Removed the abstract interface. The syncing code i
30
31 // Activates the service. This happens when the user is managed.
32 void Activate();
33
34 protected:
35 ManagedUserSettingsService();
36 virtual ~ManagedUserSettingsService();
37
38 // Sends the settings to all subscribers.
Pam (message me for reviews) 2013/08/30 13:35:53 What triggers this? Sync?
Bernhard Bauer 2013/08/30 14:54:27 Yes. From the point of view of this class, the (no
39 void NotifySettingsChanged();
Pam (message me for reviews) 2013/08/30 13:35:53 If it does keep using callbacks, this should be re
Bernhard Bauer 2013/08/30 14:54:27 Done.
Pam (message me for reviews) 2013/09/02 09:38:41 I meant to avoid the word "notify", with all its N
Bernhard Bauer 2013/09/02 11:01:07 I like InformSubscribers! Done.
Pam (message me for reviews) 2013/09/03 10:45:32 CallSubscribersBack :) Sorry, that's the cold meds
40
41 private:
42 // Whether managed user settings are available.
Pam (message me for reviews) 2013/08/30 13:35:53 What makes them available?
Bernhard Bauer 2013/08/30 14:54:27 The subclass has to load them from a Json file on
43 virtual bool IsReady() const = 0;
44
45 // Returns a dictionary with all managed user settings. This method will
46 // only be called once IsReady() returns true.
47 virtual scoped_ptr<base::DictionaryValue> GetSettings() const = 0;
48
49 scoped_ptr<base::DictionaryValue> GetSettingsIfActive();
Pam (message me for reviews) 2013/08/30 13:35:53 Comment please. (Mainly that it returns an empty d
Bernhard Bauer 2013/08/30 14:54:27 Done.
50
51 bool active_;
52
53 std::vector<SettingsCallback> subscribers_;
54
55 DISALLOW_COPY_AND_ASSIGN(ManagedUserSettingsService);
56 };
57
58 #endif // CHROME_BROWSER_MANAGED_MODE_MANAGED_USER_SETTINGS_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698