OLD | NEW |
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_SUPERVISED_USER_SUPERVISED_USER_PREF_MAPPING_SERVICE_H_ | 5 #ifndef CHROME_BROWSER_SUPERVISED_USER_SUPERVISED_USER_PREF_MAPPING_SERVICE_H_ |
6 #define CHROME_BROWSER_SUPERVISED_USER_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" |
(...skipping 12 matching lines...) Expand all Loading... |
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 SupervisedUserSharedSettingsService* 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 supervised 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 supervised user shared setting was changed by receiving new | 40 // Called when a supervised user shared setting was changed by receiving new |
41 // sync data. Updates the corresponding user pref. | 41 // sync data. Updates the corresponding user pref. |
42 void OnSharedSettingChanged(const std::string& su_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 supervised 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 SupervisedUserSharedSettingsService* shared_settings_; | 50 SupervisedUserSharedSettingsService* shared_settings_; |
51 scoped_ptr<CallbackList::Subscription> subscription_; | 51 scoped_ptr<CallbackList::Subscription> subscription_; |
52 std::string supervised_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_SUPERVISED_USER_SUPERVISED_USER_PREF_MAPPING_SERVICE_H
_ | 59 #endif // CHROME_BROWSER_SUPERVISED_USER_SUPERVISED_USER_PREF_MAPPING_SERVICE_H
_ |
OLD | NEW |