| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "ash/system/web_notification/web_notification_tray.h" | 5 #include "ash/system/web_notification/web_notification_tray.h" |
| 6 | 6 |
| 7 #include "ash/shell.h" |
| 7 #include "ash/system/status_area_widget.h" | 8 #include "ash/system/status_area_widget.h" |
| 8 #include "ash/system/tray/tray_bubble_view.h" | 9 #include "ash/system/tray/tray_bubble_view.h" |
| 9 #include "ash/system/tray/tray_constants.h" | 10 #include "ash/system/tray/tray_constants.h" |
| 10 #include "ash/system/tray/tray_views.h" | 11 #include "ash/system/tray/tray_views.h" |
| 12 #include "ash/wm/shelf_layout_manager.h" |
| 11 #include "base/bind.h" | 13 #include "base/bind.h" |
| 12 #include "base/message_loop.h" | 14 #include "base/message_loop.h" |
| 13 #include "base/stringprintf.h" | 15 #include "base/stringprintf.h" |
| 14 #include "base/timer.h" | 16 #include "base/timer.h" |
| 15 #include "base/utf_string_conversions.h" | 17 #include "base/utf_string_conversions.h" |
| 16 #include "grit/ash_resources.h" | 18 #include "grit/ash_resources.h" |
| 17 #include "grit/ash_strings.h" | 19 #include "grit/ash_strings.h" |
| 18 #include "ui/aura/window.h" | 20 #include "ui/aura/window.h" |
| 19 #include "ui/base/l10n/l10n_util.h" | 21 #include "ui/base/l10n/l10n_util.h" |
| 20 #include "ui/base/models/simple_menu_model.h" | 22 #include "ui/base/models/simple_menu_model.h" |
| (...skipping 879 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 900 | 902 |
| 901 views::Widget* bubble_widget() const { return bubble_widget_; } | 903 views::Widget* bubble_widget() const { return bubble_widget_; } |
| 902 TrayBubbleView* bubble_view() const { return bubble_view_; } | 904 TrayBubbleView* bubble_view() const { return bubble_view_; } |
| 903 | 905 |
| 904 // Overridden from TrayBubbleView::Host. | 906 // Overridden from TrayBubbleView::Host. |
| 905 virtual void BubbleViewDestroyed() OVERRIDE { | 907 virtual void BubbleViewDestroyed() OVERRIDE { |
| 906 bubble_view_ = NULL; | 908 bubble_view_ = NULL; |
| 907 } | 909 } |
| 908 | 910 |
| 909 virtual void OnMouseEnteredView() OVERRIDE { | 911 virtual void OnMouseEnteredView() OVERRIDE { |
| 910 tray_->UpdateShouldShowLauncher(); | |
| 911 } | 912 } |
| 912 | 913 |
| 913 virtual void OnMouseExitedView() OVERRIDE { | 914 virtual void OnMouseExitedView() OVERRIDE { |
| 914 tray_->UpdateShouldShowLauncher(); | |
| 915 } | 915 } |
| 916 | 916 |
| 917 virtual void OnClickedOutsideView() OVERRIDE { | 917 virtual void OnClickedOutsideView() OVERRIDE { |
| 918 // May delete |this|. | 918 // May delete |this|. |
| 919 tray_->HideMessageCenterBubble(); | 919 tray_->HideMessageCenterBubble(); |
| 920 } | 920 } |
| 921 | 921 |
| 922 virtual string16 GetAccessibleName() OVERRIDE { | 922 virtual string16 GetAccessibleName() OVERRIDE { |
| 923 return tray_->GetAccessibleName(); | 923 return tray_->GetAccessibleName(); |
| 924 } | 924 } |
| (...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1150 if (message_center_bubble()) { | 1150 if (message_center_bubble()) { |
| 1151 UpdateTray(); | 1151 UpdateTray(); |
| 1152 return; | 1152 return; |
| 1153 } | 1153 } |
| 1154 // Indicate that the message center is visible. Clears the unread count. | 1154 // Indicate that the message center is visible. Clears the unread count. |
| 1155 notification_list_->SetMessageCenterVisible(true); | 1155 notification_list_->SetMessageCenterVisible(true); |
| 1156 UpdateTray(); | 1156 UpdateTray(); |
| 1157 HidePopupBubble(); | 1157 HidePopupBubble(); |
| 1158 message_center_bubble_.reset(new MessageCenterBubble(this)); | 1158 message_center_bubble_.reset(new MessageCenterBubble(this)); |
| 1159 status_area_widget()->SetHideSystemNotifications(true); | 1159 status_area_widget()->SetHideSystemNotifications(true); |
| 1160 UpdateShouldShowLauncher(); | 1160 Shell::GetInstance()->shelf()->UpdateAutoHideState(); |
| 1161 } | 1161 } |
| 1162 | 1162 |
| 1163 void WebNotificationTray::HideMessageCenterBubble() { | 1163 void WebNotificationTray::HideMessageCenterBubble() { |
| 1164 if (!message_center_bubble()) | 1164 if (!message_center_bubble()) |
| 1165 return; | 1165 return; |
| 1166 message_center_bubble_.reset(); | 1166 message_center_bubble_.reset(); |
| 1167 show_message_center_on_unlock_ = false; | 1167 show_message_center_on_unlock_ = false; |
| 1168 notification_list_->SetMessageCenterVisible(false); | 1168 notification_list_->SetMessageCenterVisible(false); |
| 1169 UpdateTray(); | 1169 UpdateTray(); |
| 1170 status_area_widget()->SetHideSystemNotifications(false); | 1170 status_area_widget()->SetHideSystemNotifications(false); |
| 1171 UpdateShouldShowLauncher(); | 1171 Shell::GetInstance()->shelf()->UpdateAutoHideState(); |
| 1172 } | 1172 } |
| 1173 | 1173 |
| 1174 void WebNotificationTray::SetHidePopupBubble(bool hide) { | 1174 void WebNotificationTray::SetHidePopupBubble(bool hide) { |
| 1175 if (hide) | 1175 if (hide) |
| 1176 HidePopupBubble(); | 1176 HidePopupBubble(); |
| 1177 else | 1177 else |
| 1178 ShowPopupBubble(); | 1178 ShowPopupBubble(); |
| 1179 } | 1179 } |
| 1180 | 1180 |
| 1181 void WebNotificationTray::ShowPopupBubble() { | 1181 void WebNotificationTray::ShowPopupBubble() { |
| (...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1397 return message_center_bubble()->MessageViewsForTest(); | 1397 return message_center_bubble()->MessageViewsForTest(); |
| 1398 } | 1398 } |
| 1399 | 1399 |
| 1400 size_t WebNotificationTray::GetPopupNotificationCountForTest() const { | 1400 size_t WebNotificationTray::GetPopupNotificationCountForTest() const { |
| 1401 if (!popup_bubble()) | 1401 if (!popup_bubble()) |
| 1402 return 0; | 1402 return 0; |
| 1403 return popup_bubble()->MessageViewsForTest(); | 1403 return popup_bubble()->MessageViewsForTest(); |
| 1404 } | 1404 } |
| 1405 | 1405 |
| 1406 } // namespace ash | 1406 } // namespace ash |
| OLD | NEW |