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..9464c37fb14c1f69c6655ddf90f9ccda88deaca0 |
| --- /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 "chrome/common/extensions/api/settings_private.h" |
| +#include "extensions/browser/extension_function_registry.h" |
| + |
| +namespace extensions { |
| + |
| +//////////////////////////////////////////////////////////////////////////////// |
| +// SettingsPrivateSetBooleanPrefFunction |
| + |
| +SettingsPrivateSetBooleanPrefFunction:: |
| + ~SettingsPrivateSetBooleanPrefFunction() { |
| +} |
| + |
| +ExtensionFunction::ResponseAction SettingsPrivateSetBooleanPrefFunction::Run() { |
| + // TODO(orenb): Implement with a real check and not just true. |
| + 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.
|
| + base::FundamentalValue* value = new base::FundamentalValue(true); |
| + return RespondNow(OneArgument(value)); |
| +} |
| + |
| +//////////////////////////////////////////////////////////////////////////////// |
| +// SettingsPrivateSetNumericPrefFunction |
| + |
| +SettingsPrivateSetNumericPrefFunction:: |
| + ~SettingsPrivateSetNumericPrefFunction() { |
| +} |
| + |
| +ExtensionFunction::ResponseAction SettingsPrivateSetNumericPrefFunction::Run() { |
| + // TODO(orenb): Implement with a real check and not just true. |
| + VLOG(1) << "chrome.settingsPrivate.setNumericPref is not yet implemented."; |
| + base::FundamentalValue* value = new base::FundamentalValue(true); |
| + return RespondNow(OneArgument(value)); |
| +} |
| + |
| +//////////////////////////////////////////////////////////////////////////////// |
| +// SettingsPrivateSetStringPrefFunction |
| + |
| +SettingsPrivateSetStringPrefFunction:: |
| + ~SettingsPrivateSetStringPrefFunction() { |
| +} |
| + |
| +ExtensionFunction::ResponseAction SettingsPrivateSetStringPrefFunction::Run() { |
| + // TODO(orenb): Implement with a real check and not just true. |
| + VLOG(1) << "chrome.settingsPrivate.setStringPref is not yet implemented."; |
| + base::FundamentalValue* value = new base::FundamentalValue(true); |
| + return RespondNow(OneArgument(value)); |
| +} |
| + |
| +//////////////////////////////////////////////////////////////////////////////// |
| +// SettingsPrivateSetURLPrefFunction |
| + |
| +SettingsPrivateSetURLPrefFunction:: |
| + ~SettingsPrivateSetURLPrefFunction() { |
| +} |
| + |
| +ExtensionFunction::ResponseAction SettingsPrivateSetURLPrefFunction::Run() { |
| + // TODO(orenb): Implement with a real check and not just true. |
| + VLOG(1) << "chrome.settingsPrivate.setURLPref is not yet implemented."; |
| + base::FundamentalValue* value = new base::FundamentalValue(true); |
| + return RespondNow(OneArgument(value)); |
| +} |
| + |
| +//////////////////////////////////////////////////////////////////////////////// |
| +// SettingsPrivateGetAllPrefsFunction |
| + |
| +SettingsPrivateGetAllPrefsFunction::~SettingsPrivateGetAllPrefsFunction() { |
| +} |
| + |
| +ExtensionFunction::ResponseAction SettingsPrivateGetAllPrefsFunction::Run() { |
| + // TODO(orenb): Implement with real prefs. |
| + VLOG(1) << "chrome.settingsPrivate.getAllPrefs is not yet implemented."; |
| + base::ListValue* value = new base::ListValue(); |
| + return RespondNow(OneArgument(value)); |
| +} |
| + |
| +//////////////////////////////////////////////////////////////////////////////// |
| +// SettingsPrivateGetPrefFunction |
| + |
| +SettingsPrivateGetPrefFunction::~SettingsPrivateGetPrefFunction() { |
| +} |
| + |
| +ExtensionFunction::ResponseAction SettingsPrivateGetPrefFunction::Run() { |
| + // TODO(orenb): Implement with real pref. |
| + VLOG(1) << "chrome.settingsPrivate.getPref is not yet implemented."; |
| + |
| + api::settings_private::PrefObject* prefObject = |
| + new api::settings_private::PrefObject(); |
| + |
| + prefObject->type = api::settings_private::PrefType::PREF_TYPE_BOOLEAN; |
| + prefObject->value.reset(new base::FundamentalValue(true)); |
| + prefObject->source = api::settings_private::PrefSource::PREF_SOURCE_USER; |
| + |
| + return RespondNow(OneArgument(prefObject->ToValue().release())); |
| +} |
| + |
| +} // namespace extensions |