diff options
author | dtu@chromium.org <dtu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-08-02 22:57:40 +0000 |
---|---|---|
committer | dtu@chromium.org <dtu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-08-02 22:57:40 +0000 |
commit | 71eb1e6d22b1216c40a09d50c11412596b60fe2e (patch) | |
tree | 7c5ffcd22fa4398dcdba37a92c701d4f43b0565a | |
parent | 83391cd049a17c7597e655422ac60008b928b2d8 (diff) | |
download | chromium_src-71eb1e6d22b1216c40a09d50c11412596b60fe2e.zip chromium_src-71eb1e6d22b1216c40a09d50c11412596b60fe2e.tar.gz chromium_src-71eb1e6d22b1216c40a09d50c11412596b60fe2e.tar.bz2 |
Allow PyAuto to install unpacked extensions.
BUG=None.
TEST=Write a PyAuto test that installs an unpacked extension. The test should not hang or error.
Review URL: http://codereview.chromium.org/7549002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@95178 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/automation/automation_provider.cc | 18 | ||||
-rw-r--r-- | chrome/browser/extensions/extension_service.cc | 7 | ||||
-rw-r--r-- | chrome/browser/extensions/extension_service.h | 4 |
3 files changed, 21 insertions, 8 deletions
diff --git a/chrome/browser/automation/automation_provider.cc b/chrome/browser/automation/automation_provider.cc index 1e25d61..1dfa293 100644 --- a/chrome/browser/automation/automation_provider.cc +++ b/chrome/browser/automation/automation_provider.cc @@ -804,13 +804,17 @@ void AutomationProvider::InstallExtensionAndGetHandle( AutomationMsg_InstallExtensionAndGetHandle::ID, reply_message); - ExtensionInstallUI* client = - (with_ui ? new ExtensionInstallUI(profile_) : NULL); - scoped_refptr<CrxInstaller> installer(service->MakeCrxInstaller(client)); - if (!with_ui) - installer->set_allow_silent_install(true); - installer->set_install_cause(extension_misc::INSTALL_CAUSE_AUTOMATION); - installer->InstallCrx(crx_path); + if (crx_path.MatchesExtension(FILE_PATH_LITERAL(".crx"))) { + ExtensionInstallUI* client = + (with_ui ? new ExtensionInstallUI(profile_) : NULL); + scoped_refptr<CrxInstaller> installer(service->MakeCrxInstaller(client)); + if (!with_ui) + installer->set_allow_silent_install(true); + installer->set_install_cause(extension_misc::INSTALL_CAUSE_AUTOMATION); + installer->InstallCrx(crx_path); + } else { + service->LoadExtension(crx_path, with_ui); + } } else { AutomationMsg_InstallExtensionAndGetHandle::WriteReplyParams( reply_message, 0); diff --git a/chrome/browser/extensions/extension_service.cc b/chrome/browser/extensions/extension_service.cc index 7d49151..5c05c6c 100644 --- a/chrome/browser/extensions/extension_service.cc +++ b/chrome/browser/extensions/extension_service.cc @@ -1012,10 +1012,15 @@ void ExtensionService::UpdateActivePermissions( } void ExtensionService::LoadExtension(const FilePath& extension_path) { + LoadExtension(extension_path, true); +} + +void ExtensionService::LoadExtension(const FilePath& extension_path, + bool prompt_for_plugins) { BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, NewRunnableMethod(backend_.get(), &ExtensionServiceBackend::LoadSingleExtension, - extension_path, true)); + extension_path, prompt_for_plugins)); } void ExtensionService::LoadExtensionFromCommandLine( diff --git a/chrome/browser/extensions/extension_service.h b/chrome/browser/extensions/extension_service.h index 901726f..5ad3b23 100644 --- a/chrome/browser/extensions/extension_service.h +++ b/chrome/browser/extensions/extension_service.h @@ -328,6 +328,10 @@ class ExtensionService // Loads the extension from the directory |extension_path|. void LoadExtension(const FilePath& extension_path); + // Loads the extension from the directory |extension_path|. + // This version of this method is intended for testing only. + void LoadExtension(const FilePath& extension_path, bool prompt_for_plugins); + // Same as above, but for use with command line switch --load-extension=path. void LoadExtensionFromCommandLine(const FilePath& extension_path); |