| Index: chrome/browser/extensions/extension_function.cc
|
| diff --git a/chrome/browser/extensions/extension_function.cc b/chrome/browser/extensions/extension_function.cc
|
| index 437867fd449ffdc9b04d671a14aed581d78f200c..6f5b1008c59aafe9c82de39bf95a92e80e27bab5 100644
|
| --- a/chrome/browser/extensions/extension_function.cc
|
| +++ b/chrome/browser/extensions/extension_function.cc
|
| @@ -10,12 +10,30 @@
|
| #include "chrome/browser/extensions/extensions_service.h"
|
| #include "chrome/browser/profile.h"
|
|
|
| +ExtensionFunction::ExtensionFunction()
|
| + : request_id_(-1), name_(""), has_callback_(false) {
|
| +}
|
| +
|
| +ExtensionFunction::~ExtensionFunction() {
|
| +}
|
| +
|
| Extension* ExtensionFunction::GetExtension() {
|
| ExtensionsService* service = profile_->GetExtensionsService();
|
| DCHECK(service);
|
| return service->GetExtensionById(extension_id_, false);
|
| }
|
|
|
| +Browser* ExtensionFunction::GetCurrentBrowser() {
|
| + return dispatcher()->GetCurrentBrowser(include_incognito_);
|
| +}
|
| +
|
| +AsyncExtensionFunction::AsyncExtensionFunction()
|
| + : args_(NULL), bad_message_(false) {
|
| +}
|
| +
|
| +AsyncExtensionFunction::~AsyncExtensionFunction() {
|
| +}
|
| +
|
| void AsyncExtensionFunction::SetArgs(const ListValue* args) {
|
| DCHECK(!args_.get()); // Should only be called once.
|
| args_.reset(static_cast<ListValue*>(args->DeepCopy()));
|
| @@ -29,6 +47,15 @@ const std::string AsyncExtensionFunction::GetResult() {
|
| return json;
|
| }
|
|
|
| +const std::string AsyncExtensionFunction::GetError() {
|
| + return error_;
|
| +}
|
| +
|
| +void AsyncExtensionFunction::Run() {
|
| + if (!RunImpl())
|
| + SendResponse(false);
|
| +}
|
| +
|
| void AsyncExtensionFunction::SendResponse(bool success) {
|
| if (!dispatcher())
|
| return;
|
| @@ -43,3 +70,13 @@ bool AsyncExtensionFunction::HasOptionalArgument(size_t index) {
|
| Value* value;
|
| return args_->Get(index, &value) && !value->IsType(Value::TYPE_NULL);
|
| }
|
| +
|
| +SyncExtensionFunction::SyncExtensionFunction() {
|
| +}
|
| +
|
| +SyncExtensionFunction::~SyncExtensionFunction() {
|
| +}
|
| +
|
| +void SyncExtensionFunction::Run() {
|
| + SendResponse(RunImpl());
|
| +}
|
|
|