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/tray/system_tray.h" | 5 #include "ash/system/tray/system_tray.h" |
6 | 6 |
7 #include "ash/common/ash_switches.h" | 7 #include "ash/common/ash_switches.h" |
8 #include "ash/common/login_status.h" | 8 #include "ash/common/login_status.h" |
9 #include "ash/common/session/session_state_delegate.h" | 9 #include "ash/common/session/session_state_delegate.h" |
10 #include "ash/common/shelf/wm_shelf.h" | 10 #include "ash/common/shelf/wm_shelf.h" |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 SystemTray::~SystemTray() { | 145 SystemTray::~SystemTray() { |
146 // Destroy any child views that might have back pointers before ~View(). | 146 // Destroy any child views that might have back pointers before ~View(). |
147 system_bubble_.reset(); | 147 system_bubble_.reset(); |
148 notification_bubble_.reset(); | 148 notification_bubble_.reset(); |
149 for (std::vector<SystemTrayItem*>::iterator it = items_.begin(); | 149 for (std::vector<SystemTrayItem*>::iterator it = items_.begin(); |
150 it != items_.end(); ++it) { | 150 it != items_.end(); ++it) { |
151 (*it)->DestroyTrayView(); | 151 (*it)->DestroyTrayView(); |
152 } | 152 } |
153 } | 153 } |
154 | 154 |
155 void SystemTray::InitializeTrayItems( | 155 void SystemTray::InitializeTrayItems(SystemTrayDelegate* delegate, |
156 SystemTrayDelegate* delegate, | 156 WebNotificationTray* web_notification_tray, |
157 WebNotificationTray* web_notification_tray) { | 157 const gfx::Insets& insets) { |
158 DCHECK(web_notification_tray); | 158 DCHECK(web_notification_tray); |
159 web_notification_tray_ = web_notification_tray; | 159 web_notification_tray_ = web_notification_tray; |
160 TrayBackgroundView::Initialize(); | 160 TrayBackgroundView::Initialize(insets); |
161 CreateItems(delegate); | 161 CreateItems(delegate); |
162 } | 162 } |
163 | 163 |
164 void SystemTray::Shutdown() { | 164 void SystemTray::Shutdown() { |
165 DCHECK(web_notification_tray_); | 165 DCHECK(web_notification_tray_); |
166 web_notification_tray_ = nullptr; | 166 web_notification_tray_ = nullptr; |
167 } | 167 } |
168 | 168 |
169 void SystemTray::CreateItems(SystemTrayDelegate* delegate) { | 169 void SystemTray::CreateItems(SystemTrayDelegate* delegate) { |
170 WmShell* wm_shell = WmShell::Get(); | 170 WmShell* wm_shell = WmShell::Get(); |
(...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
599 } | 599 } |
600 | 600 |
601 base::string16 SystemTray::GetAccessibleTimeString( | 601 base::string16 SystemTray::GetAccessibleTimeString( |
602 const base::Time& now) const { | 602 const base::Time& now) const { |
603 base::HourClockType hour_type = | 603 base::HourClockType hour_type = |
604 WmShell::Get()->system_tray_delegate()->GetHourClockType(); | 604 WmShell::Get()->system_tray_delegate()->GetHourClockType(); |
605 return base::TimeFormatTimeOfDayWithHourClockType(now, hour_type, | 605 return base::TimeFormatTimeOfDayWithHourClockType(now, hour_type, |
606 base::kKeepAmPm); | 606 base::kKeepAmPm); |
607 } | 607 } |
608 | 608 |
609 void SystemTray::SetShelfAlignment(ShelfAlignment alignment) { | 609 void SystemTray::SetShelfAlignment(ShelfAlignment alignment, |
| 610 const gfx::Insets& insets) { |
610 if (alignment == shelf_alignment()) | 611 if (alignment == shelf_alignment()) |
611 return; | 612 return; |
612 TrayBackgroundView::SetShelfAlignment(alignment); | 613 TrayBackgroundView::SetShelfAlignment(alignment, insets); |
613 UpdateAfterShelfAlignmentChange(alignment); | 614 UpdateAfterShelfAlignmentChange(alignment); |
614 // Destroy any existing bubble so that it is rebuilt correctly. | 615 // Destroy any existing bubble so that it is rebuilt correctly. |
615 CloseSystemBubbleAndDeactivateSystemTray(); | 616 CloseSystemBubbleAndDeactivateSystemTray(); |
616 // Rebuild any notification bubble. | 617 // Rebuild any notification bubble. |
617 if (notification_bubble_) { | 618 if (notification_bubble_) { |
618 notification_bubble_.reset(); | 619 notification_bubble_.reset(); |
619 UpdateNotificationBubble(); | 620 UpdateNotificationBubble(); |
620 // UpdateWebNotifications() should be called in UpdateNotificationBubble(). | 621 // UpdateWebNotifications() should be called in UpdateNotificationBubble(). |
621 } else if (!hide_notifications_) { | 622 } else if (!hide_notifications_) { |
622 UpdateWebNotifications(); | 623 UpdateWebNotifications(); |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
769 .work_area() | 770 .work_area() |
770 .height(); | 771 .height(); |
771 if (work_area_height > 0) { | 772 if (work_area_height > 0) { |
772 UMA_HISTOGRAM_CUSTOM_COUNTS( | 773 UMA_HISTOGRAM_CUSTOM_COUNTS( |
773 "Ash.SystemMenu.PercentageOfWorkAreaHeightCoveredByMenu", | 774 "Ash.SystemMenu.PercentageOfWorkAreaHeightCoveredByMenu", |
774 100 * bubble_view->height() / work_area_height, 1, 300, 100); | 775 100 * bubble_view->height() / work_area_height, 1, 300, 100); |
775 } | 776 } |
776 } | 777 } |
777 | 778 |
778 } // namespace ash | 779 } // namespace ash |
OLD | NEW |