| 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 #include "chrome/browser/supervised_user/legacy/supervised_user_sync_service.h" | 5 #include "chrome/browser/supervised_user/legacy/supervised_user_sync_service.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <set> | 9 #include <set> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 274 const std::string& encryption_key, | 274 const std::string& encryption_key, |
| 275 int avatar_index, | 275 int avatar_index, |
| 276 bool add_user) { | 276 bool add_user) { |
| 277 DictionaryPrefUpdate update(prefs_, prefs::kSupervisedUsers); | 277 DictionaryPrefUpdate update(prefs_, prefs::kSupervisedUsers); |
| 278 base::DictionaryValue* dict = update.Get(); | 278 base::DictionaryValue* dict = update.Get(); |
| 279 std::unique_ptr<base::DictionaryValue> value = CreateDictionary( | 279 std::unique_ptr<base::DictionaryValue> value = CreateDictionary( |
| 280 name, master_key, signature_key, encryption_key, avatar_index); | 280 name, master_key, signature_key, encryption_key, avatar_index); |
| 281 | 281 |
| 282 DCHECK_EQ(add_user, !dict->HasKey(id)); | 282 DCHECK_EQ(add_user, !dict->HasKey(id)); |
| 283 base::DictionaryValue* entry = value.get(); | 283 base::DictionaryValue* entry = value.get(); |
| 284 dict->SetWithoutPathExpansion(id, value.release()); | 284 dict->SetWithoutPathExpansion(id, std::move(value)); |
| 285 | 285 |
| 286 if (!sync_processor_) | 286 if (!sync_processor_) |
| 287 return; | 287 return; |
| 288 | 288 |
| 289 // If we're already syncing, create a new change and upload it. | 289 // If we're already syncing, create a new change and upload it. |
| 290 SyncChangeList change_list; | 290 SyncChangeList change_list; |
| 291 change_list.push_back( | 291 change_list.push_back( |
| 292 SyncChange(FROM_HERE, | 292 SyncChange(FROM_HERE, |
| 293 add_user ? SyncChange::ACTION_ADD : SyncChange::ACTION_UPDATE, | 293 add_user ? SyncChange::ACTION_ADD : SyncChange::ACTION_UPDATE, |
| 294 CreateSyncDataFromDictionaryEntry(id, *entry))); | 294 CreateSyncDataFromDictionaryEntry(id, *entry))); |
| (...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 572 observer.OnSupervisedUsersChanged(); | 572 observer.OnSupervisedUsersChanged(); |
| 573 } | 573 } |
| 574 | 574 |
| 575 void SupervisedUserSyncService::DispatchCallbacks() { | 575 void SupervisedUserSyncService::DispatchCallbacks() { |
| 576 const base::DictionaryValue* supervised_users = | 576 const base::DictionaryValue* supervised_users = |
| 577 prefs_->GetDictionary(prefs::kSupervisedUsers); | 577 prefs_->GetDictionary(prefs::kSupervisedUsers); |
| 578 for (const auto& callback : callbacks_) | 578 for (const auto& callback : callbacks_) |
| 579 callback.Run(supervised_users); | 579 callback.Run(supervised_users); |
| 580 callbacks_.clear(); | 580 callbacks_.clear(); |
| 581 } | 581 } |
| OLD | NEW |