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

Unified Diff: ui/message_center/message_center_tray.cc

Issue 23636010: Notifications: Add cross-platform UMA: ShowMessageCenter, ShowSettings. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove spurious test code. Created 7 years, 3 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
Index: ui/message_center/message_center_tray.cc
diff --git a/ui/message_center/message_center_tray.cc b/ui/message_center/message_center_tray.cc
index a571a2319315a4d2e77b7db9cd01b7cb9b5cf54d..a9abbab028383059a8572613eece16f5ca14441d 100644
--- a/ui/message_center/message_center_tray.cc
+++ b/ui/message_center/message_center_tray.cc
@@ -31,10 +31,11 @@ bool MessageCenterTray::ShowMessageCenterBubble() {
if (message_center_visible_)
return true;
- HidePopupBubble();
+ HidePopupBubbleInternal();
message_center_visible_ = delegate_->ShowMessageCenter();
- message_center_->SetMessageCenterVisible(message_center_visible_);
+ message_center_->SetVisibility(message_center::VISIBILITY_MESSAGE_CENTER);
+ NotifyMessageCenterTrayChanged();
return message_center_visible_;
}
@@ -50,11 +51,16 @@ void MessageCenterTray::MarkMessageCenterHidden() {
if (!message_center_visible_)
return;
message_center_visible_ = false;
- message_center_->SetMessageCenterVisible(false);
+
// Some notifications (like system ones) should appear as popups again
// after the message center is closed.
- if (message_center_->HasPopupNotifications())
+ if (message_center_->HasPopupNotifications()) {
ShowPopupBubble();
+ return;
+ }
+
+ message_center_->SetVisibility(message_center::VISIBILITY_TRANSIENT);
+
NotifyMessageCenterTrayChanged();
}
@@ -74,29 +80,41 @@ void MessageCenterTray::ShowPopupBubble() {
return;
}
- if (!message_center_->HasPopupNotifications())
+ if (!message_center_->HasPopupNotifications()) {
return;
+ }
Jun Mukai 2013/09/09 17:12:35 nit: no braces for single line.
dewittj 2013/09/10 21:23:24 Done.
popups_visible_ = delegate_->ShowPopups();
+
NotifyMessageCenterTrayChanged();
}
bool MessageCenterTray::HidePopupBubble() {
if (!popups_visible_)
return false;
-
- delegate_->HidePopups();
- popups_visible_ = false;
+ HidePopupBubbleInternal();
+ message_center_->SetVisibility(message_center::VISIBILITY_TRANSIENT);
Jun Mukai 2013/09/09 17:12:35 why need to specify TRANSIENT here?
dewittj 2013/09/10 21:23:24 Done.
NotifyMessageCenterTrayChanged();
return true;
}
+void MessageCenterTray::HidePopupBubbleInternal() {
+ if (!popups_visible_)
+ return;
+
+ delegate_->HidePopups();
+ popups_visible_ = false;
+}
+
void MessageCenterTray::ShowNotifierSettingsBubble() {
if (popups_visible_)
- HidePopupBubble();
+ HidePopupBubbleInternal();
message_center_visible_ = delegate_->ShowNotifierSettings();
+ message_center_->SetVisibility(message_center::VISIBILITY_SETTINGS);
+
+ NotifyMessageCenterTrayChanged();
}
void MessageCenterTray::OnNotificationAdded(
@@ -138,14 +156,12 @@ void MessageCenterTray::OnQuietModeChanged(bool in_quiet_mode) {
}
void MessageCenterTray::OnMessageCenterChanged() {
- if (message_center_visible_) {
- if (message_center_->NotificationCount() == 0)
- HideMessageCenterBubble();
- }
+ if (message_center_visible_ && message_center_->NotificationCount() == 0)
+ HideMessageCenterBubble();
if (popups_visible_ && !message_center_->HasPopupNotifications())
- HidePopupBubble();
- else if (message_center_->HasPopupNotifications())
+ HidePopupBubbleInternal();
+ else if (!popups_visible_ && message_center_->HasPopupNotifications())
ShowPopupBubble();
NotifyMessageCenterTrayChanged();

Powered by Google App Engine
This is Rietveld 408576698