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

Unified 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: Update API to reflect design changes. Still error on calling method. 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/extensions/api/settings_private/settings_private_api.cc
diff --git a/chrome/browser/extensions/api/settings_private/settings_private_api.cc b/chrome/browser/extensions/api/settings_private/settings_private_api.cc
new file mode 100644
index 0000000000000000000000000000000000000000..f464e51fd4dede39b0fbf69e1f298924f684daa3
--- /dev/null
+++ b/chrome/browser/extensions/api/settings_private/settings_private_api.cc
@@ -0,0 +1,102 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/extensions/api/settings_private/settings_private_api.h"
+
+#include "base/values.h"
+#include "extensions/browser/extension_function_registry.h"
+
+namespace extensions {
+
+////////////////////////////////////////////////////////////////////////////////
+// SettingsPrivateSetBooleanPrefFunction
+
+SettingsPrivateSetBooleanPrefFunction::
+ ~SettingsPrivateSetBooleanPrefFunction() {
+}
+
+bool SettingsPrivateSetBooleanPrefFunction::RunAsync() {
+ // TODO(orenb): Implement.
stevenjb 2015/03/20 15:45:29 We should VLOG something since we haven't implemen
Oren Blasberg 2015/03/20 18:58:52 Done.
+ return true;
stevenjb 2015/03/20 15:45:29 Also, this needs to call Success() asynchronously,
Oren Blasberg 2015/03/20 18:58:52 Acknowledged. I got this working by switching to h
+}
+
+void SettingsPrivateSetBooleanPrefFunction::Success(bool result) {
+ base::FundamentalValue* value = new base::FundamentalValue(true);
stevenjb 2015/03/20 15:45:29 This needs to be a PrefObject type, which will app
Oren Blasberg 2015/03/20 18:58:52 As discussed offline, this is a set method not a g
+ SetResult(value);
+ SendResponse(true);
+}
+
+void SettingsPrivateSetBooleanPrefFunction::Failure(const std::string& error) {
+ error_ = error;
+ SendResponse(false);
+}
+
+////////////////////////////////////////////////////////////////////////////////
+// SettingsPrivateSetNumericPrefFunction
+
+SettingsPrivateSetNumericPrefFunction::
+ ~SettingsPrivateSetNumericPrefFunction() {
+}
+
+bool SettingsPrivateSetNumericPrefFunction::RunAsync() {
+ // TODO(orenb): Implement.
+ return true;
+}
+
+void SettingsPrivateSetNumericPrefFunction::Success(bool result) {
+ base::FundamentalValue* value = new base::FundamentalValue(true);
+ SetResult(value);
+ SendResponse(true);
+}
+
+void SettingsPrivateSetNumericPrefFunction::Failure(const std::string& error) {
+ error_ = error;
+ SendResponse(false);
+}
+
+////////////////////////////////////////////////////////////////////////////////
+// SettingsPrivateSetStringPrefFunction
+
+SettingsPrivateSetStringPrefFunction::
+ ~SettingsPrivateSetStringPrefFunction() {
+}
+
+bool SettingsPrivateSetStringPrefFunction::RunAsync() {
+ // TODO(orenb): Implement.
+ return true;
+}
+
+void SettingsPrivateSetStringPrefFunction::Success(bool result) {
+ base::FundamentalValue* value = new base::FundamentalValue(true);
+ SetResult(value);
+ SendResponse(true);
+}
+
+void SettingsPrivateSetStringPrefFunction::Failure(const std::string& error) {
+ error_ = error;
+ SendResponse(false);
+}
+
+////////////////////////////////////////////////////////////////////////////////
+// SettingsPrivateGetAllPrefsFunction
+
+SettingsPrivateGetAllPrefsFunction::~SettingsPrivateGetAllPrefsFunction() {
+}
+
+bool SettingsPrivateGetAllPrefsFunction::RunAsync() {
+ // TODO(orenb): Implement.
+ return true;
+}
+
+void SettingsPrivateGetAllPrefsFunction::Success(
+ scoped_ptr<base::ListValue> result) {
+ SendResponse(true);
+}
+
+void SettingsPrivateGetAllPrefsFunction::Failure(const std::string& error) {
+ error_ = error;
+ SendResponse(false);
+}
+
+} // namespace extensions

Powered by Google App Engine
This is Rietveld 408576698