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 !base::StartsWithASCII(name, kSupervisedUserInternalItemPrefix, false); | 47 return !base::StartsWith(name, kSupervisedUserInternalItemPrefix, |
| 48 base::CompareCase::INSENSITIVE_ASCII); |
48 } | 49 } |
49 | 50 |
50 } // namespace | 51 } // namespace |
51 | 52 |
52 SupervisedUserSettingsService::SupervisedUserSettingsService() | 53 SupervisedUserSettingsService::SupervisedUserSettingsService() |
53 : active_(false), | 54 : active_(false), |
54 initialization_failed_(false), | 55 initialization_failed_(false), |
55 local_settings_(new base::DictionaryValue) { | 56 local_settings_(new base::DictionaryValue) { |
56 } | 57 } |
57 | 58 |
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
401 } | 402 } |
402 | 403 |
403 void SupervisedUserSettingsService::InformSubscribers() { | 404 void SupervisedUserSettingsService::InformSubscribers() { |
404 if (!IsReady()) | 405 if (!IsReady()) |
405 return; | 406 return; |
406 | 407 |
407 scoped_ptr<base::DictionaryValue> settings = GetSettings(); | 408 scoped_ptr<base::DictionaryValue> settings = GetSettings(); |
408 for (const auto& callback : subscribers_) | 409 for (const auto& callback : subscribers_) |
409 callback.Run(settings.get()); | 410 callback.Run(settings.get()); |
410 } | 411 } |
OLD | NEW |