diff options
author | tfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-09-14 02:38:02 +0000 |
---|---|---|
committer | tfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-09-14 02:38:02 +0000 |
commit | ba9c96c6105f11088857ad234221b949f86e05b9 (patch) | |
tree | dfc3307c6470bfb5fae423b0d66e16edeebc5e79 | |
parent | d00c162781047db67af6ea481b85bcd3c69d24a3 (diff) | |
download | chromium_src-ba9c96c6105f11088857ad234221b949f86e05b9.zip chromium_src-ba9c96c6105f11088857ad234221b949f86e05b9.tar.gz chromium_src-ba9c96c6105f11088857ad234221b949f86e05b9.tar.bz2 |
Remove create_app_shortcut param from ExtensionInstallUI::Delegate::InstallUIProceed.
Reason: We don't support shortcut creation from this dialog anymore.
(Note: this was a TODO for Aaron).
BUG=None
TEST=trybots
Review URL: http://codereview.chromium.org/3305030
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@59323 0039d316-1c4b-4281-b951-d872f2087c98
19 files changed, 22 insertions, 69 deletions
diff --git a/chrome/browser/cocoa/extension_install_prompt.mm b/chrome/browser/cocoa/extension_install_prompt.mm index 3519319..cb33136 100644 --- a/chrome/browser/cocoa/extension_install_prompt.mm +++ b/chrome/browser/cocoa/extension_install_prompt.mm @@ -41,7 +41,7 @@ void ExtensionInstallUI::ShowExtensionInstallUIPromptImpl( [alert setIcon:gfx::SkBitmapToNSImage(*icon)]; if ([alert runModal] == NSAlertFirstButtonReturn) { - delegate->InstallUIProceed(false); + delegate->InstallUIProceed(); } else { delegate->InstallUIAbort(); } diff --git a/chrome/browser/cocoa/extensions/extension_action_context_menu.mm b/chrome/browser/cocoa/extensions/extension_action_context_menu.mm index 5e20237..10ea079 100644 --- a/chrome/browser/cocoa/extensions/extension_action_context_menu.mm +++ b/chrome/browser/cocoa/extensions/extension_action_context_menu.mm @@ -45,8 +45,7 @@ class AsyncUninstaller : public ExtensionInstallUI::Delegate { ~AsyncUninstaller() {} // Overridden by ExtensionInstallUI::Delegate. - virtual void InstallUIProceed(bool create_shortcut) { - DCHECK(!create_shortcut); + virtual void InstallUIProceed() { profile_->GetExtensionsService()-> UninstallExtension(extension_->id(), false); } diff --git a/chrome/browser/cocoa/extensions/extension_install_prompt_controller.mm b/chrome/browser/cocoa/extensions/extension_install_prompt_controller.mm index 5c738a1..9ba758b 100644 --- a/chrome/browser/cocoa/extensions/extension_install_prompt_controller.mm +++ b/chrome/browser/cocoa/extensions/extension_install_prompt_controller.mm @@ -117,7 +117,7 @@ void OffsetControlVertically(NSControl* control, CGFloat amount) { } - (IBAction)ok:(id)sender { - delegate_->InstallUIProceed(false); // Don't create shortcut. + delegate_->InstallUIProceed(); [NSApp endSheet:[self window]]; } diff --git a/chrome/browser/cocoa/extensions/extension_install_prompt_controller_unittest.mm b/chrome/browser/cocoa/extensions/extension_install_prompt_controller_unittest.mm index 3ad12db..f596851 100644 --- a/chrome/browser/cocoa/extensions/extension_install_prompt_controller_unittest.mm +++ b/chrome/browser/cocoa/extensions/extension_install_prompt_controller_unittest.mm @@ -82,13 +82,11 @@ class MockExtensionInstallUIDelegate : public ExtensionInstallUI::Delegate { public: MockExtensionInstallUIDelegate() : proceed_count_(0), - abort_count_(0), - last_proceed_was_create_app_shortcut_(0) {} + abort_count_(0) {} // ExtensionInstallUI::Delegate overrides. - virtual void InstallUIProceed(bool create_app_shortcut) { + virtual void InstallUIProceed() { proceed_count_++; - last_proceed_was_create_app_shortcut_ = create_app_shortcut; } virtual void InstallUIAbort() { @@ -97,17 +95,12 @@ class MockExtensionInstallUIDelegate : public ExtensionInstallUI::Delegate { int proceed_count() { return proceed_count_; } int abort_count() { return abort_count_; } - bool last_proceed_was_create_app_shortcut() { - return last_proceed_was_create_app_shortcut_; - } protected: int proceed_count_; int abort_count_; - bool last_proceed_was_create_app_shortcut_; }; - // Test that we can load the two kinds of prompts correctly, that the outlets // are hooked up, and that the dialog calls cancel when cancel is pressed. TEST_F(ExtensionInstallPromptControllerTest, BasicsNormalCancel) { @@ -163,7 +156,6 @@ TEST_F(ExtensionInstallPromptControllerTest, BasicsNormalCancel) { [controller cancel:nil]; EXPECT_EQ(1, delegate->abort_count()); EXPECT_EQ(0, delegate->proceed_count()); - EXPECT_FALSE(delegate->last_proceed_was_create_app_shortcut()); } @@ -188,7 +180,6 @@ TEST_F(ExtensionInstallPromptControllerTest, BasicsNormalOK) { EXPECT_EQ(0, delegate->abort_count()); EXPECT_EQ(1, delegate->proceed_count()); - EXPECT_FALSE(delegate->last_proceed_was_create_app_shortcut()); } // Test that controls get repositioned when there are two warnings vs one diff --git a/chrome/browser/dom_ui/app_launcher_handler.cc b/chrome/browser/dom_ui/app_launcher_handler.cc index 7049d05..3aa5e61 100644 --- a/chrome/browser/dom_ui/app_launcher_handler.cc +++ b/chrome/browser/dom_ui/app_launcher_handler.cc @@ -216,10 +216,7 @@ ExtensionInstallUI* AppLauncherHandler::GetExtensionInstallUI() { return install_ui_.get(); } -void AppLauncherHandler::InstallUIProceed(bool create_app_shortcut) { - // We only ever use ExtensionInstallUI for uninstalling, which should never - // result in it telling us to create a shortcut. - DCHECK(!create_app_shortcut); +void AppLauncherHandler::InstallUIProceed() { DCHECK(!extension_id_prompting_.empty()); // The extension can be uninstalled in another window while the UI was diff --git a/chrome/browser/dom_ui/app_launcher_handler.h b/chrome/browser/dom_ui/app_launcher_handler.h index 6a2954a..ac29dfb 100644 --- a/chrome/browser/dom_ui/app_launcher_handler.h +++ b/chrome/browser/dom_ui/app_launcher_handler.h @@ -52,7 +52,7 @@ class AppLauncherHandler private: // ExtensionInstallUI::Delegate implementation, used for receiving // notification about uninstall confirmation dialog selections. - virtual void InstallUIProceed(bool create_app_shortcut); + virtual void InstallUIProceed(); virtual void InstallUIAbort(); // Returns the ExtensionInstallUI object for this class, creating it if diff --git a/chrome/browser/extensions/crx_installer.cc b/chrome/browser/extensions/crx_installer.cc index 9161059..ea874ad 100644 --- a/chrome/browser/extensions/crx_installer.cc +++ b/chrome/browser/extensions/crx_installer.cc @@ -78,7 +78,6 @@ CrxInstaller::CrxInstaller(const FilePath& install_directory, delete_source_(false), allow_privilege_increase_(false), limit_web_extent_to_download_host_(false), - create_app_shortcut_(false), frontend_(frontend), client_(client), apps_require_extension_mime_type_(false), @@ -267,12 +266,7 @@ void CrxInstaller::ConfirmInstall() { return; } -void CrxInstaller::InstallUIProceed(bool create_app_shortcut) { - if (create_app_shortcut) { - DCHECK(extension_->GetFullLaunchURL().is_valid()); - create_app_shortcut_ = true; - } - +void CrxInstaller::InstallUIProceed() { ChromeThread::PostTask( ChromeThread::FILE, FROM_HERE, NewRunnableMethod(this, &CrxInstaller::CompleteInstall)); @@ -316,25 +310,6 @@ void CrxInstaller::CompleteInstall() { return; } - if (create_app_shortcut_) { - SkBitmap icon = install_icon_.get() ? *install_icon_ : - *ResourceBundle::GetSharedInstance().GetBitmapNamed( - IDR_EXTENSION_DEFAULT_ICON); - - ShellIntegration::ShortcutInfo shortcut_info; - shortcut_info.url = extension_->GetFullLaunchURL(); - shortcut_info.extension_id = UTF8ToUTF16(extension_->id()); - shortcut_info.title = UTF8ToUTF16(extension_->name()); - shortcut_info.description = UTF8ToUTF16(extension_->description()); - shortcut_info.favicon = icon; - shortcut_info.create_on_desktop = true; - - // TODO(aa): Seems nasty to be reusing the old webapps code this way. What - // baggage am I inheriting? - web_app::CreateShortcut(frontend_->profile()->GetPath(), shortcut_info, - NULL); - } - // This is lame, but we must reload the extension because absolute paths // inside the content scripts are established inside InitFromValue() and we // just moved the extension. diff --git a/chrome/browser/extensions/crx_installer.h b/chrome/browser/extensions/crx_installer.h index 7613d93..ca3e90f 100644 --- a/chrome/browser/extensions/crx_installer.h +++ b/chrome/browser/extensions/crx_installer.h @@ -72,8 +72,8 @@ class CrxInstaller void InstallUserScript(const FilePath& source_file, const GURL& original_url); - // ExtensionInstallUI::Delegate - virtual void InstallUIProceed(bool create_app_shortcut); + // Overridden from ExtensionInstallUI::Delegate: + virtual void InstallUIProceed(); virtual void InstallUIAbort(); const GURL& original_url() const { return original_url_; } diff --git a/chrome/browser/extensions/extension_context_menu_model.cc b/chrome/browser/extensions/extension_context_menu_model.cc index 97e978b..16ef321 100644 --- a/chrome/browser/extensions/extension_context_menu_model.cc +++ b/chrome/browser/extensions/extension_context_menu_model.cc @@ -128,9 +128,7 @@ void ExtensionContextMenuModel::ExecuteCommand(int command_id) { } } -void ExtensionContextMenuModel::InstallUIProceed(bool create_app) { - DCHECK(!create_app); - +void ExtensionContextMenuModel::InstallUIProceed() { std::string id = extension_->id(); profile_->GetExtensionsService()->UninstallExtension(id, false); diff --git a/chrome/browser/extensions/extension_context_menu_model.h b/chrome/browser/extensions/extension_context_menu_model.h index bec8d37..35af19d 100644 --- a/chrome/browser/extensions/extension_context_menu_model.h +++ b/chrome/browser/extensions/extension_context_menu_model.h @@ -50,7 +50,7 @@ class ExtensionContextMenuModel virtual void ExecuteCommand(int command_id); // ExtensionInstallUI::Delegate overrides. - virtual void InstallUIProceed(bool create_app); + virtual void InstallUIProceed(); virtual void InstallUIAbort(); private: diff --git a/chrome/browser/extensions/extension_disabled_infobar_delegate.cc b/chrome/browser/extensions/extension_disabled_infobar_delegate.cc index e8ed833..884a17a 100644 --- a/chrome/browser/extensions/extension_disabled_infobar_delegate.cc +++ b/chrome/browser/extensions/extension_disabled_infobar_delegate.cc @@ -34,8 +34,8 @@ class ExtensionDisabledDialogDelegate install_ui_->ConfirmInstall(this, extension_); } - // ExtensionInstallUI::Delegate - virtual void InstallUIProceed(bool create_app_shortcut) { + // Overridden from ExtensionInstallUI::Delegate: + virtual void InstallUIProceed() { ExtensionPrefs* prefs = service_->extension_prefs(); prefs->SetDidExtensionEscalatePermissions(extension_, false); service_->EnableExtension(extension_->id()); diff --git a/chrome/browser/extensions/extension_install_ui.cc b/chrome/browser/extensions/extension_install_ui.cc index 5e39366..80c7279 100644 --- a/chrome/browser/extensions/extension_install_ui.cc +++ b/chrome/browser/extensions/extension_install_ui.cc @@ -179,7 +179,7 @@ void ExtensionInstallUI::ConfirmInstall(Delegate* delegate, DCHECK(!previous_use_system_theme_); #endif - delegate->InstallUIProceed(false); + delegate->InstallUIProceed(); return; } diff --git a/chrome/browser/extensions/extension_install_ui.h b/chrome/browser/extensions/extension_install_ui.h index ae07363..18481af 100644 --- a/chrome/browser/extensions/extension_install_ui.h +++ b/chrome/browser/extensions/extension_install_ui.h @@ -39,7 +39,7 @@ class ExtensionInstallUI : public ImageLoadingTracker::Observer { public: // We call this method after ConfirmInstall()/ConfirmUninstall() to signal // that the installation/uninstallation should continue. - virtual void InstallUIProceed(bool create_app_shortcut) = 0; + virtual void InstallUIProceed() = 0; // We call this method after ConfirmInstall()/ConfirmUninstall() to signal // that the installation/uninstallation should stop. diff --git a/chrome/browser/extensions/extensions_ui.cc b/chrome/browser/extensions/extensions_ui.cc index 0538488..be64be8 100644 --- a/chrome/browser/extensions/extensions_ui.cc +++ b/chrome/browser/extensions/extensions_ui.cc @@ -520,11 +520,7 @@ void ExtensionsDOMHandler::HandleUninstallMessage(const ListValue* args) { GetExtensionInstallUI()->ConfirmUninstall(this, extension); } -void ExtensionsDOMHandler::InstallUIProceed(bool create_app_shortcut) { - // We only ever use ExtensionInstallUI for uninstalling, which should never - // result in it telling us to create a shortcut. - DCHECK(!create_app_shortcut); - +void ExtensionsDOMHandler::InstallUIProceed() { DCHECK(!extension_id_prompting_.empty()); // The extension can be uninstalled in another window while the UI was diff --git a/chrome/browser/extensions/extensions_ui.h b/chrome/browser/extensions/extensions_ui.h index 0d961a1..5660eaa 100644 --- a/chrome/browser/extensions/extensions_ui.h +++ b/chrome/browser/extensions/extensions_ui.h @@ -131,7 +131,7 @@ class ExtensionsDOMHandler // ExtensionInstallUI::Delegate implementation, used for receiving // notification about uninstall confirmation dialog selections. - virtual void InstallUIProceed(bool create_app_shortcut); + virtual void InstallUIProceed(); virtual void InstallUIAbort(); private: diff --git a/chrome/browser/gtk/extension_install_prompt2_gtk.cc b/chrome/browser/gtk/extension_install_prompt2_gtk.cc index cae4e2d..6d7008c 100644 --- a/chrome/browser/gtk/extension_install_prompt2_gtk.cc +++ b/chrome/browser/gtk/extension_install_prompt2_gtk.cc @@ -45,7 +45,7 @@ GtkWidget* MakeMarkupLabel(const char* format, const std::string& str) { void OnDialogResponse(GtkDialog* dialog, int response_id, ExtensionInstallUI::Delegate* delegate) { if (response_id == GTK_RESPONSE_ACCEPT) { - delegate->InstallUIProceed(false); + delegate->InstallUIProceed(); } else { delegate->InstallUIAbort(); } diff --git a/chrome/browser/gtk/extension_install_prompt_gtk.cc b/chrome/browser/gtk/extension_install_prompt_gtk.cc index 45efdc7..bcb7c0a 100644 --- a/chrome/browser/gtk/extension_install_prompt_gtk.cc +++ b/chrome/browser/gtk/extension_install_prompt_gtk.cc @@ -29,7 +29,7 @@ const int kPanelHorizMargin = 13; void OnDialogResponse(GtkDialog* dialog, int response_id, ExtensionInstallUI::Delegate* delegate) { if (response_id == GTK_RESPONSE_ACCEPT) { - delegate->InstallUIProceed(false); + delegate->InstallUIProceed(); } else { delegate->InstallUIAbort(); } diff --git a/chrome/browser/views/extensions/extension_install_prompt.cc b/chrome/browser/views/extensions/extension_install_prompt.cc index af9c540..f75b557 100644 --- a/chrome/browser/views/extensions/extension_install_prompt.cc +++ b/chrome/browser/views/extensions/extension_install_prompt.cc @@ -74,9 +74,7 @@ class InstallDialogContent : public views::View, public views::DialogDelegate { } virtual bool Accept() { - // We don't support shortcut creation from this dialog anymore. - // TODO(aa): Remove this param from ExtensionInstallUI::Delegate. - delegate_->InstallUIProceed(false); + delegate_->InstallUIProceed(); return true; } @@ -85,7 +83,6 @@ class InstallDialogContent : public views::View, public views::DialogDelegate { return true; } - // WindowDelegate virtual bool IsModal() const { return true; } virtual std::wstring GetWindowTitle() const { diff --git a/chrome/browser/views/extensions/extension_install_prompt2.cc b/chrome/browser/views/extensions/extension_install_prompt2.cc index 397ade7..5b0ed3a 100644 --- a/chrome/browser/views/extensions/extension_install_prompt2.cc +++ b/chrome/browser/views/extensions/extension_install_prompt2.cc @@ -183,7 +183,7 @@ int InstallDialogContent2::GetDefaultDialogButton() const { } bool InstallDialogContent2::Accept() { - delegate_->InstallUIProceed(false); // create shortcut + delegate_->InstallUIProceed(); return true; } |