summaryrefslogtreecommitdiffstats
path: root/extensions/browser/extension_function_dispatcher.cc
diff options
context:
space:
mode:
authorrdevlin.cronin <rdevlin.cronin@chromium.org>2015-06-10 16:32:41 -0700
committerCommit bot <commit-bot@chromium.org>2015-06-10 23:33:30 +0000
commitcb2ec659ab8741962f3391970a5fff512ebb6509 (patch)
tree84c87ca2540a0f0e7dc66bb0b82a5abc79ad012b /extensions/browser/extension_function_dispatcher.cc
parent1bcab9592f6213b9f44379bb66ce7b613b371e0b (diff)
downloadchromium_src-cb2ec659ab8741962f3391970a5fff512ebb6509.zip
chromium_src-cb2ec659ab8741962f3391970a5fff512ebb6509.tar.gz
chromium_src-cb2ec659ab8741962f3391970a5fff512ebb6509.tar.bz2
[Extensions] Clean up the handling of ExtensionHostMsg_Request
ExtensionHostMsg_Request is sent when an extension calls an API function. Before this patch, this IPC would be sent to one of 11 different call sites, all of which then routed it to the ExtensionFunctionDispatcher - and all of which have to implement ExtensionFunctionDispatcher::Delegate. Instead, have ExtensionWebContentsObserver handle the IPC, since it is created (or should be) for all extension web contents. This also lets us eliminate many (though not all) of the ExtensionFunctionDispatcher::Delegate implementations (I will try to clean more up in a later patch). The size of this patch is due to a number of yaks that needed shaving along the way - in particular, around GuestView. BUG=498017 BUG=405246 Review URL: https://codereview.chromium.org/1169223002 Cr-Commit-Position: refs/heads/master@{#333843}
Diffstat (limited to 'extensions/browser/extension_function_dispatcher.cc')
-rw-r--r--extensions/browser/extension_function_dispatcher.cc26
1 files changed, 20 insertions, 6 deletions
diff --git a/extensions/browser/extension_function_dispatcher.cc b/extensions/browser/extension_function_dispatcher.cc
index 917ce65..9a30d2e 100644
--- a/extensions/browser/extension_function_dispatcher.cc
+++ b/extensions/browser/extension_function_dispatcher.cc
@@ -205,12 +205,12 @@ class ExtensionFunctionDispatcher::UIThreadResponseCallbackWrapper
WindowController*
ExtensionFunctionDispatcher::Delegate::GetExtensionWindowController() const {
- return NULL;
+ return nullptr;
}
content::WebContents*
ExtensionFunctionDispatcher::Delegate::GetAssociatedWebContents() const {
- return NULL;
+ return nullptr;
}
content::WebContents*
@@ -301,10 +301,8 @@ void ExtensionFunctionDispatcher::DispatchOnIOThread(
}
ExtensionFunctionDispatcher::ExtensionFunctionDispatcher(
- content::BrowserContext* browser_context,
- Delegate* delegate)
- : browser_context_(browser_context),
- delegate_(delegate) {
+ content::BrowserContext* browser_context)
+ : browser_context_(browser_context) {
}
ExtensionFunctionDispatcher::~ExtensionFunctionDispatcher() {
@@ -440,6 +438,22 @@ void ExtensionFunctionDispatcher::OnExtensionFunctionCompleted(
}
}
+WindowController*
+ExtensionFunctionDispatcher::GetExtensionWindowController() const {
+ return delegate_ ? delegate_->GetExtensionWindowController() : nullptr;
+}
+
+content::WebContents*
+ExtensionFunctionDispatcher::GetAssociatedWebContents() const {
+ return delegate_ ? delegate_->GetAssociatedWebContents() : nullptr;
+}
+
+content::WebContents*
+ExtensionFunctionDispatcher::GetVisibleWebContents() const {
+ return delegate_ ? delegate_->GetVisibleWebContents() :
+ GetAssociatedWebContents();
+}
+
// static
bool ExtensionFunctionDispatcher::CheckPermissions(
ExtensionFunction* function,