diff options
author | rdevlin.cronin <rdevlin.cronin@chromium.org> | 2015-06-10 16:32:41 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-06-10 23:33:30 +0000 |
commit | cb2ec659ab8741962f3391970a5fff512ebb6509 (patch) | |
tree | 84c87ca2540a0f0e7dc66bb0b82a5abc79ad012b /extensions/browser/api_test_utils.cc | |
parent | 1bcab9592f6213b9f44379bb66ce7b613b371e0b (diff) | |
download | chromium_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/api_test_utils.cc')
-rw-r--r-- | extensions/browser/api_test_utils.cc | 20 |
1 files changed, 3 insertions, 17 deletions
diff --git a/extensions/browser/api_test_utils.cc b/extensions/browser/api_test_utils.cc index 4affb86..587f8e2 100644 --- a/extensions/browser/api_test_utils.cc +++ b/extensions/browser/api_test_utils.cc @@ -19,17 +19,6 @@ using extensions::ExtensionFunctionDispatcher; namespace { -class TestFunctionDispatcherDelegate - : public ExtensionFunctionDispatcher::Delegate { - public: - TestFunctionDispatcherDelegate() {} - ~TestFunctionDispatcherDelegate() override {} - - // NULL implementation. - private: - DISALLOW_COPY_AND_ASSIGN(TestFunctionDispatcherDelegate); -}; - scoped_ptr<base::Value> ParseJSON(const std::string& data) { return base::JSONReader::Read(data); } @@ -185,9 +174,8 @@ base::Value* RunFunctionAndReturnSingleResult( const std::string& args, content::BrowserContext* context, RunFunctionFlags flags) { - TestFunctionDispatcherDelegate delegate; scoped_ptr<ExtensionFunctionDispatcher> dispatcher( - new ExtensionFunctionDispatcher(context, &delegate)); + new ExtensionFunctionDispatcher(context)); return RunFunctionWithDelegateAndReturnSingleResult( function, args, context, dispatcher.Pass(), flags); @@ -203,9 +191,8 @@ std::string RunFunctionAndReturnError(UIThreadExtensionFunction* function, const std::string& args, content::BrowserContext* context, RunFunctionFlags flags) { - TestFunctionDispatcherDelegate delegate; scoped_ptr<ExtensionFunctionDispatcher> dispatcher( - new ExtensionFunctionDispatcher(context, &delegate)); + new ExtensionFunctionDispatcher(context)); scoped_refptr<ExtensionFunction> function_owner(function); // Without a callback the function will not generate a result. function->set_has_callback(true); @@ -217,9 +204,8 @@ std::string RunFunctionAndReturnError(UIThreadExtensionFunction* function, bool RunFunction(UIThreadExtensionFunction* function, const std::string& args, content::BrowserContext* context) { - TestFunctionDispatcherDelegate delegate; scoped_ptr<ExtensionFunctionDispatcher> dispatcher( - new ExtensionFunctionDispatcher(context, &delegate)); + new ExtensionFunctionDispatcher(context)); return RunFunction(function, args, context, dispatcher.Pass(), NONE); } |