diff options
author | rafaelw@chromium.org <rafaelw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-12-16 19:16:38 +0000 |
---|---|---|
committer | rafaelw@chromium.org <rafaelw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-12-16 19:16:38 +0000 |
commit | ac02528c7082672bca70f67e72a74ee906507170 (patch) | |
tree | 9328bc6dc30c1fb6ff1c66e461a4f09c70b51cd7 | |
parent | f513d7b438b7f8d4a5551ca2f716f06374166b29 (diff) | |
download | chromium_src-ac02528c7082672bca70f67e72a74ee906507170.zip chromium_src-ac02528c7082672bca70f67e72a74ee906507170.tar.gz chromium_src-ac02528c7082672bca70f67e72a74ee906507170.tar.bz2 |
Only show gray LOADING dialog for Themes.
The patch changes the behavior of the LOADING dialog such that it is only shown for extension downloads from the mini-gallery (theme) url. Note that this means that themes from the chrome extensions gallery will also NOT have the dialog shown.
BUG=29628
TEST=Install an theme from https://tools.google.com/chrome/intl/pt/themes/index.html. The gray LOADING dialog should appear. Install extension or theme from chrome.google.com/extensions. No LOADING dialog should appear
Review URL: http://codereview.chromium.org/507016
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@34733 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/browser.cc | 9 | ||||
-rw-r--r-- | chrome/browser/download/download_manager.cc | 3 | ||||
-rw-r--r-- | chrome/browser/extensions/extensions_service.cc | 6 | ||||
-rw-r--r-- | chrome/browser/extensions/extensions_service.h | 4 | ||||
-rw-r--r-- | chrome/common/notification_type.h | 4 |
5 files changed, 23 insertions, 3 deletions
diff --git a/chrome/browser/browser.cc b/chrome/browser/browser.cc index 0868c7b..52eedad 100644 --- a/chrome/browser/browser.cc +++ b/chrome/browser/browser.cc @@ -2396,7 +2396,14 @@ void Browser::Observe(NotificationType type, case NotificationType::EXTENSION_READY_FOR_INSTALL: { if (BrowserList::GetLastActive() != this) break; - window()->ShowThemeInstallBubble(); + + // We only want to show the loading dialog for themes, but we don't want + // to wait until unpack to find out an extension is a theme, so we test + // the download_url GURL instead. This means that themes in the extensions + // gallery won't get the loading dialog. + GURL download_url = *(Details<GURL>(details).ptr()); + if (ExtensionsService::IsDownloadFromMiniGallery(download_url)) + window()->ShowThemeInstallBubble(); break; } diff --git a/chrome/browser/download/download_manager.cc b/chrome/browser/download/download_manager.cc index 1dcd72d..21642ef 100644 --- a/chrome/browser/download/download_manager.cc +++ b/chrome/browser/download/download_manager.cc @@ -1244,9 +1244,10 @@ void DownloadManager::OpenChromeExtension(const FilePath& full_path, ExtensionsService* service = profile_->GetExtensionsService(); if (service) { NotificationService* nservice = NotificationService::current(); + GURL nonconst_download_url = download_url; nservice->Notify(NotificationType::EXTENSION_READY_FOR_INSTALL, Source<DownloadManager>(this), - NotificationService::NoDetails()); + Details<GURL>(&nonconst_download_url)); if (UserScript::HasUserScriptFileExtension(download_url)) { CrxInstaller::InstallUserScript( full_path, diff --git a/chrome/browser/extensions/extensions_service.cc b/chrome/browser/extensions/extensions_service.cc index 99a97f2a..234638d 100644 --- a/chrome/browser/extensions/extensions_service.cc +++ b/chrome/browser/extensions/extensions_service.cc @@ -101,6 +101,12 @@ bool ExtensionsService::IsDownloadFromGallery(const GURL& download_url, return false; } +bool ExtensionsService::IsDownloadFromMiniGallery(const GURL& download_url) { + return StartsWithASCII(download_url.spec(), + extension_urls::kMiniGalleryDownloadPrefix, + false); // case_sensitive +} + ExtensionsService::ExtensionsService(Profile* profile, const CommandLine* command_line, PrefService* prefs, diff --git a/chrome/browser/extensions/extensions_service.h b/chrome/browser/extensions/extensions_service.h index 30751f6..813f0e1 100644 --- a/chrome/browser/extensions/extensions_service.h +++ b/chrome/browser/extensions/extensions_service.h @@ -78,6 +78,10 @@ class ExtensionsService static bool IsDownloadFromGallery(const GURL& download_url, const GURL& referrer_url); + // Determine if the downloaded extension came from the theme mini-gallery, + // Used to test if we need to show the "Loading" dialog for themes. + static bool IsDownloadFromMiniGallery(const GURL& download_url); + ExtensionsService(Profile* profile, const CommandLine* command_line, PrefService* prefs, diff --git a/chrome/common/notification_type.h b/chrome/common/notification_type.h index 44b9519..dfd87f3 100644 --- a/chrome/common/notification_type.h +++ b/chrome/common/notification_type.h @@ -660,7 +660,9 @@ class NotificationType { // details are an Extension*, and the source is a Profile*. EXTENSION_UPDATE_DISABLED, - // Sent when a theme is ready to be installed, so we can alert the user. + // Sent when an extension is about to be installed so we can (in the case of + // themes) alert the user with a loading dialog. The source is the download + // manager and the details are the download url. EXTENSION_READY_FOR_INSTALL, // Sent on ExtensionOverinstallAttempted when no theme is detected. The |