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

Side by Side Diff: ash/system/tray/system_tray.cc

Issue 2072023003: mash: Break ash system tray dependencies on ash::ShelfWidget (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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
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/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/common/session/session_state_delegate.h"
9 #include "ash/common/shelf/wm_shelf.h"
8 #include "ash/common/shelf/wm_shelf_util.h" 10 #include "ash/common/shelf/wm_shelf_util.h"
9 #include "ash/common/shell_window_ids.h" 11 #include "ash/common/shell_window_ids.h"
10 #include "ash/common/system/date/tray_date.h" 12 #include "ash/common/system/date/tray_date.h"
11 #include "ash/common/system/tray/system_tray_delegate.h" 13 #include "ash/common/system/tray/system_tray_delegate.h"
12 #include "ash/common/system/tray/system_tray_item.h" 14 #include "ash/common/system/tray/system_tray_item.h"
13 #include "ash/common/system/tray/tray_constants.h" 15 #include "ash/common/system/tray/tray_constants.h"
14 #include "ash/common/system/update/tray_update.h" 16 #include "ash/common/system/update/tray_update.h"
15 #include "ash/common/wm_shell.h" 17 #include "ash/common/wm_shell.h"
16 #include "ash/metrics/user_metrics_recorder.h" 18 #include "ash/metrics/user_metrics_recorder.h"
17 #include "ash/shelf/shelf_layout_manager.h"
18 #include "ash/shelf/shelf_util.h"
19 #include "ash/shell.h" 19 #include "ash/shell.h"
20 #include "ash/system/audio/tray_audio.h" 20 #include "ash/system/audio/tray_audio.h"
21 #include "ash/system/cast/tray_cast.h" 21 #include "ash/system/cast/tray_cast.h"
22 #include "ash/system/status_area_widget.h" 22 #include "ash/system/status_area_widget.h"
23 #include "ash/system/tray/tray_bubble_wrapper.h" 23 #include "ash/system/tray/tray_bubble_wrapper.h"
24 #include "ash/system/tray_accessibility.h" 24 #include "ash/system/tray_accessibility.h"
25 #include "ash/system/user/login_status.h" 25 #include "ash/system/user/login_status.h"
26 #include "ash/system/user/tray_user.h" 26 #include "ash/system/user/tray_user.h"
27 #include "ash/system/user/tray_user_separator.h" 27 #include "ash/system/user/tray_user_separator.h"
28 #include "ash/system/web_notification/web_notification_tray.h" 28 #include "ash/system/web_notification/web_notification_tray.h"
(...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after
524 default_bubble_height_ = system_bubble_->bubble_view()->height(); 524 default_bubble_height_ = system_bubble_->bubble_view()->height();
525 525
526 if (detailed && items.size() > 0) 526 if (detailed && items.size() > 0)
527 detailed_item_ = items[0]; 527 detailed_item_ = items[0];
528 else 528 else
529 detailed_item_ = NULL; 529 detailed_item_ = NULL;
530 530
531 UpdateNotificationBubble(); // State changed, re-create notifications. 531 UpdateNotificationBubble(); // State changed, re-create notifications.
532 if (!notification_bubble_) 532 if (!notification_bubble_)
533 UpdateWebNotifications(); 533 UpdateWebNotifications();
534 GetShelfLayoutManager()->UpdateAutoHideState(); 534 GetShelf()->UpdateAutoHideState();
535 535
536 // When we show the system menu in our alternate shelf layout, we need to 536 // When we show the system menu in our alternate shelf layout, we need to
537 // tint the background. 537 // tint the background.
538 if (full_system_tray_menu_) 538 if (full_system_tray_menu_)
539 SetDrawBackgroundAsActive(true); 539 SetDrawBackgroundAsActive(true);
540 } 540 }
541 541
542 void SystemTray::UpdateNotificationBubble() { 542 void SystemTray::UpdateNotificationBubble() {
543 // Only show the notification bubble if we have notifications. 543 // Only show the notification bubble if we have notifications.
544 if (notification_items_.empty()) { 544 if (notification_items_.empty()) {
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
644 } 644 }
645 645
646 void SystemTray::BubbleResized(const TrayBubbleView* bubble_view) { 646 void SystemTray::BubbleResized(const TrayBubbleView* bubble_view) {
647 UpdateWebNotifications(); 647 UpdateWebNotifications();
648 } 648 }
649 649
650 void SystemTray::HideBubbleWithView(const TrayBubbleView* bubble_view) { 650 void SystemTray::HideBubbleWithView(const TrayBubbleView* bubble_view) {
651 if (system_bubble_.get() && bubble_view == system_bubble_->bubble_view()) { 651 if (system_bubble_.get() && bubble_view == system_bubble_->bubble_view()) {
652 DestroySystemBubble(); 652 DestroySystemBubble();
653 UpdateNotificationBubble(); // State changed, re-create notifications. 653 UpdateNotificationBubble(); // State changed, re-create notifications.
654 GetShelfLayoutManager()->UpdateAutoHideState(); 654 GetShelf()->UpdateAutoHideState();
655 } else if (notification_bubble_.get() && 655 } else if (notification_bubble_.get() &&
656 bubble_view == notification_bubble_->bubble_view()) { 656 bubble_view == notification_bubble_->bubble_view()) {
657 DestroyNotificationBubble(); 657 DestroyNotificationBubble();
658 } 658 }
659 } 659 }
660 660
661 void SystemTray::ClickedOutsideBubble() { 661 void SystemTray::ClickedOutsideBubble() {
662 if (!system_bubble_ || system_bubble_->is_persistent()) 662 if (!system_bubble_ || system_bubble_->is_persistent())
663 return; 663 return;
664 HideBubbleWithView(system_bubble_->bubble_view()); 664 HideBubbleWithView(system_bubble_->bubble_view());
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
760 .work_area() 760 .work_area()
761 .height(); 761 .height();
762 if (work_area_height > 0) { 762 if (work_area_height > 0) {
763 UMA_HISTOGRAM_CUSTOM_COUNTS( 763 UMA_HISTOGRAM_CUSTOM_COUNTS(
764 "Ash.SystemMenu.PercentageOfWorkAreaHeightCoveredByMenu", 764 "Ash.SystemMenu.PercentageOfWorkAreaHeightCoveredByMenu",
765 100 * bubble_view->height() / work_area_height, 1, 300, 100); 765 100 * bubble_view->height() / work_area_height, 1, 300, 100);
766 } 766 }
767 } 767 }
768 768
769 } // namespace ash 769 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698