| 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/supervised_user_settings_service.h" | 5 #include "chrome/browser/supervised_user/supervised_user_settings_service.h" |
| 6 | 6 |
| 7 #include "base/callback.h" | 7 #include "base/callback.h" |
| 8 #include "base/json/json_reader.h" | 8 #include "base/json/json_reader.h" |
| 9 #include "base/json/json_writer.h" | 9 #include "base/json/json_writer.h" |
| 10 #include "base/prefs/json_pref_store.h" | 10 #include "base/prefs/json_pref_store.h" |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 DCHECK(!error.IsSet()) << error.ToString(); | 128 DCHECK(!error.IsSet()) << error.ToString(); |
| 129 } else { | 129 } else { |
| 130 // Queue the item up to be uploaded when we start syncing | 130 // Queue the item up to be uploaded when we start syncing |
| 131 // (in MergeDataAndStartSyncing()). | 131 // (in MergeDataAndStartSyncing()). |
| 132 content::RecordAction(UserMetricsAction("ManagedUsers_UploadItem_Queued")); | 132 content::RecordAction(UserMetricsAction("ManagedUsers_UploadItem_Queued")); |
| 133 dict = GetQueuedItems(); | 133 dict = GetQueuedItems(); |
| 134 } | 134 } |
| 135 dict->SetWithoutPathExpansion(key_suffix, value.release()); | 135 dict->SetWithoutPathExpansion(key_suffix, value.release()); |
| 136 } | 136 } |
| 137 | 137 |
| 138 void SupervisedUserSettingsService::SetLocalSettingForTesting( | 138 void SupervisedUserSettingsService::SetLocalSetting( |
| 139 const std::string& key, | 139 const std::string& key, |
| 140 scoped_ptr<base::Value> value) { | 140 scoped_ptr<base::Value> value) { |
| 141 if (value) | 141 if (value) |
| 142 local_settings_->SetWithoutPathExpansion(key, value.release()); | 142 local_settings_->SetWithoutPathExpansion(key, value.release()); |
| 143 else | 143 else |
| 144 local_settings_->RemoveWithoutPathExpansion(key, NULL); | 144 local_settings_->RemoveWithoutPathExpansion(key, NULL); |
| 145 | 145 |
| 146 InformSubscribers(); | 146 InformSubscribers(); |
| 147 } | 147 } |
| 148 | 148 |
| (...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 374 } | 374 } |
| 375 | 375 |
| 376 void SupervisedUserSettingsService::InformSubscribers() { | 376 void SupervisedUserSettingsService::InformSubscribers() { |
| 377 if (!IsReady()) | 377 if (!IsReady()) |
| 378 return; | 378 return; |
| 379 | 379 |
| 380 scoped_ptr<base::DictionaryValue> settings = GetSettings(); | 380 scoped_ptr<base::DictionaryValue> settings = GetSettings(); |
| 381 for (const auto& callback : subscribers_) | 381 for (const auto& callback : subscribers_) |
| 382 callback.Run(settings.get()); | 382 callback.Run(settings.get()); |
| 383 } | 383 } |
| OLD | NEW |