Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(21)

Unified Diff: ash/system/status_area_widget.cc

Issue 10823350: Re-factor system tray code controlling launcher visibility (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ash/system/status_area_widget.h ('k') | ash/system/tray/system_tray.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/system/status_area_widget.cc
diff --git a/ash/system/status_area_widget.cc b/ash/system/status_area_widget.cc
index a39bc7f5ffa870bf878112124c5d22a021b241aa..8470d2df96abd962bbadc363ead3e1e0c48bf6f9 100644
--- a/ash/system/status_area_widget.cc
+++ b/ash/system/status_area_widget.cc
@@ -15,9 +15,11 @@
#include "ash/system/tray/system_tray_delegate.h"
#include "ash/system/web_notification/web_notification_tray.h"
#include "ash/volume_control_delegate.h"
+#include "ash/wm/shelf_layout_manager.h"
#include "base/i18n/time_formatting.h"
#include "base/utf_string_conversions.h"
#include "ui/aura/window.h"
+#include "ui/gfx/screen.h"
namespace ash {
@@ -306,7 +308,8 @@ StatusAreaWidget::StatusAreaWidget()
: status_area_widget_delegate_(new internal::StatusAreaWidgetDelegate),
system_tray_(NULL),
web_notification_tray_(NULL),
- login_status_(user::LOGGED_IN_NONE) {
+ login_status_(user::LOGGED_IN_NONE),
+ should_show_launcher_(false) {
views::Widget::InitParams params(
views::Widget::InitParams::TYPE_WINDOW_FRAMELESS);
params.delegate = status_area_widget_delegate_;
@@ -405,5 +408,27 @@ 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_->IsSystemBubbleVisible()) ||
+ (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
« no previous file with comments | « ash/system/status_area_widget.h ('k') | ash/system/tray/system_tray.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698