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

Side by Side Diff: chrome/browser/extensions/api/settings_private/settings_private_api.cc

Issue 1015623005: chrome.settingsPrivate: Basic stub implementation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Some small cleanups Created 5 years, 9 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
(Empty)
1 // Copyright 2015 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/extensions/api/settings_private/settings_private_api.h"
6
7 #include "base/values.h"
8 #include "chrome/common/extensions/api/settings_private.h"
9 #include "extensions/browser/extension_function_registry.h"
10
11 namespace extensions {
12
13 ////////////////////////////////////////////////////////////////////////////////
14 // SettingsPrivateSetBooleanPrefFunction
15
16 SettingsPrivateSetBooleanPrefFunction::
17 ~SettingsPrivateSetBooleanPrefFunction() {
18 }
19
20 ExtensionFunction::ResponseAction SettingsPrivateSetBooleanPrefFunction::Run() {
21 // TODO(orenb): Implement with a real check and not just true.
22 VLOG(1) << "chrome.settingsPrivate.setBooleanPref is not yet implemented.";
stevenjb 2015/03/20 21:53:48 We should go ahead and get the params and validate
Oren Blasberg 2015/03/20 23:30:30 For the sake of making quicker progress can we tab
stevenjb 2015/03/20 23:40:57 I don't agree that will make progress any faster.
Oren Blasberg 2015/03/21 00:59:43 Done.
23 base::FundamentalValue* value = new base::FundamentalValue(true);
24 return RespondNow(OneArgument(value));
25 }
26
27 ////////////////////////////////////////////////////////////////////////////////
28 // SettingsPrivateSetNumericPrefFunction
29
30 SettingsPrivateSetNumericPrefFunction::
31 ~SettingsPrivateSetNumericPrefFunction() {
32 }
33
34 ExtensionFunction::ResponseAction SettingsPrivateSetNumericPrefFunction::Run() {
35 // TODO(orenb): Implement with a real check and not just true.
36 VLOG(1) << "chrome.settingsPrivate.setNumericPref is not yet implemented.";
37 base::FundamentalValue* value = new base::FundamentalValue(true);
38 return RespondNow(OneArgument(value));
39 }
40
41 ////////////////////////////////////////////////////////////////////////////////
42 // SettingsPrivateSetStringPrefFunction
43
44 SettingsPrivateSetStringPrefFunction::
45 ~SettingsPrivateSetStringPrefFunction() {
46 }
47
48 ExtensionFunction::ResponseAction SettingsPrivateSetStringPrefFunction::Run() {
49 // TODO(orenb): Implement with a real check and not just true.
50 VLOG(1) << "chrome.settingsPrivate.setStringPref is not yet implemented.";
51 base::FundamentalValue* value = new base::FundamentalValue(true);
52 return RespondNow(OneArgument(value));
53 }
54
55 ////////////////////////////////////////////////////////////////////////////////
56 // SettingsPrivateSetURLPrefFunction
57
58 SettingsPrivateSetURLPrefFunction::
59 ~SettingsPrivateSetURLPrefFunction() {
60 }
61
62 ExtensionFunction::ResponseAction SettingsPrivateSetURLPrefFunction::Run() {
63 // TODO(orenb): Implement with a real check and not just true.
64 VLOG(1) << "chrome.settingsPrivate.setURLPref is not yet implemented.";
65 base::FundamentalValue* value = new base::FundamentalValue(true);
66 return RespondNow(OneArgument(value));
67 }
68
69 ////////////////////////////////////////////////////////////////////////////////
70 // SettingsPrivateGetAllPrefsFunction
71
72 SettingsPrivateGetAllPrefsFunction::~SettingsPrivateGetAllPrefsFunction() {
73 }
74
75 ExtensionFunction::ResponseAction SettingsPrivateGetAllPrefsFunction::Run() {
76 // TODO(orenb): Implement with real prefs.
77 VLOG(1) << "chrome.settingsPrivate.getAllPrefs is not yet implemented.";
78 base::ListValue* value = new base::ListValue();
79 return RespondNow(OneArgument(value));
80 }
81
82 ////////////////////////////////////////////////////////////////////////////////
83 // SettingsPrivateGetPrefFunction
84
85 SettingsPrivateGetPrefFunction::~SettingsPrivateGetPrefFunction() {
86 }
87
88 ExtensionFunction::ResponseAction SettingsPrivateGetPrefFunction::Run() {
89 // TODO(orenb): Implement with real pref.
90 VLOG(1) << "chrome.settingsPrivate.getPref is not yet implemented.";
91
92 api::settings_private::PrefObject* prefObject =
93 new api::settings_private::PrefObject();
94
95 prefObject->type = api::settings_private::PrefType::PREF_TYPE_BOOLEAN;
96 prefObject->value.reset(new base::FundamentalValue(true));
97 prefObject->source = api::settings_private::PrefSource::PREF_SOURCE_USER;
98
99 return RespondNow(OneArgument(prefObject->ToValue().release()));
100 }
101
102 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698