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_SHARED_SETTINGS_SERVICE_H
_ | 5 #ifndef CHROME_BROWSER_SUPERVISED_USER_SUPERVISED_USER_SHARED_SETTINGS_SERVICE_H
_ |
6 #define CHROME_BROWSER_SUPERVISED_USER_SUPERVISED_USER_SHARED_SETTINGS_SERVICE_H
_ | 6 #define CHROME_BROWSER_SUPERVISED_USER_SUPERVISED_USER_SHARED_SETTINGS_SERVICE_H
_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 typedef base::Callback<void(const std::string& /* su_id */, | 44 typedef base::Callback<void(const std::string& /* su_id */, |
45 const std::string& /* key */)> ChangeCallback; | 45 const std::string& /* key */)> ChangeCallback; |
46 typedef base::CallbackList< | 46 typedef base::CallbackList< |
47 void(const std::string& /* su_id */, const std::string& /* key */)> | 47 void(const std::string& /* su_id */, const std::string& /* key */)> |
48 ChangeCallbackList; | 48 ChangeCallbackList; |
49 | 49 |
50 // This constructor is public only for testing. Use | 50 // This constructor is public only for testing. Use |
51 // |SupervisedUserSharedSettingsServiceFactory::GetForProfile(...)| instead to | 51 // |SupervisedUserSharedSettingsServiceFactory::GetForProfile(...)| instead to |
52 // get an instance of this service in production code. | 52 // get an instance of this service in production code. |
53 explicit SupervisedUserSharedSettingsService(PrefService* prefs); | 53 explicit SupervisedUserSharedSettingsService(PrefService* prefs); |
54 virtual ~SupervisedUserSharedSettingsService(); | 54 ~SupervisedUserSharedSettingsService() override; |
55 | 55 |
56 // Returns the value for the given |key| and the supervised user identified by | 56 // Returns the value for the given |key| and the supervised user identified by |
57 // |su_id|. If either the supervised user or the key does not exist, NULL is | 57 // |su_id|. If either the supervised user or the key does not exist, NULL is |
58 // returned. Note that if the profile that owns this service belongs to a | 58 // returned. Note that if the profile that owns this service belongs to a |
59 // supervised user, callers will only see settings for their own |su_id|, i.e. | 59 // supervised user, callers will only see settings for their own |su_id|, i.e. |
60 // a non-matching |su_id| is treated as non-existent. | 60 // a non-matching |su_id| is treated as non-existent. |
61 const base::Value* GetValue(const std::string& su_id, const std::string& key); | 61 const base::Value* GetValue(const std::string& su_id, const std::string& key); |
62 | 62 |
63 // Sets the value for the given |key| and the supervised user identified by | 63 // Sets the value for the given |key| and the supervised user identified by |
64 // |su_id|. If the profile that owns this service belongs to a supervised | 64 // |su_id|. If the profile that owns this service belongs to a supervised |
(...skipping 17 matching lines...) Expand all Loading... |
82 const base::Value& value, | 82 const base::Value& value, |
83 bool acknowledged); | 83 bool acknowledged); |
84 | 84 |
85 // Public for testing. | 85 // Public for testing. |
86 static syncer::SyncData CreateSyncDataForSetting(const std::string& su_id, | 86 static syncer::SyncData CreateSyncDataForSetting(const std::string& su_id, |
87 const std::string& key, | 87 const std::string& key, |
88 const base::Value& value, | 88 const base::Value& value, |
89 bool acknowledged); | 89 bool acknowledged); |
90 | 90 |
91 // KeyedService implementation: | 91 // KeyedService implementation: |
92 virtual void Shutdown() override; | 92 void Shutdown() override; |
93 | 93 |
94 // SyncableService implementation: | 94 // SyncableService implementation: |
95 virtual syncer::SyncMergeResult MergeDataAndStartSyncing( | 95 syncer::SyncMergeResult MergeDataAndStartSyncing( |
96 syncer::ModelType type, | 96 syncer::ModelType type, |
97 const syncer::SyncDataList& initial_sync_data, | 97 const syncer::SyncDataList& initial_sync_data, |
98 scoped_ptr<syncer::SyncChangeProcessor> sync_processor, | 98 scoped_ptr<syncer::SyncChangeProcessor> sync_processor, |
99 scoped_ptr<syncer::SyncErrorFactory> error_handler) override; | 99 scoped_ptr<syncer::SyncErrorFactory> error_handler) override; |
100 virtual void StopSyncing(syncer::ModelType type) override; | 100 void StopSyncing(syncer::ModelType type) override; |
101 virtual syncer::SyncDataList GetAllSyncData(syncer::ModelType type) const | 101 syncer::SyncDataList GetAllSyncData(syncer::ModelType type) const override; |
102 override; | 102 syncer::SyncError ProcessSyncChanges( |
103 virtual syncer::SyncError ProcessSyncChanges( | |
104 const tracked_objects::Location& from_here, | 103 const tracked_objects::Location& from_here, |
105 const syncer::SyncChangeList& change_list) override; | 104 const syncer::SyncChangeList& change_list) override; |
106 | 105 |
107 private: | 106 private: |
108 scoped_ptr<syncer::SyncChangeProcessor> sync_processor_; | 107 scoped_ptr<syncer::SyncChangeProcessor> sync_processor_; |
109 scoped_ptr<syncer::SyncErrorFactory> error_handler_; | 108 scoped_ptr<syncer::SyncErrorFactory> error_handler_; |
110 | 109 |
111 ChangeCallbackList callbacks_; | 110 ChangeCallbackList callbacks_; |
112 | 111 |
113 PrefService* prefs_; | 112 PrefService* prefs_; |
114 }; | 113 }; |
115 | 114 |
116 #endif // CHROME_BROWSER_SUPERVISED_USER_SUPERVISED_USER_SHARED_SETTINGS_SERVIC
E_H_ | 115 #endif // CHROME_BROWSER_SUPERVISED_USER_SUPERVISED_USER_SHARED_SETTINGS_SERVIC
E_H_ |
OLD | NEW |