OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "ui/message_center/message_center_tray.h" | 5 #include "ui/message_center/message_center_tray.h" |
6 | 6 |
7 #include "base/observer_list.h" | 7 #include "base/observer_list.h" |
8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
9 #include "grit/ui_strings.h" | 9 #include "grit/ui_strings.h" |
10 #include "ui/base/l10n/l10n_util.h" | 10 #include "ui/base/l10n/l10n_util.h" |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 HideMessageCenterBubble(); | 65 HideMessageCenterBubble(); |
66 else | 66 else |
67 ShowMessageCenterBubble(); | 67 ShowMessageCenterBubble(); |
68 } | 68 } |
69 | 69 |
70 void MessageCenterTray::ShowPopupBubble() { | 70 void MessageCenterTray::ShowPopupBubble() { |
71 if (message_center_visible_) | 71 if (message_center_visible_) |
72 return; | 72 return; |
73 | 73 |
74 if (popups_visible_) { | 74 if (popups_visible_) { |
75 delegate_->UpdatePopups(); | |
76 NotifyMessageCenterTrayChanged(); | 75 NotifyMessageCenterTrayChanged(); |
77 return; | 76 return; |
78 } | 77 } |
79 | 78 |
80 if (!message_center_->HasPopupNotifications()) | 79 if (!message_center_->HasPopupNotifications()) |
81 return; | 80 return; |
82 | 81 |
83 popups_visible_ = delegate_->ShowPopups(); | 82 popups_visible_ = delegate_->ShowPopups(); |
84 NotifyMessageCenterTrayChanged(); | 83 NotifyMessageCenterTrayChanged(); |
85 } | 84 } |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 void MessageCenterTray::OnNotificationDisplayed( | 145 void MessageCenterTray::OnNotificationDisplayed( |
147 const std::string& notification_id) { | 146 const std::string& notification_id) { |
148 NotifyMessageCenterTrayChanged(); | 147 NotifyMessageCenterTrayChanged(); |
149 } | 148 } |
150 | 149 |
151 void MessageCenterTray::OnMessageCenterChanged() { | 150 void MessageCenterTray::OnMessageCenterChanged() { |
152 if (message_center_visible_) { | 151 if (message_center_visible_) { |
153 if (message_center_->NotificationCount() == 0) | 152 if (message_center_->NotificationCount() == 0) |
154 HideMessageCenterBubble(); | 153 HideMessageCenterBubble(); |
155 } | 154 } |
156 if (popups_visible_) { | 155 |
157 if (message_center_->HasPopupNotifications()) | 156 if (popups_visible_ && !message_center_->HasPopupNotifications()) |
158 delegate_->UpdatePopups(); | 157 HidePopupBubble(); |
159 else | 158 else if (message_center_->HasPopupNotifications()) |
160 HidePopupBubble(); | |
161 } else if (message_center_->HasPopupNotifications()) { | |
162 ShowPopupBubble(); | 159 ShowPopupBubble(); |
163 } | |
164 | 160 |
165 NotifyMessageCenterTrayChanged(); | 161 NotifyMessageCenterTrayChanged(); |
166 } | 162 } |
167 | 163 |
168 bool MessageCenterTray::IsCommandIdChecked(int command_id) const { | 164 bool MessageCenterTray::IsCommandIdChecked(int command_id) const { |
169 if (command_id != kToggleQuietMode) | 165 if (command_id != kToggleQuietMode) |
170 return false; | 166 return false; |
171 return message_center()->IsQuietMode(); | 167 return message_center()->IsQuietMode(); |
172 } | 168 } |
173 | 169 |
(...skipping 19 matching lines...) Expand all Loading... |
193 base::TimeDelta::FromHours(1); | 189 base::TimeDelta::FromHours(1); |
194 message_center()->EnterQuietModeWithExpire(expires_in); | 190 message_center()->EnterQuietModeWithExpire(expires_in); |
195 NotifyMessageCenterTrayChanged(); | 191 NotifyMessageCenterTrayChanged(); |
196 } | 192 } |
197 | 193 |
198 void MessageCenterTray::NotifyMessageCenterTrayChanged() { | 194 void MessageCenterTray::NotifyMessageCenterTrayChanged() { |
199 delegate_->OnMessageCenterTrayChanged(); | 195 delegate_->OnMessageCenterTrayChanged(); |
200 } | 196 } |
201 | 197 |
202 } // namespace message_center | 198 } // namespace message_center |
OLD | NEW |