diff options
author | joi@chromium.org <joi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-08 14:02:58 +0000 |
---|---|---|
committer | joi@chromium.org <joi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-08 14:02:58 +0000 |
commit | 4cfc1d9243eaf01a3b736fa13f55b7400a891fb4 (patch) | |
tree | 8f8da34f968fdf547aefc55b3f5d9e210b1a03b3 /chrome/browser/external_tab_container.cc | |
parent | bb76183f666753f186e5234ddea409971753c784 (diff) | |
download | chromium_src-4cfc1d9243eaf01a3b736fa13f55b7400a891fb4.zip chromium_src-4cfc1d9243eaf01a3b736fa13f55b7400a891fb4.tar.gz chromium_src-4cfc1d9243eaf01a3b736fa13f55b7400a891fb4.tar.bz2 |
Modifying extension automation so that it is done through a particular
tab for all extension views. Previously, API routing to the
automation client would only work for extension views that were
contained in the particular ExternalTab instance being automated. This
meant you couldn't test API calls from e.g. background pages.
Also using async functions instead of the previous RVH-based hack.
Updating one of the UI tests to make the API calls from a background
page, to provide an end-to-end test of the new routing.
This makes AutomationProvider::SetEnableAutomationExtension
Windows-only, but it effectively always was since it was already
dependent on ExternalTabContainer (indirectly, to provide a non-empty
implementation of TabContentsDelegate::ForwardMessageToExternalHost).
BUG=none
TEST=ui_tests.exe, chrome_frame_tests.exe, chrome_frame_unittests.exe
Review URL: http://codereview.chromium.org/366025
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@31403 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/external_tab_container.cc')
-rw-r--r-- | chrome/browser/external_tab_container.cc | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/chrome/browser/external_tab_container.cc b/chrome/browser/external_tab_container.cc index d200891..4440294 100644 --- a/chrome/browser/external_tab_container.cc +++ b/chrome/browser/external_tab_container.cc @@ -11,6 +11,7 @@ #include "base/logging.h" #include "base/win_util.h" #include "chrome/browser/automation/automation_provider.h" +#include "chrome/browser/automation/automation_extension_function.h" #include "chrome/browser/browser_window.h" #include "chrome/browser/debugger/devtools_manager.h" #include "chrome/browser/load_notification_details.h" @@ -43,7 +44,8 @@ ExternalTabContainer::ExternalTabContainer( automation_resource_message_filter_(filter), load_requests_via_automation_(false), handle_top_level_requests_(false), - external_method_factory_(this) { + external_method_factory_(this), + enabled_extension_automation_(false) { } ExternalTabContainer::~ExternalTabContainer() { @@ -161,6 +163,10 @@ bool ExternalTabContainer::Init(Profile* profile, } void ExternalTabContainer::Uninitialize() { + if (enabled_extension_automation_) { + AutomationExtensionFunction::Disable(); + } + registrar_.RemoveAll(); if (tab_contents_) { RenderViewHost* rvh = tab_contents_->render_view_host(); @@ -659,6 +665,22 @@ ExternalTabContainer* ExternalTabContainer::RemovePendingTab(intptr_t cookie) { return NULL; } +void ExternalTabContainer::SetEnableExtensionAutomation( + const std::vector<std::string>& functions_enabled) { + if (functions_enabled.size() > 0) { + if (!tab_contents_) { + NOTREACHED() << "Being invoked via tab so should have TabContents"; + return; + } + + AutomationExtensionFunction::Enable(tab_contents_, functions_enabled); + enabled_extension_automation_ = true; + } else { + AutomationExtensionFunction::Disable(); + enabled_extension_automation_ = false; + } +} + void ExternalTabContainer::Navigate(const GURL& url, const GURL& referrer) { if (!tab_contents_) { NOTREACHED(); |