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

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

Powered by Google App Engine
This is Rietveld 408576698