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 |
| index 33e2b1c93aa56ca77cd3871cab6320b0327d9294..7efb03e7d3ad7294b352fdccb4a2875f0aed5836 100644 |
| --- a/chrome/browser/extensions/api/settings_private/settings_private_api.cc |
| +++ b/chrome/browser/extensions/api/settings_private/settings_private_api.cc |
| @@ -29,8 +29,18 @@ ExtensionFunction::ResponseAction SettingsPrivateSetPrefFunction::Run() { |
| SettingsPrivateDelegate* delegate = |
| SettingsPrivateDelegateFactory::GetForBrowserContext(browser_context()); |
| - return RespondNow(OneArgument(new base::FundamentalValue( |
| - delegate->SetPref(parameters->name, parameters->value.get())))); |
| + PrefsUtil::SetPrefResult result = |
| + delegate->SetPref(parameters->name, parameters->value.get()); |
| + switch (result) { |
| + case PrefsUtil::SUCCESS: |
| + return RespondNow(OneArgument(new base::FundamentalValue(true))); |
| + case PrefsUtil::PREF_NOT_MODIFIABLE: |
| + // Not an error, but return false to indicate setting the pref failed. |
| + return RespondNow(OneArgument(new base::FundamentalValue(false))); |
| + default: |
| + // Indicates a problem with the function call. |
| + return RespondNow(Error("Error setting pref *", parameters->name)); |
|
stevenjb
2015/08/26 17:32:18
Since we went to the trouble to define the differe
michaelpg
2015/08/26 23:32:15
Done.
|
| + } |
| } |