Revert 168224 - Update V8 to version 3.15.4.
[chromium-blink-merge.git] / chrome / browser / chromeos / settings / cros_settings_provider.cc
blobe5810c36cb9d714ed5869bc2c9218faa0626b6b5
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "chrome/browser/chromeos/settings/cros_settings_provider.h"
7 #include "base/command_line.h"
8 #include "base/logging.h"
9 #include "base/string_util.h"
10 #include "base/values.h"
11 #include "chrome/common/chrome_switches.h"
13 namespace chromeos {
15 CrosSettingsProvider::CrosSettingsProvider(
16 const NotifyObserversCallback& notify_cb)
17 : notify_cb_(notify_cb) {
20 CrosSettingsProvider::~CrosSettingsProvider() {
23 void CrosSettingsProvider::Set(const std::string& path,
24 const base::Value& value) {
25 // We don't allow changing any of the cros settings without prefix
26 // "cros.session." in the guest mode.
27 // It should not reach here from UI in the guest mode, but just in case.
28 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kGuestSession) &&
29 !::StartsWithASCII(path, "cros.session.", true)) {
30 LOG(ERROR) << "Ignoring the guest request to change: " << path;
31 return;
33 DoSet(path, value);
36 void CrosSettingsProvider::NotifyObservers(const std::string& path) {
37 if (!notify_cb_.is_null())
38 notify_cb_.Run(path);
41 void CrosSettingsProvider::SetNotifyObserversCallback(
42 const NotifyObserversCallback& notify_cb) {
43 notify_cb_ = notify_cb;
46 }; // namespace chromeos