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/ash_switches.h" | 7 #include "ash/ash_switches.h" |
8 #include "ash/metrics/user_metrics_recorder.h" | 8 #include "ash/metrics/user_metrics_recorder.h" |
9 #include "ash/shelf/shelf_layout_manager.h" | 9 #include "ash/shelf/shelf_layout_manager.h" |
10 #include "ash/shelf/shelf_util.h" | 10 #include "ash/shelf/shelf_util.h" |
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
317 | 317 |
318 // Items default to SHELF_ALIGNMENT_BOTTOM. Update them if the initial | 318 // Items default to SHELF_ALIGNMENT_BOTTOM. Update them if the initial |
319 // position of the shelf differs. | 319 // position of the shelf differs. |
320 if (!IsHorizontalAlignment(shelf_alignment())) | 320 if (!IsHorizontalAlignment(shelf_alignment())) |
321 UpdateAfterShelfAlignmentChange(shelf_alignment()); | 321 UpdateAfterShelfAlignmentChange(shelf_alignment()); |
322 | 322 |
323 SetVisible(true); | 323 SetVisible(true); |
324 PreferredSizeChanged(); | 324 PreferredSizeChanged(); |
325 } | 325 } |
326 | 326 |
327 void SystemTray::UpdateAfterShelfAlignmentChange(ShelfAlignment alignment) { | 327 void SystemTray::UpdateAfterShelfAlignmentChange(wm::ShelfAlignment alignment) { |
328 for (SystemTrayItem* item : items_) | 328 for (SystemTrayItem* item : items_) |
329 item->UpdateAfterShelfAlignmentChange(alignment); | 329 item->UpdateAfterShelfAlignmentChange(alignment); |
330 } | 330 } |
331 | 331 |
332 void SystemTray::SetHideNotifications(bool hide_notifications) { | 332 void SystemTray::SetHideNotifications(bool hide_notifications) { |
333 if (notification_bubble_) | 333 if (notification_bubble_) |
334 notification_bubble_->bubble()->SetVisible(!hide_notifications); | 334 notification_bubble_->bubble()->SetVisible(!hide_notifications); |
335 hide_notifications_ = hide_notifications; | 335 hide_notifications_ = hide_notifications; |
336 } | 336 } |
337 | 337 |
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
604 } | 604 } |
605 | 605 |
606 base::string16 SystemTray::GetAccessibleTimeString( | 606 base::string16 SystemTray::GetAccessibleTimeString( |
607 const base::Time& now) const { | 607 const base::Time& now) const { |
608 base::HourClockType hour_type = | 608 base::HourClockType hour_type = |
609 ash::Shell::GetInstance()->system_tray_delegate()->GetHourClockType(); | 609 ash::Shell::GetInstance()->system_tray_delegate()->GetHourClockType(); |
610 return base::TimeFormatTimeOfDayWithHourClockType( | 610 return base::TimeFormatTimeOfDayWithHourClockType( |
611 now, hour_type, base::kKeepAmPm); | 611 now, hour_type, base::kKeepAmPm); |
612 } | 612 } |
613 | 613 |
614 void SystemTray::SetShelfAlignment(ShelfAlignment alignment) { | 614 void SystemTray::SetShelfAlignment(wm::ShelfAlignment alignment) { |
615 if (alignment == shelf_alignment()) | 615 if (alignment == shelf_alignment()) |
616 return; | 616 return; |
617 TrayBackgroundView::SetShelfAlignment(alignment); | 617 TrayBackgroundView::SetShelfAlignment(alignment); |
618 UpdateAfterShelfAlignmentChange(alignment); | 618 UpdateAfterShelfAlignmentChange(alignment); |
619 // Destroy any existing bubble so that it is rebuilt correctly. | 619 // Destroy any existing bubble so that it is rebuilt correctly. |
620 CloseSystemBubbleAndDeactivateSystemTray(); | 620 CloseSystemBubbleAndDeactivateSystemTray(); |
621 // Rebuild any notification bubble. | 621 // Rebuild any notification bubble. |
622 if (notification_bubble_) { | 622 if (notification_bubble_) { |
623 notification_bubble_.reset(); | 623 notification_bubble_.reset(); |
624 UpdateNotificationBubble(); | 624 UpdateNotificationBubble(); |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
727 system_bubble_.reset(); | 727 system_bubble_.reset(); |
728 // When closing a system bubble with the alternate shelf layout, we need to | 728 // When closing a system bubble with the alternate shelf layout, we need to |
729 // turn off the active tinting of the shelf. | 729 // turn off the active tinting of the shelf. |
730 if (full_system_tray_menu_) { | 730 if (full_system_tray_menu_) { |
731 SetDrawBackgroundAsActive(false); | 731 SetDrawBackgroundAsActive(false); |
732 full_system_tray_menu_ = false; | 732 full_system_tray_menu_ = false; |
733 } | 733 } |
734 } | 734 } |
735 | 735 |
736 } // namespace ash | 736 } // namespace ash |
OLD | NEW |