| 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_SYNC_SERVICE_H_ | 5 #ifndef CHROME_BROWSER_SUPERVISED_USER_SUPERVISED_USER_SYNC_SERVICE_H_ |
| 6 #define CHROME_BROWSER_SUPERVISED_USER_SUPERVISED_USER_SYNC_SERVICE_H_ | 6 #define CHROME_BROWSER_SUPERVISED_USER_SUPERVISED_USER_SYNC_SERVICE_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 static const char kChromeAvatar[]; | 39 static const char kChromeAvatar[]; |
| 40 static const char kChromeOsAvatar[]; | 40 static const char kChromeOsAvatar[]; |
| 41 static const char kMasterKey[]; | 41 static const char kMasterKey[]; |
| 42 static const char kPasswordSignatureKey[]; | 42 static const char kPasswordSignatureKey[]; |
| 43 static const char kPasswordEncryptionKey[]; | 43 static const char kPasswordEncryptionKey[]; |
| 44 static const char kName[]; | 44 static const char kName[]; |
| 45 | 45 |
| 46 // Represents a non-existing avatar on Chrome and Chrome OS. | 46 // Represents a non-existing avatar on Chrome and Chrome OS. |
| 47 static const int kNoAvatar; | 47 static const int kNoAvatar; |
| 48 | 48 |
| 49 virtual ~SupervisedUserSyncService(); | 49 ~SupervisedUserSyncService() override; |
| 50 | 50 |
| 51 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry); | 51 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry); |
| 52 | 52 |
| 53 // Extracts the avatar index from the input |avatar_str| and set | 53 // Extracts the avatar index from the input |avatar_str| and set |
| 54 // |avatar_index| to hold the extracted value. Returns true if the | 54 // |avatar_index| to hold the extracted value. Returns true if the |
| 55 // index was extracted successfully and false otherwise. | 55 // index was extracted successfully and false otherwise. |
| 56 // |avatar_str| should have the format: "chrome-avatar-index:INDEX" | 56 // |avatar_str| should have the format: "chrome-avatar-index:INDEX" |
| 57 // where INDEX is the integer to be extracted. |avatar_str| can be empty | 57 // where INDEX is the integer to be extracted. |avatar_str| can be empty |
| 58 // in case there is no avatar synced for a supervised user in which case | 58 // in case there is no avatar synced for a supervised user in which case |
| 59 // |avatar_index| is set to -1. | 59 // |avatar_index| is set to -1. |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 // syncing supervised users (i.e. has finished its initial merge of local and | 100 // syncing supervised users (i.e. has finished its initial merge of local and |
| 101 // server-side data, via MergeDataAndStartSyncing), as the stored data might | 101 // server-side data, via MergeDataAndStartSyncing), as the stored data might |
| 102 // be outdated before that. | 102 // be outdated before that. |
| 103 const base::DictionaryValue* GetSupervisedUsers(); | 103 const base::DictionaryValue* GetSupervisedUsers(); |
| 104 | 104 |
| 105 // Calls the passed |callback| with a dictionary containing all supervised | 105 // Calls the passed |callback| with a dictionary containing all supervised |
| 106 // users managed by this custodian. | 106 // users managed by this custodian. |
| 107 void GetSupervisedUsersAsync(const SupervisedUsersCallback& callback); | 107 void GetSupervisedUsersAsync(const SupervisedUsersCallback& callback); |
| 108 | 108 |
| 109 // KeyedService implementation: | 109 // KeyedService implementation: |
| 110 virtual void Shutdown() override; | 110 void Shutdown() override; |
| 111 | 111 |
| 112 // SyncableService implementation: | 112 // SyncableService implementation: |
| 113 virtual syncer::SyncMergeResult MergeDataAndStartSyncing( | 113 syncer::SyncMergeResult MergeDataAndStartSyncing( |
| 114 syncer::ModelType type, | 114 syncer::ModelType type, |
| 115 const syncer::SyncDataList& initial_sync_data, | 115 const syncer::SyncDataList& initial_sync_data, |
| 116 scoped_ptr<syncer::SyncChangeProcessor> sync_processor, | 116 scoped_ptr<syncer::SyncChangeProcessor> sync_processor, |
| 117 scoped_ptr<syncer::SyncErrorFactory> error_handler) override; | 117 scoped_ptr<syncer::SyncErrorFactory> error_handler) override; |
| 118 virtual void StopSyncing(syncer::ModelType type) override; | 118 void StopSyncing(syncer::ModelType type) override; |
| 119 virtual syncer::SyncDataList GetAllSyncData(syncer::ModelType type) const | 119 syncer::SyncDataList GetAllSyncData(syncer::ModelType type) const override; |
| 120 override; | 120 syncer::SyncError ProcessSyncChanges( |
| 121 virtual syncer::SyncError ProcessSyncChanges( | |
| 122 const tracked_objects::Location& from_here, | 121 const tracked_objects::Location& from_here, |
| 123 const syncer::SyncChangeList& change_list) override; | 122 const syncer::SyncChangeList& change_list) override; |
| 124 | 123 |
| 125 private: | 124 private: |
| 126 friend class SupervisedUserSyncServiceFactory; | 125 friend class SupervisedUserSyncServiceFactory; |
| 127 | 126 |
| 128 // Use |SupervisedUserSyncServiceFactory::GetForProfile(...)| to get an | 127 // Use |SupervisedUserSyncServiceFactory::GetForProfile(...)| to get an |
| 129 // instance of this service. | 128 // instance of this service. |
| 130 explicit SupervisedUserSyncService(PrefService* prefs); | 129 explicit SupervisedUserSyncService(PrefService* prefs); |
| 131 | 130 |
| (...skipping 27 matching lines...) Expand all Loading... |
| 159 scoped_ptr<syncer::SyncErrorFactory> error_handler_; | 158 scoped_ptr<syncer::SyncErrorFactory> error_handler_; |
| 160 | 159 |
| 161 ObserverList<SupervisedUserSyncServiceObserver> observers_; | 160 ObserverList<SupervisedUserSyncServiceObserver> observers_; |
| 162 | 161 |
| 163 std::vector<SupervisedUsersCallback> callbacks_; | 162 std::vector<SupervisedUsersCallback> callbacks_; |
| 164 | 163 |
| 165 DISALLOW_COPY_AND_ASSIGN(SupervisedUserSyncService); | 164 DISALLOW_COPY_AND_ASSIGN(SupervisedUserSyncService); |
| 166 }; | 165 }; |
| 167 | 166 |
| 168 #endif // CHROME_BROWSER_SUPERVISED_USER_SUPERVISED_USER_SYNC_SERVICE_H_ | 167 #endif // CHROME_BROWSER_SUPERVISED_USER_SUPERVISED_USER_SYNC_SERVICE_H_ |
| OLD | NEW |