From 201ebfe03681052d1233f12d18e47392dba761bd Mon Sep 17 00:00:00 2001 From: "estade@chromium.org" Date: Thu, 29 Oct 2009 18:34:12 +0000 Subject: Hide the theme install bubble a little earlier. The bubble was showing at the same time as the installation confirmation dialog for non-theme extensions. BUG=26130 Review URL: http://codereview.chromium.org/339055 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@30481 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/browser/cocoa/theme_install_bubble_view.mm | 10 ++++++++++ chrome/browser/extensions/extension_install_ui.cc | 6 ++++++ chrome/browser/gtk/theme_install_bubble_view_gtk.cc | 10 ++++++++++ chrome/browser/views/theme_install_bubble_view.cc | 7 +++++++ chrome/common/notification_type.h | 6 +++++- 5 files changed, 38 insertions(+), 1 deletion(-) diff --git a/chrome/browser/cocoa/theme_install_bubble_view.mm b/chrome/browser/cocoa/theme_install_bubble_view.mm index f3c2c25..70a7cee 100644 --- a/chrome/browser/cocoa/theme_install_bubble_view.mm +++ b/chrome/browser/cocoa/theme_install_bubble_view.mm @@ -73,6 +73,16 @@ ThemeInstallBubbleView::ThemeInstallBubbleView(NSWindow* window) this, NotificationType::EXTENSION_INSTALLED, NotificationService::AllSources()); + registrar_.Add( + this, + NotificationType::EXTENSION_INSTALL_ERROR, + NotificationService::AllSources()); + + // Don't let the bubble overlap the confirm dialog. + registrar_.Add( + this, + NotificationType::EXTENSION_WILL_SHOW_CONFIRM_DIALOG, + NotificationService::AllSources()); // Add the view. [cocoa_view_ setFrame:parent_bounds]; diff --git a/chrome/browser/extensions/extension_install_ui.cc b/chrome/browser/extensions/extension_install_ui.cc index 720e19d..1712791 100644 --- a/chrome/browser/extensions/extension_install_ui.cc +++ b/chrome/browser/extensions/extension_install_ui.cc @@ -17,6 +17,7 @@ #include "chrome/browser/profile.h" #include "chrome/browser/tab_contents/tab_contents.h" #include "chrome/common/extensions/extension.h" +#include "chrome/common/notification_service.h" #include "grit/browser_resources.h" #include "grit/chromium_strings.h" #include "grit/generated_resources.h" @@ -113,6 +114,11 @@ void ExtensionInstallUI::ConfirmInstall(Delegate* delegate, IDR_EXTENSIONS_SECTION); } + NotificationService* service = NotificationService::current(); + service->Notify(NotificationType::EXTENSION_WILL_SHOW_CONFIRM_DIALOG, + Source(this), + NotificationService::NoDetails()); + ShowExtensionInstallPrompt(profile_, delegate, extension, install_icon, GetInstallWarning(extension)); diff --git a/chrome/browser/gtk/theme_install_bubble_view_gtk.cc b/chrome/browser/gtk/theme_install_bubble_view_gtk.cc index f3ea425..94b5471 100644 --- a/chrome/browser/gtk/theme_install_bubble_view_gtk.cc +++ b/chrome/browser/gtk/theme_install_bubble_view_gtk.cc @@ -65,6 +65,16 @@ ThemeInstallBubbleViewGtk::ThemeInstallBubbleViewGtk(GtkWidget* parent) this, NotificationType::EXTENSION_INSTALLED, NotificationService::AllSources()); + registrar_.Add( + this, + NotificationType::EXTENSION_INSTALL_ERROR, + NotificationService::AllSources()); + + // Don't let the bubble overlap the confirm dialog. + registrar_.Add( + this, + NotificationType::EXTENSION_WILL_SHOW_CONFIRM_DIALOG, + NotificationService::AllSources()); } ThemeInstallBubbleViewGtk::~ThemeInstallBubbleViewGtk() { diff --git a/chrome/browser/views/theme_install_bubble_view.cc b/chrome/browser/views/theme_install_bubble_view.cc index e305cd0..6f2fe06 100644 --- a/chrome/browser/views/theme_install_bubble_view.cc +++ b/chrome/browser/views/theme_install_bubble_view.cc @@ -58,6 +58,13 @@ ThemeInstallBubbleView::ThemeInstallBubbleView(TabContents* tab_contents) this, NotificationType::EXTENSION_INSTALL_ERROR, NotificationService::AllSources()); + + // Don't let the bubble overlap the confirm dialog. + registrar_.Add( + this, + NotificationType::EXTENSION_WILL_SHOW_CONFIRM_DIALOG, + NotificationService::AllSources()); + gfx::Rect rc(0, 0, 0, 0); popup_ = new views::WidgetWin; popup_->set_window_style(WS_POPUP); diff --git a/chrome/common/notification_type.h b/chrome/common/notification_type.h index 623e9da..86e09fd 100644 --- a/chrome/common/notification_type.h +++ b/chrome/common/notification_type.h @@ -407,6 +407,10 @@ class NotificationType { // NoDetails. EXTENSION_SHELF_VISIBILITY_PREF_CHANGED, + // Sent just before the installation confirm dialog is shown. The source + // is the ExtensionInstallUI, the details are NoDetails. + EXTENSION_WILL_SHOW_CONFIRM_DIALOG, + // Used to monitor web cache usage by notifying whenever the // CacheManagerHost observes new UsageStats. The source will be the // RenderProcessHost that corresponds to the new statistics. Details are a @@ -726,7 +730,7 @@ class NotificationType { // Sent when the blacklist manager encounters an error. The details are // a string16 (error message), and the source is a Profile. BLACKLIST_MANAGER_ERROR, - + // Sent by the resource dispatcher host when a resource is blocked. BLACKLIST_BLOCKED_RESOURCE, -- cgit v1.1