OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/chromeos/cros_settings_provider.h" | 5 #include "chrome/browser/chromeos/cros_settings_provider.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
10 #include "base/values.h" | 10 #include "base/values.h" |
11 #include "chrome/common/chrome_switches.h" | 11 #include "chrome/common/chrome_switches.h" |
12 | 12 |
13 namespace chromeos { | 13 namespace chromeos { |
14 | 14 |
| 15 CrosSettingsProvider::CrosSettingsProvider( |
| 16 const NotifyObserversCallback& notify_cb) |
| 17 : notify_cb_(notify_cb) { |
| 18 } |
| 19 |
| 20 CrosSettingsProvider::~CrosSettingsProvider() { |
| 21 } |
| 22 |
15 void CrosSettingsProvider::Set(const std::string& path, | 23 void CrosSettingsProvider::Set(const std::string& path, |
16 const base::Value& value) { | 24 const base::Value& value) { |
17 // We don't allow changing any of the cros settings without prefix | 25 // We don't allow changing any of the cros settings without prefix |
18 // "cros.session." in the guest mode. | 26 // "cros.session." in the guest mode. |
19 // It should not reach here from UI in the guest mode, but just in case. | 27 // It should not reach here from UI in the guest mode, but just in case. |
20 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kGuestSession) && | 28 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kGuestSession) && |
21 !::StartsWithASCII(path, "cros.session.", true)) { | 29 !::StartsWithASCII(path, "cros.session.", true)) { |
22 LOG(ERROR) << "Ignoring the guest request to change: " << path; | 30 LOG(ERROR) << "Ignoring the guest request to change: " << path; |
23 return; | 31 return; |
24 } | 32 } |
25 DoSet(path, value); | 33 DoSet(path, value); |
26 } | 34 } |
27 | 35 |
| 36 void CrosSettingsProvider::NotifyObservers(const std::string& path) { |
| 37 notify_cb_.Run(path); |
| 38 } |
| 39 |
28 }; // namespace chromeos | 40 }; // namespace chromeos |
OLD | NEW |