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

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

Issue 335833003: Rename "managed (mode|user)" to "supervised user" (part 2) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: review comments (+ a few other cleanups) Created 6 years, 6 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 2014 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_SUPERVISED_USER_PREF_MAPPING_SERVICE_H_
6 #define CHROME_BROWSER_MANAGED_MODE_SUPERVISED_USER_PREF_MAPPING_SERVICE_H_
7
8 #include "base/callback.h"
9 #include "base/callback_list.h"
10 #include "base/memory/scoped_ptr.h"
11 #include "base/memory/weak_ptr.h"
12 #include "base/prefs/pref_change_registrar.h"
13 #include "chrome/browser/managed_mode/managed_users.h"
14 #include "components/keyed_service/core/keyed_service.h"
15
16 class ManagedUserSharedSettingsService;
17 class PrefService;
18
19 // SupervisedUserPrefMappingService maps shared managed user settings to user
20 // preferences. When a shared managed user setting is updated via sync, the
21 // corresponding local user preference is set to this new value.
22 class SupervisedUserPrefMappingService : public KeyedService {
23 public:
24 typedef base::CallbackList<void(const std::string&, const std::string&)>
25 CallbackList;
26
27 SupervisedUserPrefMappingService(
28 PrefService* prefs,
29 ManagedUserSharedSettingsService* shared_settings);
30 virtual ~SupervisedUserPrefMappingService();
31
32 // KeyedService implementation:
33 virtual void Shutdown() OVERRIDE;
34
35 void Init();
36
37 // Updates the managed user shared setting when the avatar has changed.
38 void OnAvatarChanged();
39
40 // Called when a managed user shared setting was changed by receiving new sync
41 // data. Updates the corresponding user pref.
42 void OnSharedSettingChanged(const std::string& mu_id, const std::string& key);
43
44 private:
45 // Returns the current chrome avatar index that is stored as a managed user
46 // shared setting, or -1 if no avatar index is stored.
47 int GetChromeAvatarIndex();
48
49 PrefService* prefs_;
50 ManagedUserSharedSettingsService* shared_settings_;
51 scoped_ptr<CallbackList::Subscription> subscription_;
52 std::string managed_user_id_;
53 PrefChangeRegistrar pref_change_registrar_;
54 base::WeakPtrFactory<SupervisedUserPrefMappingService> weak_ptr_factory_;
55
56 DISALLOW_COPY_AND_ASSIGN(SupervisedUserPrefMappingService);
57 };
58
59 #endif // CHROME_BROWSER_MANAGED_MODE_SUPERVISED_USER_PREF_MAPPING_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698