Chromium Code Reviews| 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 |