Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(503)

Unified Diff: extensions/browser/extension_function.cc

Issue 885443010: WebstorePrivate extension API cleanup, part 1 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@testext_permission_prompt
Patch Set: remove dispatcher dependency Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « extensions/browser/extension_function.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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));
}
« no previous file with comments | « extensions/browser/extension_function.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698