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/shell.h" | 10 #include "ash/shell.h" |
(...skipping 570 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
581 height = std::max( | 581 height = std::max( |
582 0, work_area.height() - bubble_view->GetBoundsInScreen().y()); | 582 0, work_area.height() - bubble_view->GetBoundsInScreen().y()); |
583 } else { | 583 } else { |
584 height = std::max( | 584 height = std::max( |
585 0, bubble_view->GetBoundsInScreen().bottom() - work_area.y()); | 585 0, bubble_view->GetBoundsInScreen().bottom() - work_area.y()); |
586 } | 586 } |
587 } | 587 } |
588 status_area_widget()->web_notification_tray()->SetSystemTrayHeight(height); | 588 status_area_widget()->web_notification_tray()->SetSystemTrayHeight(height); |
589 } | 589 } |
590 | 590 |
591 base::string16 SystemTray::GetAccessibleTimeString( | |
592 const base::Time& now) const { | |
593 base::HourClockType hour_type = | |
594 ash::Shell::GetInstance()->system_tray_delegate()->GetHourClockType(); | |
595 return base::TimeFormatTimeOfDayWithHourClockType( | |
Peter Lundblad
2014/07/09 23:08:11
Just to make sure, can you try this with the setti
evy
2014/07/10 17:19:57
24 hour time is read very strange (oh nine. one on
| |
596 now, hour_type, base::kKeepAmPm); | |
597 } | |
598 | |
591 void SystemTray::SetShelfAlignment(ShelfAlignment alignment) { | 599 void SystemTray::SetShelfAlignment(ShelfAlignment alignment) { |
592 if (alignment == shelf_alignment()) | 600 if (alignment == shelf_alignment()) |
593 return; | 601 return; |
594 TrayBackgroundView::SetShelfAlignment(alignment); | 602 TrayBackgroundView::SetShelfAlignment(alignment); |
595 UpdateAfterShelfAlignmentChange(alignment); | 603 UpdateAfterShelfAlignmentChange(alignment); |
596 // Destroy any existing bubble so that it is rebuilt correctly. | 604 // Destroy any existing bubble so that it is rebuilt correctly. |
597 CloseSystemBubbleAndDeactivateSystemTray(); | 605 CloseSystemBubbleAndDeactivateSystemTray(); |
598 // Rebuild any notification bubble. | 606 // Rebuild any notification bubble. |
599 if (notification_bubble_) { | 607 if (notification_bubble_) { |
600 notification_bubble_.reset(); | 608 notification_bubble_.reset(); |
601 UpdateNotificationBubble(); | 609 UpdateNotificationBubble(); |
602 } | 610 } |
603 } | 611 } |
604 | 612 |
605 void SystemTray::AnchorUpdated() { | 613 void SystemTray::AnchorUpdated() { |
606 if (notification_bubble_) { | 614 if (notification_bubble_) { |
607 notification_bubble_->bubble_view()->UpdateBubble(); | 615 notification_bubble_->bubble_view()->UpdateBubble(); |
608 // Ensure that the notification buble is above the shelf/status area. | 616 // Ensure that the notification buble is above the shelf/status area. |
609 notification_bubble_->bubble_view()->GetWidget()->StackAtTop(); | 617 notification_bubble_->bubble_view()->GetWidget()->StackAtTop(); |
610 UpdateBubbleViewArrow(notification_bubble_->bubble_view()); | 618 UpdateBubbleViewArrow(notification_bubble_->bubble_view()); |
611 } | 619 } |
612 if (system_bubble_) { | 620 if (system_bubble_) { |
613 system_bubble_->bubble_view()->UpdateBubble(); | 621 system_bubble_->bubble_view()->UpdateBubble(); |
614 UpdateBubbleViewArrow(system_bubble_->bubble_view()); | 622 UpdateBubbleViewArrow(system_bubble_->bubble_view()); |
615 } | 623 } |
616 } | 624 } |
617 | 625 |
618 base::string16 SystemTray::GetAccessibleNameForTray() { | 626 base::string16 SystemTray::GetAccessibleNameForTray() { |
619 return l10n_util::GetStringUTF16(IDS_ASH_STATUS_TRAY_ACCESSIBLE_NAME); | 627 base::string16 name = |
628 l10n_util::GetStringUTF16(IDS_ASH_STATUS_TRAY_ACCESSIBLE_NAME); | |
629 base::string16 time = GetAccessibleTimeString(base::Time::Now()); | |
630 base::string16 battery = PowerStatus::Get()->GetShortAccessibleNameString(); | |
631 return name + base::ASCIIToUTF16(". ") + | |
dmazzoni
2014/07/10 16:23:16
This is borderline, but this is usually the best p
evy
2014/07/10 17:19:57
Done.
| |
632 time + base::ASCIIToUTF16(". ") + | |
633 battery; | |
620 } | 634 } |
621 | 635 |
622 void SystemTray::BubbleResized(const TrayBubbleView* bubble_view) { | 636 void SystemTray::BubbleResized(const TrayBubbleView* bubble_view) { |
623 UpdateWebNotifications(); | 637 UpdateWebNotifications(); |
624 } | 638 } |
625 | 639 |
626 void SystemTray::HideBubbleWithView(const TrayBubbleView* bubble_view) { | 640 void SystemTray::HideBubbleWithView(const TrayBubbleView* bubble_view) { |
627 if (system_bubble_.get() && bubble_view == system_bubble_->bubble_view()) { | 641 if (system_bubble_.get() && bubble_view == system_bubble_->bubble_view()) { |
628 DestroySystemBubble(); | 642 DestroySystemBubble(); |
629 UpdateNotificationBubble(); // State changed, re-create notifications. | 643 UpdateNotificationBubble(); // State changed, re-create notifications. |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
707 system_bubble_.reset(); | 721 system_bubble_.reset(); |
708 // When closing a system bubble with the alternate shelf layout, we need to | 722 // When closing a system bubble with the alternate shelf layout, we need to |
709 // turn off the active tinting of the shelf. | 723 // turn off the active tinting of the shelf. |
710 if (full_system_tray_menu_) { | 724 if (full_system_tray_menu_) { |
711 SetDrawBackgroundAsActive(false); | 725 SetDrawBackgroundAsActive(false); |
712 full_system_tray_menu_ = false; | 726 full_system_tray_menu_ = false; |
713 } | 727 } |
714 } | 728 } |
715 | 729 |
716 } // namespace ash | 730 } // namespace ash |
OLD | NEW |