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

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: fix 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
Index: extensions/browser/extension_function.cc
diff --git a/extensions/browser/extension_function.cc b/extensions/browser/extension_function.cc
index a1cb84cc64eae1841831f31b951fbb09741ffdcd..a7f4721d21896b98524ba6174a764e55c19cc422 100644
--- a/extensions/browser/extension_function.cc
+++ b/extensions/browser/extension_function.cc
@@ -60,6 +60,25 @@ class ArgumentListResponseValue
const char* title_;
};
+class ArgumentListWithErrorResponseValue : public ArgumentListResponseValue {
+ public:
+ ArgumentListWithErrorResponseValue(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);
+ }
+
+ ~ArgumentListWithErrorResponseValue() 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::ArgumentListWithError(
+ scoped_ptr<base::ListValue> args,
+ const std::string& error) {
+ return ResponseValue(new ArgumentListWithErrorResponseValue(
+ name(), "ArgumentListWithError", this, args.Pass(), error));
+}
+
ExtensionFunction::ResponseValue ExtensionFunction::BadMessage() {
return ResponseValue(new BadMessageResponseValue(this));
}
« extensions/browser/extension_function.h ('K') | « extensions/browser/extension_function.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698