diff options
author | sky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-09-14 04:22:31 +0000 |
---|---|---|
committer | sky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-09-14 04:22:31 +0000 |
commit | fa404270b07b471ea008520dabaa6db35d7fbe82 (patch) | |
tree | 879921a11b375817a1348e187375b34e908978fc /ash/system/status_area_widget.cc | |
parent | 9d33f85ce5de15425824fe9d7d4074e603cda59c (diff) | |
download | chromium_src-fa404270b07b471ea008520dabaa6db35d7fbe82.zip chromium_src-fa404270b07b471ea008520dabaa6db35d7fbe82.tar.gz chromium_src-fa404270b07b471ea008520dabaa6db35d7fbe82.tar.bz2 |
Removes caching of whether the launcher should be visible from
StatusAreaWidget and instead queries as necessary. The problem is the
current code was caching things based on mouse location, but it wasn't
always updating when the mouse moved. Since the shelf has its own
mouse handler that queries for state it isn't necessary to duplicate
that in the tray.
BUG=148548
TEST=see bug
R=sadrul@chromium.org
Review URL: https://chromiumcodereview.appspot.com/10909220
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@156740 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash/system/status_area_widget.cc')
-rw-r--r-- | ash/system/status_area_widget.cc | 41 |
1 files changed, 17 insertions, 24 deletions
diff --git a/ash/system/status_area_widget.cc b/ash/system/status_area_widget.cc index 97dd7ca..b3e2b4f 100644 --- a/ash/system/status_area_widget.cc +++ b/ash/system/status_area_widget.cc @@ -303,8 +303,7 @@ StatusAreaWidget::StatusAreaWidget() : status_area_widget_delegate_(new internal::StatusAreaWidgetDelegate), system_tray_(NULL), web_notification_tray_(NULL), - login_status_(user::LOGGED_IN_NONE), - should_show_launcher_(false) { + login_status_(user::LOGGED_IN_NONE) { views::Widget::InitParams params( views::Widget::InitParams::TYPE_WINDOW_FRAMELESS); params.delegate = status_area_widget_delegate_; @@ -343,6 +342,22 @@ void StatusAreaWidget::Shutdown() { delete web_notification_tray_; } +bool StatusAreaWidget::ShouldShowLauncher() const { + if ((system_tray_ && system_tray_->HasSystemBubble()) || + (web_notification_tray_ && + web_notification_tray_->IsMessageCenterBubbleVisible())) + return true; + + if (!Shell::GetInstance()->shelf()->IsVisible()) + return false; + + // If the launcher is currently visible, don't hide the launcher if the mouse + // is in any of the notification bubbles. + return (system_tray_ && system_tray_->IsMouseInNotificationBubble()) || + (web_notification_tray_ && + web_notification_tray_->IsMouseInNotificationBubble()); +} + void StatusAreaWidget::AddSystemTray(ShellDelegate* shell_delegate) { system_tray_ = new SystemTray(this); status_area_widget_delegate_->AddTray(system_tray_); @@ -403,27 +418,5 @@ void StatusAreaWidget::UpdateAfterLoginStatusChange( web_notification_tray_->UpdateAfterLoginStatusChange(login_status); } -void StatusAreaWidget::UpdateShouldShowLauncher() { - // If any bubble is visible, we should show the launcher. - bool should_show_launcher = - (system_tray_ && system_tray_->HasSystemBubble()) || - (web_notification_tray_ && - web_notification_tray_->IsMessageCenterBubbleVisible()); - if (!should_show_launcher && Shell::GetInstance()->shelf()->IsVisible()) { - // If the launcher is currently visible, don't hide the launcher if - // the mouse is in this widget or in any notification bubbles. - should_show_launcher = - (GetWindowBoundsInScreen().Contains( - gfx::Screen::GetCursorScreenPoint())) || - (system_tray_ && system_tray_->IsMouseInNotificationBubble()) || - (web_notification_tray_ && - web_notification_tray_->IsMouseInNotificationBubble()); - } - if (should_show_launcher != should_show_launcher_) { - should_show_launcher_ = should_show_launcher; - Shell::GetInstance()->shelf()->UpdateAutoHideState(); - } -} - } // namespace internal } // namespace ash |