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

Unified Diff: ash/system/tray/system_tray.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/tray/system_tray.h ('k') | ash/system/tray/system_tray_bubble.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/system/tray/system_tray.cc
diff --git a/ash/system/tray/system_tray.cc b/ash/system/tray/system_tray.cc
index c089947b6eeb0ff9baadcddfe90c3d04141ad83e..1663d5bb7e284ab217a2277598ec1272308f7bf0 100644
--- a/ash/system/tray/system_tray.cc
+++ b/ash/system/tray/system_tray.cc
@@ -30,7 +30,6 @@
#include "ash/system/tray_update.h"
#include "ash/system/user/login_status.h"
#include "ash/system/user/tray_user.h"
-#include "ash/wm/shelf_layout_manager.h"
#include "base/logging.h"
#include "base/timer.h"
#include "base/utf_string_conversions.h"
@@ -71,7 +70,6 @@ SystemTray::SystemTray(internal::StatusAreaWidget* status_area_widget)
network_observer_(NULL),
update_observer_(NULL),
user_observer_(NULL),
- should_show_launcher_(false),
default_bubble_height_(0),
hide_notifications_(false) {
}
@@ -230,6 +228,10 @@ void SystemTray::SetHideNotifications(bool hide_notifications) {
hide_notifications_ = hide_notifications;
}
+bool SystemTray::IsSystemBubbleVisible() const {
+ return (bubble_.get() && bubble_->IsVisible());
+}
+
bool SystemTray::IsAnyBubbleVisible() const {
if (bubble_.get() && bubble_->IsVisible())
return true;
@@ -238,6 +240,13 @@ bool SystemTray::IsAnyBubbleVisible() const {
return false;
}
+bool SystemTray::IsMouseInNotificationBubble() const {
+ if (!notification_bubble_.get())
+ return false;
+ return notification_bubble_->bubble_view()->GetBoundsInScreen().Contains(
+ gfx::Screen::GetCursorScreenPoint());
+}
+
bool SystemTray::CloseBubbleForTest() const {
if (!bubble_.get())
return false;
@@ -256,14 +265,7 @@ void SystemTray::RemoveBubble(SystemTrayBubble* bubble) {
if (bubble == bubble_.get()) {
DestroyBubble();
UpdateNotificationBubble(); // State changed, re-create notifications.
- if (should_show_launcher_) {
- // No need to show the launcher if the mouse isn't over the status area
- // anymore.
- should_show_launcher_ = GetWidget()->GetWindowBoundsInScreen().Contains(
- gfx::Screen::GetCursorScreenPoint());
- if (!should_show_launcher_)
- Shell::GetInstance()->shelf()->UpdateAutoHideState();
- }
+ UpdateShouldShowLauncher();
} else if (bubble == notification_bubble_) {
notification_bubble_.reset();
} else {
@@ -340,13 +342,9 @@ void SystemTray::ShowItems(const std::vector<SystemTrayItem*>& items,
else
detailed_item_ = NULL;
- // If we have focus the shelf should be visible and we need to continue
- // showing the shelf when the popup is shown.
- if (GetWidget()->IsActive())
- should_show_launcher_ = true;
-
UpdateNotificationBubble(); // State changed, re-create notifications.
status_area_widget()->HideNonSystemNotifications();
+ UpdateShouldShowLauncher();
}
void SystemTray::UpdateNotificationBubble() {
@@ -447,18 +445,6 @@ bool SystemTray::PerformAction(const ui::Event& event) {
return true;
}
-void SystemTray::OnMouseEntered(const ui::MouseEvent& event) {
- TrayBackgroundView::OnMouseEntered(event);
- should_show_launcher_ = true;
-}
-
-void SystemTray::OnMouseExited(const ui::MouseEvent& event) {
- TrayBackgroundView::OnMouseExited(event);
- // When the popup closes we'll update |should_show_launcher_|.
- if (!bubble_.get())
- should_show_launcher_ = false;
-}
-
void SystemTray::GetAccessibleState(ui::AccessibleViewState* state) {
state->role = ui::AccessibilityTypes::ROLE_PUSHBUTTON;
state->name = l10n_util::GetStringUTF16(
« no previous file with comments | « ash/system/tray/system_tray.h ('k') | ash/system/tray/system_tray_bubble.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698