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

Side by Side Diff: chrome/browser/chromeos/cros_settings.cc

Issue 2935011: Initial accounts options page. (Closed) Base URL: http://src.chromium.org/git/chromium.git
Patch Set: use ListItem directly for now per arv Created 10 years, 5 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
« no previous file with comments | « chrome/browser/chromeos/cros_settings.h ('k') | chrome/browser/chromeos/cros_settings_names.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2010 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.
4
5 #include "chrome/browser/chromeos/cros_settings.h"
6
7 #include "base/singleton.h"
8 #include "base/string_util.h"
9 #include "chrome/browser/chromeos/mock_cros_settings.h"
10
11 namespace chromeos {
12
13 CrosSettings* CrosSettings::Get() {
14 // TODO(xiyaun): Use real stuff when underlying libcros is ready.
15 return Singleton<MockCrosSettings>::get();
16 }
17
18 bool CrosSettings::IsCrosSettings(const std::wstring& path) {
19 return StartsWith(path, kCrosSettingsPrefix, true);
20 }
21
22 void CrosSettings::SetBoolean(const std::wstring& path, bool in_value) {
23 Set(path, Value::CreateBooleanValue(in_value));
24 }
25
26 void CrosSettings::SetInteger(const std::wstring& path, int in_value) {
27 Set(path, Value::CreateIntegerValue(in_value));
28 }
29
30 void CrosSettings::SetReal(const std::wstring& path, double in_value) {
31 Set(path, Value::CreateRealValue(in_value));
32 }
33
34 void CrosSettings::SetString(const std::wstring& path,
35 const std::string& in_value) {
36 Set(path, Value::CreateStringValue(in_value));
37 }
38
39 bool CrosSettings::GetBoolean(const std::wstring& path,
40 bool* bool_value) const {
41 Value* value;
42 if (!Get(path, &value))
43 return false;
44
45 return value->GetAsBoolean(bool_value);
46 }
47
48 bool CrosSettings::GetInteger(const std::wstring& path,
49 int* out_value) const {
50 Value* value;
51 if (!Get(path, &value))
52 return false;
53
54 return value->GetAsInteger(out_value);
55 }
56
57 bool CrosSettings::GetReal(const std::wstring& path,
58 double* out_value) const {
59 Value* value;
60 if (!Get(path, &value))
61 return false;
62
63 return value->GetAsReal(out_value);
64 }
65
66 bool CrosSettings::GetString(const std::wstring& path,
67 std::string* out_value) const {
68 Value* value;
69 if (!Get(path, &value))
70 return false;
71
72 return value->GetAsString(out_value);
73 }
74
75 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/cros_settings.h ('k') | chrome/browser/chromeos/cros_settings_names.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698