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 521 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
532 // destruction, leading to subtle errors/crashes such as crbug.com/545166. | 532 // destruction, leading to subtle errors/crashes such as crbug.com/545166. |
533 DestroySystemBubble(); | 533 DestroySystemBubble(); |
534 | 534 |
535 // Remember if the menu is a single property (like e.g. volume) or the | 535 // Remember if the menu is a single property (like e.g. volume) or the |
536 // full tray menu. Note that in case of the |BUBBLE_USE_EXISTING| case | 536 // full tray menu. Note that in case of the |BUBBLE_USE_EXISTING| case |
537 // above, |full_system_tray_menu_| does not get changed since the fact that | 537 // above, |full_system_tray_menu_| does not get changed since the fact that |
538 // the menu is full (or not) doesn't change even if a "single property" | 538 // the menu is full (or not) doesn't change even if a "single property" |
539 // (like network) replaces most of the menu. | 539 // (like network) replaces most of the menu. |
540 full_system_tray_menu_ = items.size() > 1; | 540 full_system_tray_menu_ = items.size() > 1; |
541 // The menu width is fixed, and it is a per language setting. | 541 // The menu width is fixed, and it is a per language setting. |
542 int menu_width = | 542 int menu_width = std::max( |
543 std::max(MaterialDesignController::IsSystemTrayMenuMaterial() | 543 MaterialDesignController::IsSystemTrayMenuMaterial() |
544 ? kMinimumSystemTrayMenuWidthMd | 544 ? kMinimumSystemTrayMenuWidthMd |
545 : kMinimumSystemTrayMenuWidth, | 545 : kMinimumSystemTrayMenuWidth, |
546 l10n_util::GetLocalizedContentsWidthInPixels( | 546 WmShell::Get()->system_tray_delegate()->GetSystemTrayMenuWidth()); |
547 IDS_SYSTEM_TRAY_MENU_BUBBLE_WIDTH_PIXELS)); | |
548 | 547 |
549 TrayBubbleView::InitParams init_params(TrayBubbleView::ANCHOR_TYPE_TRAY, | 548 TrayBubbleView::InitParams init_params(TrayBubbleView::ANCHOR_TYPE_TRAY, |
550 GetAnchorAlignment(), menu_width, | 549 GetAnchorAlignment(), menu_width, |
551 kTrayPopupMaxWidth); | 550 kTrayPopupMaxWidth); |
552 // TODO(oshima): Change TrayBubbleView itself. | 551 // TODO(oshima): Change TrayBubbleView itself. |
553 init_params.can_activate = false; | 552 init_params.can_activate = false; |
554 init_params.first_item_has_no_margin = true; | 553 init_params.first_item_has_no_margin = true; |
555 if (detailed) { | 554 if (detailed) { |
556 // This is the case where a volume control or brightness control bubble | 555 // This is the case where a volume control or brightness control bubble |
557 // is created. | 556 // is created. |
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
889 .work_area() | 888 .work_area() |
890 .height(); | 889 .height(); |
891 if (work_area_height > 0) { | 890 if (work_area_height > 0) { |
892 UMA_HISTOGRAM_CUSTOM_COUNTS( | 891 UMA_HISTOGRAM_CUSTOM_COUNTS( |
893 "Ash.SystemMenu.PercentageOfWorkAreaHeightCoveredByMenu", | 892 "Ash.SystemMenu.PercentageOfWorkAreaHeightCoveredByMenu", |
894 100 * bubble_view->height() / work_area_height, 1, 300, 100); | 893 100 * bubble_view->height() / work_area_height, 1, 300, 100); |
895 } | 894 } |
896 } | 895 } |
897 | 896 |
898 } // namespace ash | 897 } // namespace ash |
OLD | NEW |