Index: extensions/browser/extension_function.cc |
diff --git a/extensions/browser/extension_function.cc b/extensions/browser/extension_function.cc |
index a1cb84cc64eae1841831f31b951fbb09741ffdcd..67fabdd3abb914e40de7ee902db4fd0b1edc873c 100644 |
--- a/extensions/browser/extension_function.cc |
+++ b/extensions/browser/extension_function.cc |
@@ -60,6 +60,25 @@ class ArgumentListResponseValue |
const char* title_; |
}; |
+class ErrorWithArgumentsResponseValue : public ArgumentListResponseValue { |
+ public: |
+ ErrorWithArgumentsResponseValue(const std::string& function_name, |
+ const char* title, |
+ ExtensionFunction* function, |
+ scoped_ptr<base::ListValue> result, |
+ const std::string& error) |
+ : ArgumentListResponseValue(function_name, |
+ title, |
+ function, |
+ result.Pass()) { |
+ function->SetError(error); |
+ } |
+ |
+ ~ErrorWithArgumentsResponseValue() override {} |
+ |
+ bool Apply() override { return false; } |
+}; |
+ |
class ErrorResponseValue : public ExtensionFunction::ResponseValueObject { |
public: |
ErrorResponseValue(ExtensionFunction* function, const std::string& error) { |
@@ -331,6 +350,13 @@ ExtensionFunction::ResponseValue ExtensionFunction::Error( |
this, ErrorUtils::FormatErrorMessage(format, s1, s2, s3))); |
} |
+ExtensionFunction::ResponseValue ExtensionFunction::ErrorWithArguments( |
+ scoped_ptr<base::ListValue> args, |
+ const std::string& error) { |
+ return ResponseValue(new ErrorWithArgumentsResponseValue( |
+ name(), "ErrorWithArguments", this, args.Pass(), error)); |
+} |
+ |
ExtensionFunction::ResponseValue ExtensionFunction::BadMessage() { |
return ResponseValue(new BadMessageResponseValue(this)); |
} |