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

Side by Side Diff: ash/system/web_notification/web_notification_tray.cc

Issue 10854175: Revert 151752 - Move non SystemTray specific code to TrayBackgroundView (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ash/system/web_notification/web_notification_tray.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/system/status_area_widget.h" 7 #include "ash/system/status_area_widget.h"
8 #include "ash/system/tray/system_tray.h" 8 #include "ash/system/tray/system_tray.h"
9 #include "ash/system/tray/tray_bubble_view.h" 9 #include "ash/system/tray/tray_bubble_view.h"
10 #include "ash/system/tray/tray_constants.h" 10 #include "ash/system/tray/tray_constants.h"
(...skipping 744 matching lines...) Expand 10 before | Expand all | Expand 10 after
755 755
756 weak_ptr_factory_.InvalidateWeakPtrs(); // Cancel any pending update. 756 weak_ptr_factory_.InvalidateWeakPtrs(); // Cancel any pending update.
757 MessageLoop::current()->PostDelayedTask( 757 MessageLoop::current()->PostDelayedTask(
758 FROM_HERE, 758 FROM_HERE,
759 base::Bind(&WebNotificationTray::Bubble::UpdateBubbleView, 759 base::Bind(&WebNotificationTray::Bubble::UpdateBubbleView,
760 weak_ptr_factory_.GetWeakPtr()), 760 weak_ptr_factory_.GetWeakPtr()),
761 base::TimeDelta::FromMilliseconds(kUpdateDelayMs)); 761 base::TimeDelta::FromMilliseconds(kUpdateDelayMs));
762 } 762 }
763 763
764 views::Widget* bubble_widget() const { return bubble_widget_; } 764 views::Widget* bubble_widget() const { return bubble_widget_; }
765 TrayBubbleView* bubble_view() const { return bubble_view_; }
766 765
767 // Overridden from TrayBubbleView::Host. 766 // Overridden from TrayBubbleView::Host.
768 virtual void BubbleViewDestroyed() OVERRIDE { 767 virtual void BubbleViewDestroyed() OVERRIDE {
769 bubble_view_ = NULL; 768 bubble_view_ = NULL;
770 contents_view_ = NULL; 769 contents_view_ = NULL;
771 } 770 }
772 771
773 virtual void OnMouseEnteredView() OVERRIDE { 772 virtual void OnMouseEnteredView() OVERRIDE {
774 StopAutoCloseTimer(); 773 StopAutoCloseTimer();
775 } 774 }
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
960 internal::TrayBackgroundView::SetShelfAlignment(alignment); 959 internal::TrayBackgroundView::SetShelfAlignment(alignment);
961 if (alignment == SHELF_ALIGNMENT_BOTTOM) 960 if (alignment == SHELF_ALIGNMENT_BOTTOM)
962 tray_container()->set_size(gfx::Size(kTrayWidth, kTrayHeight)); 961 tray_container()->set_size(gfx::Size(kTrayWidth, kTrayHeight));
963 else 962 else
964 tray_container()->set_size(gfx::Size(kTraySideWidth, kTraySideHeight)); 963 tray_container()->set_size(gfx::Size(kTraySideWidth, kTraySideHeight));
965 // Destroy any existing bubble so that it will be rebuilt correctly. 964 // Destroy any existing bubble so that it will be rebuilt correctly.
966 HideMessageCenterBubble(); 965 HideMessageCenterBubble();
967 HideNotificationBubble(); 966 HideNotificationBubble();
968 } 967 }
969 968
970 void WebNotificationTray::AnchorUpdated() {
971 if (notification_bubble_.get()) {
972 notification_bubble_->bubble_view()->UpdateBubble();
973 // Ensure that the notification buble is above the launcher/status area.
974 notification_bubble_->bubble_view()->GetWidget()->StackAtTop();
975 }
976 if (message_center_bubble_.get())
977 message_center_bubble_->bubble_view()->UpdateBubble();
978 }
979
980 // Protected methods (invoked only from Bubble and its child classes) 969 // Protected methods (invoked only from Bubble and its child classes)
981 970
982 void WebNotificationTray::SendRemoveNotification(const std::string& id) { 971 void WebNotificationTray::SendRemoveNotification(const std::string& id) {
983 // If this is the only notification in the list, close the bubble. 972 // If this is the only notification in the list, close the bubble.
984 if (notification_list_->notifications().size() == 1 && 973 if (notification_list_->notifications().size() == 1 &&
985 id == notification_list_->GetFirstId()) { 974 id == notification_list_->GetFirstId()) {
986 HideMessageCenterBubble(); 975 HideMessageCenterBubble();
987 } 976 }
988 if (delegate_) 977 if (delegate_)
989 delegate_->NotificationRemoved(id); 978 delegate_->NotificationRemoved(id);
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
1045 1034
1046 // Private methods 1035 // Private methods
1047 1036
1048 void WebNotificationTray::UpdateTray() { 1037 void WebNotificationTray::UpdateTray() {
1049 count_label_->SetText(UTF8ToUTF16( 1038 count_label_->SetText(UTF8ToUTF16(
1050 GetNotificationText(notification_list()->unread_count()))); 1039 GetNotificationText(notification_list()->unread_count())));
1051 // Dim the message count text only if the message center is empty. 1040 // Dim the message count text only if the message center is empty.
1052 count_label_->SetEnabledColor( 1041 count_label_->SetEnabledColor(
1053 (notification_list()->notifications().size() == 0) ? 1042 (notification_list()->notifications().size() == 0) ?
1054 kMessageCountDimmedColor : kMessageCountColor); 1043 kMessageCountDimmedColor : kMessageCountColor);
1055 bool is_visible = 1044 SetVisible((status_area_widget()->login_status() != user::LOGGED_IN_NONE));
1056 (status_area_widget()->login_status() != user::LOGGED_IN_NONE) &&
1057 (status_area_widget()->login_status() != user::LOGGED_IN_LOCKED);
1058 SetVisible(is_visible);
1059 Layout(); 1045 Layout();
1060 SchedulePaint(); 1046 SchedulePaint();
1061 } 1047 }
1062 1048
1063 void WebNotificationTray::UpdateTrayAndBubble() { 1049 void WebNotificationTray::UpdateTrayAndBubble() {
1064 UpdateTray(); 1050 UpdateTray();
1065 1051
1066 if (message_center_bubble()) 1052 if (message_center_bubble())
1067 message_center_bubble()->ScheduleUpdate(); 1053 message_center_bubble()->ScheduleUpdate();
1068 1054
(...skipping 11 matching lines...) Expand all
1080 } else if (bubble == notification_bubble()) { 1066 } else if (bubble == notification_bubble()) {
1081 HideNotificationBubble(); 1067 HideNotificationBubble();
1082 } 1068 }
1083 } 1069 }
1084 1070
1085 bool WebNotificationTray::HasNotificationForTest(const std::string& id) const { 1071 bool WebNotificationTray::HasNotificationForTest(const std::string& id) const {
1086 return notification_list_->HasNotification(id); 1072 return notification_list_->HasNotification(id);
1087 } 1073 }
1088 1074
1089 } // namespace ash 1075 } // namespace ash
OLDNEW
« no previous file with comments | « ash/system/web_notification/web_notification_tray.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698