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

Unified Diff: chrome/browser/extensions/chrome_extension_function.h

Issue 2360073002: [Extensions] Isolate ExtensionFunction results_ and error_ (Closed)
Patch Set: lazyboy's Created 4 years, 3 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: chrome/browser/extensions/chrome_extension_function.h
diff --git a/chrome/browser/extensions/chrome_extension_function.h b/chrome/browser/extensions/chrome_extension_function.h
index a556085562dbf13e8e890d95ba37327bc9d5243f..59d5e1e0ad19324de4bbbe795683da57d1149514 100644
--- a/chrome/browser/extensions/chrome_extension_function.h
+++ b/chrome/browser/extensions/chrome_extension_function.h
@@ -54,16 +54,31 @@ class ChromeUIThreadExtensionFunction : public UIThreadExtensionFunction {
// Same as above but uses WindowControllerList instead of BrowserList.
extensions::WindowController* GetExtensionWindowController();
- // Gets the "current" web contents if any. If there is no associated web
- // contents then defaults to the foremost one.
+ // ExtensionFunction:
content::WebContents* GetAssociatedWebContents() override;
+ void SetError(const std::string& error) override;
+ const std::string& GetError() const override;
+
+ protected:
+ ~ChromeUIThreadExtensionFunction() override;
// Responds with success/failure. |results_| or |error_| should be set
// accordingly.
void SendResponse(bool success);
- protected:
- ~ChromeUIThreadExtensionFunction() override;
+ // Sets a single Value as the results of the function.
+ void SetResult(std::unique_ptr<base::Value> result);
+
+ // Sets multiple Values as the results of the function.
+ void SetResultList(std::unique_ptr<base::ListValue> results);
+
+ // Exposed versions of ExtensionFunction::results_ and
+ // ExtensionFunction::error_ that are curried into the response.
+ // These need to keep the same name to avoid breaking existing
+ // implementations, but this should be temporary with crbug.com/648275
+ // and crbug.com/634140.
+ std::unique_ptr<base::ListValue> results_;
+ std::string error_;
private:
ChromeExtensionFunctionDetails chrome_details_;
« no previous file with comments | « chrome/browser/extensions/api/tabs/tabs_api.cc ('k') | chrome/browser/extensions/chrome_extension_function.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698