diff options
author | glen@chromium.org <glen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-06-05 19:17:40 +0000 |
---|---|---|
committer | glen@chromium.org <glen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-06-05 19:17:40 +0000 |
commit | 0e34d7893a17558b6520f853e63adc5e1cc4aa81 (patch) | |
tree | 2c61dfebb2207fddee26991e5d06f95cf37e66e7 | |
parent | e5f72c76f42ca9163a6691191ae0b1f471e81952 (diff) | |
download | chromium_src-0e34d7893a17558b6520f853e63adc5e1cc4aa81.zip chromium_src-0e34d7893a17558b6520f853e63adc5e1cc4aa81.tar.gz chromium_src-0e34d7893a17558b6520f853e63adc5e1cc4aa81.tar.bz2 |
Don't prompt before installing a Theme, move existing prompt so that users aren't prompted twice in the case when they have extensions disabled.
Theme installation confirmation will be done through an infobar (allowing you to preview a lot of themes quickly without dealing with dialogs) - see CL 119235.
BUG=none
TEST=Install a theme, verify that you don't get prompted. Install an extension and verify that you do get prompted.
Review URL: http://codereview.chromium.org/119232
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@17755 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/download/download_manager.cc | 14 | ||||
-rw-r--r-- | chrome/browser/extensions/extensions_service.cc | 21 | ||||
-rw-r--r-- | chrome/browser/extensions/extensions_service.h | 13 | ||||
-rw-r--r-- | chrome/browser/extensions/extensions_service_unittest.cc | 2 |
4 files changed, 26 insertions, 24 deletions
diff --git a/chrome/browser/download/download_manager.cc b/chrome/browser/download/download_manager.cc index 93cbaed..c18d08d 100644 --- a/chrome/browser/download/download_manager.cc +++ b/chrome/browser/download/download_manager.cc @@ -1218,7 +1218,7 @@ void DownloadManager::OpenDownload(const DownloadItem* download, if (extension.size() > 0) extension = extension.substr(1); - // Open Chrome extensions with ExtenstionsService. For everthing else do shell + // Open Chrome extensions with ExtensionsService. For everything else do shell // execute. if (extension == chrome::kExtensionFileExtension) { OpenChromeExtension(download->full_path()); @@ -1228,20 +1228,8 @@ void DownloadManager::OpenDownload(const DownloadItem* download, } void DownloadManager::OpenChromeExtension(const FilePath& full_path) { -#if defined(OS_WIN) - if (win_util::MessageBox(GetActiveWindow(), - L"Are you sure you want to install this extension?\n\n" - L"This is a temporary message and it will be removed when extensions " - L"UI is finalized.", - l10n_util::GetString(IDS_PRODUCT_NAME).c_str(), MB_OKCANCEL) == IDOK) { - ExtensionsService* extensions_service = profile_->GetExtensionsService(); - extensions_service->InstallExtension(full_path); - } -#else - // TODO(port): Needs CreateChromeWindow. ExtensionsService* extensions_service = profile_->GetExtensionsService(); extensions_service->InstallExtension(full_path); -#endif } void DownloadManager::OpenDownloadInShell(const DownloadItem* download, diff --git a/chrome/browser/extensions/extensions_service.cc b/chrome/browser/extensions/extensions_service.cc index 4d0f4f5..87c14a2 100644 --- a/chrome/browser/extensions/extensions_service.cc +++ b/chrome/browser/extensions/extensions_service.cc @@ -222,7 +222,7 @@ ExtensionsService::ExtensionsService(Profile* profile, extensions_enabled_( CommandLine::ForCurrentProcess()-> HasSwitch(switches::kEnableExtensions)), - show_extensions_disabled_notification_(true), + show_extensions_prompts_(true), backend_(new ExtensionsServiceBackend( install_directory_, g_browser_process->resource_dispatcher_host(), frontend_loop, registry_path)) { @@ -747,7 +747,7 @@ void ExtensionsServiceBackend::InstallExtension( LOG(INFO) << "Installing extension " << extension_path.value(); frontend_ = frontend; - alert_on_error_ = false; + alert_on_error_ = true; bool from_external = false; InstallOrUpdateExtension(extension_path, std::string(), from_external); @@ -779,7 +779,7 @@ void ExtensionsServiceBackend::OnExtensionUnpacked( if (!frontend_->extensions_enabled() && !extension.IsTheme()) { #if defined(OS_WIN) - if (frontend_->show_extensions_disabled_notification()) { + if (frontend_->show_extensions_prompts()) { win_util::MessageBox(GetActiveWindow(), L"Extensions are not enabled. Add --enable-extensions to the " L"command-line to enable extensions.\n\n" @@ -793,6 +793,21 @@ void ExtensionsServiceBackend::OnExtensionUnpacked( return; } +#if defined(OS_WIN) + if (!extension.IsTheme() && + frontend_->show_extensions_prompts() && + win_util::MessageBox(GetActiveWindow(), + L"Are you sure you want to install this extension?\n\n" + L"This is a temporary message and it will be removed when extensions " + L"UI is finalized.", + l10n_util::GetString(IDS_PRODUCT_NAME).c_str(), + MB_OKCANCEL) == IDOK) { + ReportExtensionInstallError(extension_path, + "User did not allow extension to be installed."); + return; + } +#endif + // If an expected id was provided, make sure it matches. if (!expected_id.empty() && expected_id != extension.id()) { ReportExtensionInstallError(extension_path, diff --git a/chrome/browser/extensions/extensions_service.h b/chrome/browser/extensions/extensions_service.h index 70373ff..09c9623 100644 --- a/chrome/browser/extensions/extensions_service.h +++ b/chrome/browser/extensions/extensions_service.h @@ -67,13 +67,13 @@ class ExtensionsService static const char* kCurrentVersionFileName; void set_extensions_enabled(bool enabled) { extensions_enabled_ = enabled; } - void set_show_extensions_disabled_notification(bool enabled) { - show_extensions_disabled_notification_ = enabled; + void set_show_extensions_prompts(bool enabled) { + show_extensions_prompts_ = enabled; } bool extensions_enabled() { return extensions_enabled_; } - bool show_extensions_disabled_notification() { - return show_extensions_disabled_notification_; + bool show_extensions_prompts() { + return show_extensions_prompts_; } private: @@ -109,9 +109,8 @@ class ExtensionsService // Whether or not extensions are enabled. bool extensions_enabled_; - // Whether to notify users when they attempt to install an extension without - // the flag being enabled. - bool show_extensions_disabled_notification_; + // Whether to notify users when they attempt to install an extension. + bool show_extensions_prompts_; // The backend that will do IO on behalf of this instance. scoped_refptr<ExtensionsServiceBackend> backend_; diff --git a/chrome/browser/extensions/extensions_service_unittest.cc b/chrome/browser/extensions/extensions_service_unittest.cc index e59a627..371dd8a 100644 --- a/chrome/browser/extensions/extensions_service_unittest.cc +++ b/chrome/browser/extensions/extensions_service_unittest.cc @@ -81,7 +81,7 @@ class ExtensionsServiceTest service_ = new ExtensionsService(profile_.get(), &loop_, &loop_, registry_path_); service_->set_extensions_enabled(true); - service_->set_show_extensions_disabled_notification(false); + service_->set_show_extensions_prompts(false); total_successes_ = 0; } |