| 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 26 matching lines...) Expand all Loading... |
| 37 | 37 |
| 38 const char kAtomicSettings[] = "atomic_settings"; | 38 const char kAtomicSettings[] = "atomic_settings"; |
| 39 const char kSupervisedUserInternalItemPrefix[] = "X-"; | 39 const char kSupervisedUserInternalItemPrefix[] = "X-"; |
| 40 const char kQueuedItems[] = "queued_items"; | 40 const char kQueuedItems[] = "queued_items"; |
| 41 const char kSplitSettingKeySeparator = ':'; | 41 const char kSplitSettingKeySeparator = ':'; |
| 42 const char kSplitSettings[] = "split_settings"; | 42 const char kSplitSettings[] = "split_settings"; |
| 43 | 43 |
| 44 namespace { | 44 namespace { |
| 45 | 45 |
| 46 bool SettingShouldApplyToPrefs(const std::string& name) { | 46 bool SettingShouldApplyToPrefs(const std::string& name) { |
| 47 return !StartsWithASCII(name, kSupervisedUserInternalItemPrefix, false); | 47 return !base::StartsWithASCII(name, kSupervisedUserInternalItemPrefix, false); |
| 48 } | 48 } |
| 49 | 49 |
| 50 } // namespace | 50 } // namespace |
| 51 | 51 |
| 52 SupervisedUserSettingsService::SupervisedUserSettingsService() | 52 SupervisedUserSettingsService::SupervisedUserSettingsService() |
| 53 : active_(false), | 53 : active_(false), |
| 54 initialization_failed_(false), | 54 initialization_failed_(false), |
| 55 local_settings_(new base::DictionaryValue) { | 55 local_settings_(new base::DictionaryValue) { |
| 56 } | 56 } |
| 57 | 57 |
| (...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 400 } | 400 } |
| 401 | 401 |
| 402 void SupervisedUserSettingsService::InformSubscribers() { | 402 void SupervisedUserSettingsService::InformSubscribers() { |
| 403 if (!IsReady()) | 403 if (!IsReady()) |
| 404 return; | 404 return; |
| 405 | 405 |
| 406 scoped_ptr<base::DictionaryValue> settings = GetSettings(); | 406 scoped_ptr<base::DictionaryValue> settings = GetSettings(); |
| 407 for (const auto& callback : subscribers_) | 407 for (const auto& callback : subscribers_) |
| 408 callback.Run(settings.get()); | 408 callback.Run(settings.get()); |
| 409 } | 409 } |
| OLD | NEW |