summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authorjoi@chromium.org <joi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-16 02:18:43 +0000
committerjoi@chromium.org <joi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-16 02:18:43 +0000
commita1e62d1553f81d66fa5fdc6a4e54a5531d378bbc (patch)
treeb14f0d7693c0843222d765da77d9c1ccc3e2de46 /chrome
parentd5b42ac0413ca4dbac88bce952044808ba40b1a9 (diff)
downloadchromium_src-a1e62d1553f81d66fa5fdc6a4e54a5531d378bbc.zip
chromium_src-a1e62d1553f81d66fa5fdc6a4e54a5531d378bbc.tar.gz
chromium_src-a1e62d1553f81d66fa5fdc6a4e54a5531d378bbc.tar.bz2
Adds an automation message to retrieve the list of enabled extensions, and CF bindings for it.
TEST=unit test to follow BUG=none Review URL: http://codereview.chromium.org/901002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@41667 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/automation/automation_provider.cc17
-rw-r--r--chrome/browser/automation/automation_provider.h2
-rw-r--r--chrome/browser/automation/chrome_frame_automation_provider.cc1
-rw-r--r--chrome/test/automation/automation_messages_internal.h4
-rw-r--r--chrome/test/automation/automation_proxy.cc6
-rw-r--r--chrome/test/automation/automation_proxy.h4
6 files changed, 34 insertions, 0 deletions
diff --git a/chrome/browser/automation/automation_provider.cc b/chrome/browser/automation/automation_provider.cc
index 998b252..8ae593b 100644
--- a/chrome/browser/automation/automation_provider.cc
+++ b/chrome/browser/automation/automation_provider.cc
@@ -484,6 +484,8 @@ void AutomationProvider::OnMessageReceived(const IPC::Message& message) {
InstallExtension)
IPC_MESSAGE_HANDLER_DELAY_REPLY(AutomationMsg_LoadExpandedExtension,
LoadExpandedExtension)
+ IPC_MESSAGE_HANDLER(AutomationMsg_GetEnabledExtensions,
+ GetEnabledExtensions)
IPC_MESSAGE_HANDLER(AutomationMsg_ShutdownSessionService,
ShutdownSessionService)
IPC_MESSAGE_HANDLER(AutomationMsg_SaveAsAsync, SaveAsAsync)
@@ -2482,6 +2484,21 @@ void AutomationProvider::LoadExpandedExtension(
}
}
+void AutomationProvider::GetEnabledExtensions(
+ std::vector<FilePath>* result) {
+ ExtensionsService* service = profile_->GetExtensionsService();
+ DCHECK(service);
+ if (service->extensions_enabled()) {
+ const ExtensionList* extensions = service->extensions();
+ DCHECK(extensions);
+ for (size_t i = 0; i < extensions->size(); ++i) {
+ Extension* extension = (*extensions)[i];
+ DCHECK(extension);
+ result->push_back(extension->path());
+ }
+ }
+}
+
void AutomationProvider::SaveAsAsync(int tab_handle) {
NavigationController* tab = NULL;
TabContents* tab_contents = GetTabContentsForHandle(tab_handle, &tab);
diff --git a/chrome/browser/automation/automation_provider.h b/chrome/browser/automation/automation_provider.h
index 88bb865..e5b36bf 100644
--- a/chrome/browser/automation/automation_provider.h
+++ b/chrome/browser/automation/automation_provider.h
@@ -363,6 +363,8 @@ class AutomationProvider : public base::RefCounted<AutomationProvider>,
void LoadExpandedExtension(const FilePath& extension_dir,
IPC::Message* reply_message);
+ void GetEnabledExtensions(std::vector<FilePath>* result);
+
void NavigateInExternalTab(
int handle, const GURL& url, const GURL& referrer,
AutomationMsg_NavigationResponseValues* status);
diff --git a/chrome/browser/automation/chrome_frame_automation_provider.cc b/chrome/browser/automation/chrome_frame_automation_provider.cc
index ab87b92..c8bada3 100644
--- a/chrome/browser/automation/chrome_frame_automation_provider.cc
+++ b/chrome/browser/automation/chrome_frame_automation_provider.cc
@@ -45,6 +45,7 @@ bool ChromeFrameAutomationProvider::IsValidMessage(uint32 type) {
case AutomationMsg_Find::ID:
case AutomationMsg_InstallExtension::ID:
case AutomationMsg_LoadExpandedExtension::ID:
+ case AutomationMsg_GetEnabledExtensions::ID:
case AutomationMsg_SetEnableExtensionAutomation::ID:
case AutomationMsg_SetInitialFocus::ID:
case AutomationMsg_SetPageFontSize::ID:
diff --git a/chrome/test/automation/automation_messages_internal.h b/chrome/test/automation/automation_messages_internal.h
index 8dcf03a..495905e 100644
--- a/chrome/test/automation/automation_messages_internal.h
+++ b/chrome/test/automation/automation_messages_internal.h
@@ -1161,6 +1161,10 @@ IPC_BEGIN_MESSAGES(Automation)
FilePath /* root directory of extension */,
AutomationMsg_ExtensionResponseValues)
+ // Retrieves a list of the root directories of all enabled extensions.
+ IPC_SYNC_MESSAGE_ROUTED0_1(AutomationMsg_GetEnabledExtensions,
+ std::vector<FilePath>)
+
// This message requests the type of the window with the given handle. The
// return value contains the type (Browser::Type), or -1 if the request
// failed.
diff --git a/chrome/test/automation/automation_proxy.cc b/chrome/test/automation/automation_proxy.cc
index d03bc4d..d383443 100644
--- a/chrome/test/automation/automation_proxy.cc
+++ b/chrome/test/automation/automation_proxy.cc
@@ -237,6 +237,12 @@ bool AutomationProxy::InstallExtension(const FilePath& crx_file) {
return response == AUTOMATION_MSG_EXTENSION_INSTALL_SUCCEEDED;
}
+bool AutomationProxy::GetEnabledExtensions(
+ std::vector<FilePath>* extension_directories) {
+ return Send(new AutomationMsg_GetEnabledExtensions(
+ 0, extension_directories));
+}
+
bool AutomationProxy::GetBrowserWindowCount(int* num_windows) {
if (!num_windows) {
NOTREACHED();
diff --git a/chrome/test/automation/automation_proxy.h b/chrome/test/automation/automation_proxy.h
index c1f1e46..281de66 100644
--- a/chrome/test/automation/automation_proxy.h
+++ b/chrome/test/automation/automation_proxy.h
@@ -186,6 +186,10 @@ class AutomationProxy : public IPC::Channel::Listener,
// Note: Overinstalls will fail.
bool InstallExtension(const FilePath& crx_file);
+ // Gets a list of all enabled extensions' base directories.
+ // Returns true on success.
+ bool GetEnabledExtensions(std::vector<FilePath>* extension_directories);
+
#if defined(OS_CHROMEOS)
// Logs in through the Chrome OS login wizard with given |username|
// and |password|. Returns true on success.