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 <algorithm> | 7 #include <algorithm> |
8 #include <map> | 8 #include <map> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 } | 109 } |
110 | 110 |
111 DISALLOW_COPY_AND_ASSIGN(PaddingView); | 111 DISALLOW_COPY_AND_ASSIGN(PaddingView); |
112 }; | 112 }; |
113 | 113 |
114 DISALLOW_COPY_AND_ASSIGN(PaddingTrayItem); | 114 DISALLOW_COPY_AND_ASSIGN(PaddingTrayItem); |
115 }; | 115 }; |
116 | 116 |
117 } // namespace | 117 } // namespace |
118 | 118 |
119 // The minimum width of the system tray menu. | |
120 const int kMinimumSystemTrayMenuWidth = 300; | |
121 const int kMinimumSystemTrayMenuWidthMd = 352; | |
122 | |
123 // Class to initialize and manage the SystemTrayBubble and TrayBubbleWrapper | 119 // Class to initialize and manage the SystemTrayBubble and TrayBubbleWrapper |
124 // instances for a bubble. | 120 // instances for a bubble. |
125 | 121 |
126 class SystemBubbleWrapper { | 122 class SystemBubbleWrapper { |
127 public: | 123 public: |
128 // Takes ownership of |bubble|. | 124 // Takes ownership of |bubble|. |
129 explicit SystemBubbleWrapper(SystemTrayBubble* bubble) | 125 explicit SystemBubbleWrapper(SystemTrayBubble* bubble) |
130 : bubble_(bubble), is_persistent_(false) {} | 126 : bubble_(bubble), is_persistent_(false) {} |
131 | 127 |
132 // Initializes the bubble view and creates |bubble_wrapper_|. | 128 // Initializes the bubble view and creates |bubble_wrapper_|. |
(...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
571 DestroySystemBubble(); | 567 DestroySystemBubble(); |
572 | 568 |
573 // Remember if the menu is a single property (like e.g. volume) or the | 569 // Remember if the menu is a single property (like e.g. volume) or the |
574 // full tray menu. Note that in case of the |BUBBLE_USE_EXISTING| case | 570 // full tray menu. Note that in case of the |BUBBLE_USE_EXISTING| case |
575 // above, |full_system_tray_menu_| does not get changed since the fact that | 571 // above, |full_system_tray_menu_| does not get changed since the fact that |
576 // the menu is full (or not) doesn't change even if a "single property" | 572 // the menu is full (or not) doesn't change even if a "single property" |
577 // (like network) replaces most of the menu. | 573 // (like network) replaces most of the menu. |
578 full_system_tray_menu_ = items.size() > 1; | 574 full_system_tray_menu_ = items.size() > 1; |
579 | 575 |
580 // The menu width is fixed for all languages in material design. | 576 // The menu width is fixed for all languages in material design. |
581 int menu_width = kMinimumSystemTrayMenuWidthMd; | 577 int menu_width = kTrayMenuMinimumWidthMd; |
582 if (!MaterialDesignController::IsSystemTrayMenuMaterial()) { | 578 if (!MaterialDesignController::IsSystemTrayMenuMaterial()) { |
583 // The menu width is fixed, and it is a per language setting. | 579 // The menu width is fixed, and it is a per language setting. |
584 menu_width = std::max( | 580 menu_width = std::max( |
585 kMinimumSystemTrayMenuWidth, | 581 kTrayMenuMinimumWidth, |
586 WmShell::Get()->system_tray_delegate()->GetSystemTrayMenuWidth()); | 582 WmShell::Get()->system_tray_delegate()->GetSystemTrayMenuWidth()); |
587 } | 583 } |
588 | 584 |
589 TrayBubbleView::InitParams init_params(GetAnchorAlignment(), menu_width, | 585 TrayBubbleView::InitParams init_params(GetAnchorAlignment(), menu_width, |
590 kTrayPopupMaxWidth); | 586 kTrayPopupMaxWidth); |
591 // TODO(oshima): Change TrayBubbleView itself. | 587 // TODO(oshima): Change TrayBubbleView itself. |
592 init_params.can_activate = false; | 588 init_params.can_activate = false; |
593 if (detailed) { | 589 if (detailed) { |
594 // This is the case where a volume control or brightness control bubble | 590 // This is the case where a volume control or brightness control bubble |
595 // is created. | 591 // is created. |
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
913 .work_area() | 909 .work_area() |
914 .height(); | 910 .height(); |
915 if (work_area_height > 0) { | 911 if (work_area_height > 0) { |
916 UMA_HISTOGRAM_CUSTOM_COUNTS( | 912 UMA_HISTOGRAM_CUSTOM_COUNTS( |
917 "Ash.SystemMenu.PercentageOfWorkAreaHeightCoveredByMenu", | 913 "Ash.SystemMenu.PercentageOfWorkAreaHeightCoveredByMenu", |
918 100 * bubble_view->height() / work_area_height, 1, 300, 100); | 914 100 * bubble_view->height() / work_area_height, 1, 300, 100); |
919 } | 915 } |
920 } | 916 } |
921 | 917 |
922 } // namespace ash | 918 } // namespace ash |
OLD | NEW |