| 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_LEGACY_SUPERVISED_USER_SHARED_SETTINGS_SE
RVICE_H_ | 5 #ifndef CHROME_BROWSER_SUPERVISED_USER_LEGACY_SUPERVISED_USER_SHARED_SETTINGS_SE
RVICE_H_ |
| 6 #define CHROME_BROWSER_SUPERVISED_USER_LEGACY_SUPERVISED_USER_SHARED_SETTINGS_SE
RVICE_H_ | 6 #define CHROME_BROWSER_SUPERVISED_USER_LEGACY_SUPERVISED_USER_SHARED_SETTINGS_SE
RVICE_H_ |
| 7 | 7 |
| 8 #include <memory> |
| 8 #include <string> | 9 #include <string> |
| 9 | 10 |
| 10 #include "base/callback.h" | 11 #include "base/callback.h" |
| 11 #include "base/callback_list.h" | 12 #include "base/callback_list.h" |
| 12 #include "base/memory/scoped_ptr.h" | |
| 13 #include "chrome/browser/supervised_user/supervised_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 #include "sync/api/syncable_service.h" | 15 #include "sync/api/syncable_service.h" |
| 16 | 16 |
| 17 class PrefService; | 17 class PrefService; |
| 18 | 18 |
| 19 namespace base { | 19 namespace base { |
| 20 class DictionaryValue; | 20 class DictionaryValue; |
| 21 class Value; | 21 class Value; |
| 22 } | 22 } |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 |
| 65 // user, |su_id| must be their own. | 65 // user, |su_id| must be their own. |
| 66 void SetValue(const std::string& su_id, | 66 void SetValue(const std::string& su_id, |
| 67 const std::string& key, | 67 const std::string& key, |
| 68 const base::Value& value); | 68 const base::Value& value); |
| 69 | 69 |
| 70 // Subscribes to changes in the synced settings. The callback will be notified | 70 // Subscribes to changes in the synced settings. The callback will be notified |
| 71 // whenever any setting for any supervised user is changed via Sync (but not | 71 // whenever any setting for any supervised user is changed via Sync (but not |
| 72 // for local changes). Subscribers should filter the settings and users they | 72 // for local changes). Subscribers should filter the settings and users they |
| 73 // are interested in with the |su_id| and |key| parameters to the callback. | 73 // are interested in with the |su_id| and |key| parameters to the callback. |
| 74 scoped_ptr<ChangeCallbackList::Subscription> Subscribe( | 74 std::unique_ptr<ChangeCallbackList::Subscription> Subscribe( |
| 75 const ChangeCallback& cb); | 75 const ChangeCallback& cb); |
| 76 | 76 |
| 77 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry); | 77 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry); |
| 78 | 78 |
| 79 // Public for testing. | 79 // Public for testing. |
| 80 void SetValueInternal(const std::string& su_id, | 80 void SetValueInternal(const std::string& su_id, |
| 81 const std::string& key, | 81 const std::string& key, |
| 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 void Shutdown() override; | 92 void Shutdown() override; |
| 93 | 93 |
| 94 // SyncableService implementation: | 94 // SyncableService implementation: |
| 95 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 std::unique_ptr<syncer::SyncChangeProcessor> sync_processor, |
| 99 scoped_ptr<syncer::SyncErrorFactory> error_handler) override; | 99 std::unique_ptr<syncer::SyncErrorFactory> error_handler) override; |
| 100 void StopSyncing(syncer::ModelType type) override; | 100 void StopSyncing(syncer::ModelType type) override; |
| 101 syncer::SyncDataList GetAllSyncData(syncer::ModelType type) const override; | 101 syncer::SyncDataList GetAllSyncData(syncer::ModelType type) const override; |
| 102 syncer::SyncError ProcessSyncChanges( | 102 syncer::SyncError ProcessSyncChanges( |
| 103 const tracked_objects::Location& from_here, | 103 const tracked_objects::Location& from_here, |
| 104 const syncer::SyncChangeList& change_list) override; | 104 const syncer::SyncChangeList& change_list) override; |
| 105 | 105 |
| 106 private: | 106 private: |
| 107 scoped_ptr<syncer::SyncChangeProcessor> sync_processor_; | 107 std::unique_ptr<syncer::SyncChangeProcessor> sync_processor_; |
| 108 scoped_ptr<syncer::SyncErrorFactory> error_handler_; | 108 std::unique_ptr<syncer::SyncErrorFactory> error_handler_; |
| 109 | 109 |
| 110 ChangeCallbackList callbacks_; | 110 ChangeCallbackList callbacks_; |
| 111 | 111 |
| 112 PrefService* prefs_; | 112 PrefService* prefs_; |
| 113 }; | 113 }; |
| 114 | 114 |
| 115 #endif // CHROME_BROWSER_SUPERVISED_USER_LEGACY_SUPERVISED_USER_SHARED_SETTINGS
_SERVICE_H_ | 115 #endif // CHROME_BROWSER_SUPERVISED_USER_LEGACY_SUPERVISED_USER_SHARED_SETTINGS
_SERVICE_H_ |
| OLD | NEW |