This source file includes following definitions.
- NotifyObservers
- SetNotifyObserversCallback
#include "chromeos/settings/cros_settings_provider.h"
#include "base/command_line.h"
#include "base/logging.h"
#include "base/strings/string_util.h"
#include "base/values.h"
#include "chromeos/chromeos_switches.h"
namespace chromeos {
CrosSettingsProvider::CrosSettingsProvider(
const NotifyObserversCallback& notify_cb)
: notify_cb_(notify_cb) {
}
CrosSettingsProvider::~CrosSettingsProvider() {
}
void CrosSettingsProvider::Set(const std::string& path,
const base::Value& value) {
if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kGuestSession) &&
!::StartsWithASCII(path, "cros.session.", true)) {
LOG(ERROR) << "Ignoring the guest request to change: " << path;
return;
}
DoSet(path, value);
}
void CrosSettingsProvider::NotifyObservers(const std::string& path) {
if (!notify_cb_.is_null())
notify_cb_.Run(path);
}
void CrosSettingsProvider::SetNotifyObserversCallback(
const NotifyObserversCallback& notify_cb) {
notify_cb_ = notify_cb;
}
};