Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(35)

Unified Diff: chrome/browser/automation/automation_provider.cc

Issue 7548024: Refactor: Make PyAuto InstallExtension() take a string. Delete dead code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Comment per nirnimesh. Created 9 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/automation/automation_provider.cc
diff --git a/chrome/browser/automation/automation_provider.cc b/chrome/browser/automation/automation_provider.cc
index 1dfa293b3a6a9784e4a621a1d8f97cef8154933e..5a77715b4c2a0192839e87e7123e1de505da5af0 100644
--- a/chrome/browser/automation/automation_provider.cc
+++ b/chrome/browser/automation/automation_provider.cc
@@ -325,13 +325,10 @@ bool AutomationProvider::OnMessageReceived(const IPC::Message& message) {
IPC_MESSAGE_HANDLER(AutomationMsg_ReloadAsync, ReloadAsync)
IPC_MESSAGE_HANDLER(AutomationMsg_StopAsync, StopAsync)
IPC_MESSAGE_HANDLER(AutomationMsg_SetPageFontSize, OnSetPageFontSize)
- IPC_MESSAGE_HANDLER_DELAY_REPLY(AutomationMsg_InstallExtension,
- InstallExtension)
IPC_MESSAGE_HANDLER_DELAY_REPLY(AutomationMsg_WaitForExtensionTestResult,
WaitForExtensionTestResult)
- IPC_MESSAGE_HANDLER_DELAY_REPLY(
- AutomationMsg_InstallExtensionAndGetHandle,
- InstallExtensionAndGetHandle)
+ IPC_MESSAGE_HANDLER_DELAY_REPLY(AutomationMsg_InstallExtension,
+ InstallExtension)
IPC_MESSAGE_HANDLER(AutomationMsg_UninstallExtension,
UninstallExtension)
IPC_MESSAGE_HANDLER_DELAY_REPLY(AutomationMsg_EnableExtension,
@@ -763,26 +760,6 @@ RenderViewHost* AutomationProvider::GetViewForTab(int tab_handle) {
return NULL;
}
-void AutomationProvider::InstallExtension(const FilePath& crx_path,
- IPC::Message* reply_message) {
- ExtensionService* service = profile_->GetExtensionService();
- if (service) {
- // The observer will delete itself when done.
- new ExtensionInstallNotificationObserver(this,
- AutomationMsg_InstallExtension::ID,
- reply_message);
-
- // Pass NULL for a silent install with no UI.
- scoped_refptr<CrxInstaller> installer(service->MakeCrxInstaller(NULL));
- installer->set_install_cause(extension_misc::INSTALL_CAUSE_AUTOMATION);
- installer->InstallCrx(crx_path);
- } else {
- AutomationMsg_InstallExtension::WriteReplyParams(
- reply_message, AUTOMATION_MSG_EXTENSION_INSTALL_FAILED);
- Send(reply_message);
- }
-}
-
void AutomationProvider::WaitForExtensionTestResult(
IPC::Message* reply_message) {
DCHECK(!reply_message_);
@@ -792,8 +769,10 @@ void AutomationProvider::WaitForExtensionTestResult(
extension_test_result_observer_->MaybeSendResult();
}
-void AutomationProvider::InstallExtensionAndGetHandle(
- const FilePath& crx_path, bool with_ui, IPC::Message* reply_message) {
+void AutomationProvider::InstallExtension(
+ const std::string& extension_path, bool with_ui,
+ IPC::Message* reply_message) {
+ const FilePath extension_file_path = FilePath(extension_path);
kkania 2011/08/03 16:01:56 this wont compile on windows
ExtensionService* service = profile_->GetExtensionService();
ExtensionProcessManager* manager = profile_->GetExtensionProcessManager();
if (service && manager) {
@@ -801,23 +780,22 @@ void AutomationProvider::InstallExtensionAndGetHandle(
new ExtensionReadyNotificationObserver(
manager,
this,
- AutomationMsg_InstallExtensionAndGetHandle::ID,
+ AutomationMsg_InstallExtension::ID,
reply_message);
- if (crx_path.MatchesExtension(FILE_PATH_LITERAL(".crx"))) {
+ if (extension_file_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);
+ installer->InstallCrx(extension_file_path);
} else {
- service->LoadExtension(crx_path, with_ui);
+ service->LoadExtension(extension_file_path, with_ui);
}
} else {
- AutomationMsg_InstallExtensionAndGetHandle::WriteReplyParams(
- reply_message, 0);
+ AutomationMsg_InstallExtension::WriteReplyParams(reply_message, 0);
Send(reply_message);
}
}

Powered by Google App Engine
This is Rietveld 408576698