Chromium Code Reviews| OLD | NEW |
|---|---|
| (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 "extensions/browser/extension_function_registry.h" | |
| 9 | |
| 10 namespace extensions { | |
| 11 | |
| 12 //////////////////////////////////////////////////////////////////////////////// | |
| 13 // SettingsPrivateSetBooleanPrefFunction | |
| 14 | |
| 15 SettingsPrivateSetBooleanPrefFunction:: | |
| 16 ~SettingsPrivateSetBooleanPrefFunction() { | |
| 17 } | |
| 18 | |
| 19 bool SettingsPrivateSetBooleanPrefFunction::RunAsync() { | |
| 20 // 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.
| |
| 21 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
| |
| 22 } | |
| 23 | |
| 24 void SettingsPrivateSetBooleanPrefFunction::Success(bool result) { | |
| 25 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
| |
| 26 SetResult(value); | |
| 27 SendResponse(true); | |
| 28 } | |
| 29 | |
| 30 void SettingsPrivateSetBooleanPrefFunction::Failure(const std::string& error) { | |
| 31 error_ = error; | |
| 32 SendResponse(false); | |
| 33 } | |
| 34 | |
| 35 //////////////////////////////////////////////////////////////////////////////// | |
| 36 // SettingsPrivateSetNumericPrefFunction | |
| 37 | |
| 38 SettingsPrivateSetNumericPrefFunction:: | |
| 39 ~SettingsPrivateSetNumericPrefFunction() { | |
| 40 } | |
| 41 | |
| 42 bool SettingsPrivateSetNumericPrefFunction::RunAsync() { | |
| 43 // TODO(orenb): Implement. | |
| 44 return true; | |
| 45 } | |
| 46 | |
| 47 void SettingsPrivateSetNumericPrefFunction::Success(bool result) { | |
| 48 base::FundamentalValue* value = new base::FundamentalValue(true); | |
| 49 SetResult(value); | |
| 50 SendResponse(true); | |
| 51 } | |
| 52 | |
| 53 void SettingsPrivateSetNumericPrefFunction::Failure(const std::string& error) { | |
| 54 error_ = error; | |
| 55 SendResponse(false); | |
| 56 } | |
| 57 | |
| 58 //////////////////////////////////////////////////////////////////////////////// | |
| 59 // SettingsPrivateSetStringPrefFunction | |
| 60 | |
| 61 SettingsPrivateSetStringPrefFunction:: | |
| 62 ~SettingsPrivateSetStringPrefFunction() { | |
| 63 } | |
| 64 | |
| 65 bool SettingsPrivateSetStringPrefFunction::RunAsync() { | |
| 66 // TODO(orenb): Implement. | |
| 67 return true; | |
| 68 } | |
| 69 | |
| 70 void SettingsPrivateSetStringPrefFunction::Success(bool result) { | |
| 71 base::FundamentalValue* value = new base::FundamentalValue(true); | |
| 72 SetResult(value); | |
| 73 SendResponse(true); | |
| 74 } | |
| 75 | |
| 76 void SettingsPrivateSetStringPrefFunction::Failure(const std::string& error) { | |
| 77 error_ = error; | |
| 78 SendResponse(false); | |
| 79 } | |
| 80 | |
| 81 //////////////////////////////////////////////////////////////////////////////// | |
| 82 // SettingsPrivateGetAllPrefsFunction | |
| 83 | |
| 84 SettingsPrivateGetAllPrefsFunction::~SettingsPrivateGetAllPrefsFunction() { | |
| 85 } | |
| 86 | |
| 87 bool SettingsPrivateGetAllPrefsFunction::RunAsync() { | |
| 88 // TODO(orenb): Implement. | |
| 89 return true; | |
| 90 } | |
| 91 | |
| 92 void SettingsPrivateGetAllPrefsFunction::Success( | |
| 93 scoped_ptr<base::ListValue> result) { | |
| 94 SendResponse(true); | |
| 95 } | |
| 96 | |
| 97 void SettingsPrivateGetAllPrefsFunction::Failure(const std::string& error) { | |
| 98 error_ = error; | |
| 99 SendResponse(false); | |
| 100 } | |
| 101 | |
| 102 } // namespace extensions | |
| OLD | NEW |