| 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 <algorithm> | 7 #include <algorithm> |
| 8 #include <map> | 8 #include <map> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 200 } | 200 } |
| 201 | 201 |
| 202 private: | 202 private: |
| 203 SystemTray* tray_; | 203 SystemTray* tray_; |
| 204 | 204 |
| 205 DISALLOW_COPY_AND_ASSIGN(ActivationObserver); | 205 DISALLOW_COPY_AND_ASSIGN(ActivationObserver); |
| 206 }; | 206 }; |
| 207 | 207 |
| 208 // SystemTray | 208 // SystemTray |
| 209 | 209 |
| 210 SystemTray::SystemTray(WmShelf* wm_shelf) | 210 SystemTray::SystemTray(WmShelf* wm_shelf) : TrayBackgroundView(wm_shelf, true) { |
| 211 : TrayBackgroundView(wm_shelf, true), | |
| 212 web_notification_tray_(nullptr), | |
| 213 detailed_item_(nullptr), | |
| 214 default_bubble_height_(0), | |
| 215 full_system_tray_menu_(false), | |
| 216 tray_accessibility_(nullptr), | |
| 217 tray_audio_(nullptr), | |
| 218 tray_cast_(nullptr), | |
| 219 tray_network_(nullptr), | |
| 220 tray_tiles_(nullptr), | |
| 221 tray_system_info_(nullptr), | |
| 222 tray_update_(nullptr), | |
| 223 screen_capture_tray_item_(nullptr), | |
| 224 screen_share_tray_item_(nullptr) { | |
| 225 SetInkDropMode(InkDropMode::ON); | 211 SetInkDropMode(InkDropMode::ON); |
| 226 | 212 |
| 227 // Since user avatar is on the right hand side of System tray of a | 213 // Since user avatar is on the right hand side of System tray of a |
| 228 // horizontal shelf and that is sufficient to indicate separation, no | 214 // horizontal shelf and that is sufficient to indicate separation, no |
| 229 // separator is required. | 215 // separator is required. |
| 230 set_separator_visibility(false); | 216 set_separator_visibility(false); |
| 231 } | 217 } |
| 232 | 218 |
| 233 SystemTray::~SystemTray() { | 219 SystemTray::~SystemTray() { |
| 234 // Destroy any child views that might have back pointers before ~View(). | 220 // Destroy any child views that might have back pointers before ~View(). |
| (...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 689 TrayBubbleView* bubble_view = GetSystemBubble()->bubble_view(); | 675 TrayBubbleView* bubble_view = GetSystemBubble()->bubble_view(); |
| 690 // If system tray bubble is in the process of closing, do not try to activate | 676 // If system tray bubble is in the process of closing, do not try to activate |
| 691 // bubble. | 677 // bubble. |
| 692 if (bubble_view->GetWidget()->IsClosed()) | 678 if (bubble_view->GetWidget()->IsClosed()) |
| 693 return; | 679 return; |
| 694 bubble_view->set_can_activate(true); | 680 bubble_view->set_can_activate(true); |
| 695 bubble_view->GetWidget()->Activate(); | 681 bubble_view->GetWidget()->Activate(); |
| 696 } | 682 } |
| 697 | 683 |
| 698 bool SystemTray::PerformAction(const ui::Event& event) { | 684 bool SystemTray::PerformAction(const ui::Event& event) { |
| 699 // If we're already showing the menu, hide it; otherwise, show it (and hide | 685 // If we're already showing the default view or detailed view in system menu, |
| 700 // any popup that's currently shown). | 686 // hide it; otherwise, show it (and hide any popup that's currently shown). |
| 701 if (HasSystemBubble()) { | 687 if (HasSystemBubbleType(SystemTrayBubble::BUBBLE_TYPE_DEFAULT) || |
| 688 (HasSystemBubbleType(SystemTrayBubble::BUBBLE_TYPE_DETAILED) && |
| 689 full_system_tray_menu_)) { |
| 702 system_bubble_->bubble()->Close(); | 690 system_bubble_->bubble()->Close(); |
| 703 } else { | 691 } else { |
| 704 ShowDefaultView(BUBBLE_CREATE_NEW); | 692 ShowDefaultView(BUBBLE_CREATE_NEW); |
| 705 if (event.IsKeyEvent() || (event.flags() & ui::EF_TOUCH_ACCESSIBILITY)) | 693 if (event.IsKeyEvent() || (event.flags() & ui::EF_TOUCH_ACCESSIBILITY)) |
| 706 ActivateBubble(); | 694 ActivateBubble(); |
| 707 } | 695 } |
| 708 return true; | 696 return true; |
| 709 } | 697 } |
| 710 | 698 |
| 711 void SystemTray::CloseSystemBubbleAndDeactivateSystemTray() { | 699 void SystemTray::CloseSystemBubbleAndDeactivateSystemTray() { |
| (...skipping 29 matching lines...) Expand all Loading... |
| 741 .work_area() | 729 .work_area() |
| 742 .height(); | 730 .height(); |
| 743 if (work_area_height > 0) { | 731 if (work_area_height > 0) { |
| 744 UMA_HISTOGRAM_CUSTOM_COUNTS( | 732 UMA_HISTOGRAM_CUSTOM_COUNTS( |
| 745 "Ash.SystemMenu.PercentageOfWorkAreaHeightCoveredByMenu", | 733 "Ash.SystemMenu.PercentageOfWorkAreaHeightCoveredByMenu", |
| 746 100 * bubble_view->height() / work_area_height, 1, 300, 100); | 734 100 * bubble_view->height() / work_area_height, 1, 300, 100); |
| 747 } | 735 } |
| 748 } | 736 } |
| 749 | 737 |
| 750 } // namespace ash | 738 } // namespace ash |
| OLD | NEW |