Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(584)

Side by Side Diff: chromeos/settings/cros_settings_provider.cc

Issue 1019283004: Switch to direct use of OwnerSettingsServiceChromeOS::Set() in tests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use settings provider to set read-only device settings. Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "chromeos/settings/cros_settings_provider.h" 5 #include "chromeos/settings/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/strings/string_util.h" 9 #include "base/strings/string_util.h"
10 #include "base/values.h" 10 #include "base/values.h"
(...skipping 16 matching lines...) Expand all
27 // 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.
28 if (base::CommandLine::ForCurrentProcess()->HasSwitch( 28 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
29 switches::kGuestSession) && 29 switches::kGuestSession) &&
30 !::StartsWithASCII(path, "cros.session.", true)) { 30 !::StartsWithASCII(path, "cros.session.", true)) {
31 LOG(ERROR) << "Ignoring the guest request to change: " << path; 31 LOG(ERROR) << "Ignoring the guest request to change: " << path;
32 return; 32 return;
33 } 33 }
34 DoSet(path, value); 34 DoSet(path, value);
35 } 35 }
36 36
37 void CrosSettingsProvider::SetBoolean(const std::string& path, bool in_value) {
38 base::FundamentalValue value(in_value);
39 Set(path, value);
40 }
41
42 void CrosSettingsProvider::SetInteger(const std::string& path, int in_value) {
43 base::FundamentalValue value(in_value);
44 Set(path, value);
45 }
46
47 void CrosSettingsProvider::SetDouble(const std::string& path, double in_value) {
48 base::FundamentalValue value(in_value);
49 Set(path, value);
50 }
51
52 void CrosSettingsProvider::SetString(const std::string& path,
53 const std::string& in_value) {
54 base::StringValue value(in_value);
55 Set(path, value);
56 }
57
37 void CrosSettingsProvider::NotifyObservers(const std::string& path) { 58 void CrosSettingsProvider::NotifyObservers(const std::string& path) {
38 if (!notify_cb_.is_null()) 59 if (!notify_cb_.is_null())
39 notify_cb_.Run(path); 60 notify_cb_.Run(path);
40 } 61 }
41 62
42 void CrosSettingsProvider::SetNotifyObserversCallback( 63 void CrosSettingsProvider::SetNotifyObserversCallback(
43 const NotifyObserversCallback& notify_cb) { 64 const NotifyObserversCallback& notify_cb) {
44 notify_cb_ = notify_cb; 65 notify_cb_ = notify_cb;
45 } 66 }
46 67
47 }; // namespace chromeos 68 }; // namespace chromeos
OLDNEW
« chromeos/settings/cros_settings_provider.h ('K') | « chromeos/settings/cros_settings_provider.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698