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