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

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

Issue 257333002: Drive extension functions from ExtensionFunction::Run. The (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix comment Created 6 years, 8 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.cc
diff --git a/chrome/browser/extensions/chrome_extension_function.cc b/chrome/browser/extensions/chrome_extension_function.cc
index 24ccfc416791ddde803ef3c569201eba56b4b679..f9c7f28aa8df7afd30b649c098b59e1d3a5b37e2 100644
--- a/chrome/browser/extensions/chrome_extension_function.cc
+++ b/chrome/browser/extensions/chrome_extension_function.cc
@@ -17,13 +17,14 @@
using content::RenderViewHost;
using content::WebContents;
-ChromeAsyncExtensionFunction::ChromeAsyncExtensionFunction() {}
+ChromeUIThreadExtensionFunction::ChromeUIThreadExtensionFunction() {
+}
-Profile* ChromeAsyncExtensionFunction::GetProfile() const {
+Profile* ChromeUIThreadExtensionFunction::GetProfile() const {
return Profile::FromBrowserContext(context_);
}
-bool ChromeAsyncExtensionFunction::CanOperateOnWindow(
+bool ChromeUIThreadExtensionFunction::CanOperateOnWindow(
const extensions::WindowController* window_controller) const {
const extensions::Extension* extension = GetExtension();
// |extension| is NULL for unit tests only.
@@ -41,7 +42,7 @@ bool ChromeAsyncExtensionFunction::CanOperateOnWindow(
}
// TODO(stevenjb): Replace this with GetExtensionWindowController().
-Browser* ChromeAsyncExtensionFunction::GetCurrentBrowser() {
+Browser* ChromeUIThreadExtensionFunction::GetCurrentBrowser() {
// If the delegate has an associated browser, return it.
if (dispatcher()) {
extensions::WindowController* window_controller =
@@ -80,7 +81,7 @@ Browser* ChromeAsyncExtensionFunction::GetCurrentBrowser() {
}
extensions::WindowController*
-ChromeAsyncExtensionFunction::GetExtensionWindowController() {
+ChromeUIThreadExtensionFunction::GetExtensionWindowController() {
// If the delegate has an associated window controller, return it.
if (dispatcher()) {
extensions::WindowController* window_controller =
@@ -93,7 +94,8 @@ ChromeAsyncExtensionFunction::GetExtensionWindowController() {
->CurrentWindowForFunction(this);
}
-content::WebContents* ChromeAsyncExtensionFunction::GetAssociatedWebContents() {
+content::WebContents*
+ChromeUIThreadExtensionFunction::GetAssociatedWebContents() {
content::WebContents* web_contents =
UIThreadExtensionFunction::GetAssociatedWebContents();
if (web_contents)
@@ -105,13 +107,24 @@ content::WebContents* ChromeAsyncExtensionFunction::GetAssociatedWebContents() {
return browser->tab_strip_model()->GetActiveWebContents();
}
+ChromeUIThreadExtensionFunction::~ChromeUIThreadExtensionFunction() {
+}
+
+ChromeAsyncExtensionFunction::ChromeAsyncExtensionFunction() {
+}
+
ChromeAsyncExtensionFunction::~ChromeAsyncExtensionFunction() {}
-ChromeSyncExtensionFunction::ChromeSyncExtensionFunction() {}
+ExtensionFunction::ResponseAction ChromeAsyncExtensionFunction::Run() {
+ return RunAsync() ? RespondLater() : RespondNow(Error(error_));
+}
-bool ChromeSyncExtensionFunction::RunImpl() {
- SendResponse(RunSync());
- return true;
+ChromeSyncExtensionFunction::ChromeSyncExtensionFunction() {
}
ChromeSyncExtensionFunction::~ChromeSyncExtensionFunction() {}
+
+ExtensionFunction::ResponseAction ChromeSyncExtensionFunction::Run() {
+ return RespondNow(RunSync() ? MultipleArguments(results_.get())
+ : Error(error_));
+}
« no previous file with comments | « chrome/browser/extensions/chrome_extension_function.h ('k') | chrome/browser/extensions/extension_function_test_utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698