| 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/common/system/tray/system_tray.h" | 5 #include "ash/common/system/tray/system_tray.h" |
| 6 | 6 |
| 7 #include "ash/common/key_event_watcher.h" | 7 #include "ash/common/key_event_watcher.h" |
| 8 #include "ash/common/login_status.h" | 8 #include "ash/common/login_status.h" |
| 9 #include "ash/common/material_design/material_design_controller.h" | 9 #include "ash/common/material_design/material_design_controller.h" |
| 10 #include "ash/common/session/session_state_delegate.h" | 10 #include "ash/common/session/session_state_delegate.h" |
| (...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 210 full_system_tray_menu_(false), | 210 full_system_tray_menu_(false), |
| 211 tray_accessibility_(nullptr), | 211 tray_accessibility_(nullptr), |
| 212 tray_audio_(nullptr), | 212 tray_audio_(nullptr), |
| 213 tray_cast_(nullptr), | 213 tray_cast_(nullptr), |
| 214 tray_date_(nullptr), | 214 tray_date_(nullptr), |
| 215 tray_tiles_(nullptr), | 215 tray_tiles_(nullptr), |
| 216 tray_system_info_(nullptr), | 216 tray_system_info_(nullptr), |
| 217 tray_update_(nullptr), | 217 tray_update_(nullptr), |
| 218 screen_capture_tray_item_(nullptr), | 218 screen_capture_tray_item_(nullptr), |
| 219 screen_share_tray_item_(nullptr) { | 219 screen_share_tray_item_(nullptr) { |
| 220 SetContentsBackground(); | 220 SetContentsBackground(true); |
| 221 } | 221 } |
| 222 | 222 |
| 223 SystemTray::~SystemTray() { | 223 SystemTray::~SystemTray() { |
| 224 // Destroy any child views that might have back pointers before ~View(). | 224 // Destroy any child views that might have back pointers before ~View(). |
| 225 activation_observer_.reset(); | 225 activation_observer_.reset(); |
| 226 key_event_watcher_.reset(); | 226 key_event_watcher_.reset(); |
| 227 system_bubble_.reset(); | 227 system_bubble_.reset(); |
| 228 notification_bubble_.reset(); | 228 notification_bubble_.reset(); |
| 229 for (std::vector<SystemTrayItem*>::iterator it = items_.begin(); | 229 for (std::vector<SystemTrayItem*>::iterator it = items_.begin(); |
| 230 it != items_.end(); ++it) { | 230 it != items_.end(); ++it) { |
| (...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 648 detailed_item_ = NULL; | 648 detailed_item_ = NULL; |
| 649 | 649 |
| 650 UpdateNotificationBubble(); // State changed, re-create notifications. | 650 UpdateNotificationBubble(); // State changed, re-create notifications. |
| 651 if (!notification_bubble_) | 651 if (!notification_bubble_) |
| 652 UpdateWebNotifications(); | 652 UpdateWebNotifications(); |
| 653 shelf()->UpdateAutoHideState(); | 653 shelf()->UpdateAutoHideState(); |
| 654 | 654 |
| 655 // When we show the system menu in our alternate shelf layout, we need to | 655 // When we show the system menu in our alternate shelf layout, we need to |
| 656 // tint the background. | 656 // tint the background. |
| 657 if (full_system_tray_menu_) | 657 if (full_system_tray_menu_) |
| 658 SetDrawBackgroundAsActive(true); | 658 SetIsActive(true); |
| 659 } | 659 } |
| 660 | 660 |
| 661 void SystemTray::UpdateNotificationBubble() { | 661 void SystemTray::UpdateNotificationBubble() { |
| 662 // Only show the notification bubble if we have notifications. | 662 // Only show the notification bubble if we have notifications. |
| 663 if (notification_items_.empty()) { | 663 if (notification_items_.empty()) { |
| 664 DestroyNotificationBubble(); | 664 DestroyNotificationBubble(); |
| 665 return; | 665 return; |
| 666 } | 666 } |
| 667 // Destroy the existing bubble before constructing a new one. | 667 // Destroy the existing bubble before constructing a new one. |
| 668 notification_bubble_.reset(); | 668 notification_bubble_.reset(); |
| (...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 918 } | 918 } |
| 919 | 919 |
| 920 void SystemTray::CloseSystemBubbleAndDeactivateSystemTray() { | 920 void SystemTray::CloseSystemBubbleAndDeactivateSystemTray() { |
| 921 CHECK(!activating_); | 921 CHECK(!activating_); |
| 922 activation_observer_.reset(); | 922 activation_observer_.reset(); |
| 923 key_event_watcher_.reset(); | 923 key_event_watcher_.reset(); |
| 924 system_bubble_.reset(); | 924 system_bubble_.reset(); |
| 925 // When closing a system bubble with the alternate shelf layout, we need to | 925 // When closing a system bubble with the alternate shelf layout, we need to |
| 926 // turn off the active tinting of the shelf. | 926 // turn off the active tinting of the shelf. |
| 927 if (full_system_tray_menu_) { | 927 if (full_system_tray_menu_) { |
| 928 SetDrawBackgroundAsActive(false); | 928 SetIsActive(false); |
| 929 full_system_tray_menu_ = false; | 929 full_system_tray_menu_ = false; |
| 930 } | 930 } |
| 931 } | 931 } |
| 932 | 932 |
| 933 void SystemTray::RecordSystemMenuMetrics() { | 933 void SystemTray::RecordSystemMenuMetrics() { |
| 934 DCHECK(system_bubble_); | 934 DCHECK(system_bubble_); |
| 935 | 935 |
| 936 system_bubble_->bubble()->RecordVisibleRowMetrics(); | 936 system_bubble_->bubble()->RecordVisibleRowMetrics(); |
| 937 | 937 |
| 938 TrayBubbleView* bubble_view = system_bubble_->bubble_view(); | 938 TrayBubbleView* bubble_view = system_bubble_->bubble_view(); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 951 .work_area() | 951 .work_area() |
| 952 .height(); | 952 .height(); |
| 953 if (work_area_height > 0) { | 953 if (work_area_height > 0) { |
| 954 UMA_HISTOGRAM_CUSTOM_COUNTS( | 954 UMA_HISTOGRAM_CUSTOM_COUNTS( |
| 955 "Ash.SystemMenu.PercentageOfWorkAreaHeightCoveredByMenu", | 955 "Ash.SystemMenu.PercentageOfWorkAreaHeightCoveredByMenu", |
| 956 100 * bubble_view->height() / work_area_height, 1, 300, 100); | 956 100 * bubble_view->height() / work_area_height, 1, 300, 100); |
| 957 } | 957 } |
| 958 } | 958 } |
| 959 | 959 |
| 960 } // namespace ash | 960 } // namespace ash |
| OLD | NEW |