| 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 433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 444 // destruction, leading to subtle errors/crashes such as crbug.com/545166. | 444 // destruction, leading to subtle errors/crashes such as crbug.com/545166. |
| 445 DestroySystemBubble(); | 445 DestroySystemBubble(); |
| 446 | 446 |
| 447 // Remember if the menu is a single property (like e.g. volume) or the | 447 // Remember if the menu is a single property (like e.g. volume) or the |
| 448 // full tray menu. Note that in case of the |BUBBLE_USE_EXISTING| case | 448 // full tray menu. Note that in case of the |BUBBLE_USE_EXISTING| case |
| 449 // above, |full_system_tray_menu_| does not get changed since the fact that | 449 // above, |full_system_tray_menu_| does not get changed since the fact that |
| 450 // the menu is full (or not) doesn't change even if a "single property" | 450 // the menu is full (or not) doesn't change even if a "single property" |
| 451 // (like network) replaces most of the menu. | 451 // (like network) replaces most of the menu. |
| 452 full_system_tray_menu_ = items.size() > 1; | 452 full_system_tray_menu_ = items.size() > 1; |
| 453 | 453 |
| 454 TrayBubbleView::InitParams init_params( | 454 TrayBubbleView::InitParams init_params; |
| 455 GetAnchorAlignment(), kTrayMenuMinimumWidth, kTrayPopupMaxWidth); | 455 init_params.anchor_alignment = GetAnchorAlignment(); |
| 456 init_params.min_width = kTrayMenuMinimumWidth; |
| 457 init_params.max_width = kTrayPopupMaxWidth; |
| 456 // TODO(oshima): Change TrayBubbleView itself. | 458 // TODO(oshima): Change TrayBubbleView itself. |
| 457 init_params.can_activate = false; | 459 init_params.can_activate = false; |
| 458 // The bubble is not initially activatable, but will become activatable if | 460 // The bubble is not initially activatable, but will become activatable if |
| 459 // the user presses Tab. For behavioral consistency with the non-activatable | 461 // the user presses Tab. For behavioral consistency with the non-activatable |
| 460 // scenario, don't close on deactivation after Tab either. | 462 // scenario, don't close on deactivation after Tab either. |
| 461 init_params.close_on_deactivate = false; | 463 init_params.close_on_deactivate = false; |
| 462 if (detailed) { | 464 if (detailed) { |
| 463 // This is the case where a volume control or brightness control bubble | 465 // This is the case where a volume control or brightness control bubble |
| 464 // is created. | 466 // is created. |
| 465 init_params.max_height = default_bubble_height_; | 467 init_params.max_height = default_bubble_height_; |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 574 | 576 |
| 575 void SystemTray::OnMouseExitedView() { | 577 void SystemTray::OnMouseExitedView() { |
| 576 if (system_bubble_) | 578 if (system_bubble_) |
| 577 system_bubble_->bubble()->RestartAutoCloseTimer(); | 579 system_bubble_->bubble()->RestartAutoCloseTimer(); |
| 578 } | 580 } |
| 579 | 581 |
| 580 base::string16 SystemTray::GetAccessibleNameForBubble() { | 582 base::string16 SystemTray::GetAccessibleNameForBubble() { |
| 581 return GetAccessibleNameForTray(); | 583 return GetAccessibleNameForTray(); |
| 582 } | 584 } |
| 583 | 585 |
| 584 void SystemTray::OnBeforeBubbleWidgetInit( | |
| 585 views::Widget* anchor_widget, | |
| 586 views::Widget* bubble_widget, | |
| 587 views::Widget::InitParams* params) const { | |
| 588 // Place the bubble in the same root window as |anchor_widget|. | |
| 589 RootWindowController::ForWindow(anchor_widget->GetNativeWindow()) | |
| 590 ->ConfigureWidgetInitParamsForContainer( | |
| 591 bubble_widget, kShellWindowId_SettingBubbleContainer, params); | |
| 592 } | |
| 593 | |
| 594 void SystemTray::HideBubble(const TrayBubbleView* bubble_view) { | 586 void SystemTray::HideBubble(const TrayBubbleView* bubble_view) { |
| 595 HideBubbleWithView(bubble_view); | 587 HideBubbleWithView(bubble_view); |
| 596 } | 588 } |
| 597 | 589 |
| 598 TrayCast* SystemTray::GetTrayCastForTesting() const { | 590 TrayCast* SystemTray::GetTrayCastForTesting() const { |
| 599 return tray_cast_; | 591 return tray_cast_; |
| 600 } | 592 } |
| 601 | 593 |
| 602 TrayEnterprise* SystemTray::GetTrayEnterpriseForTesting() const { | 594 TrayEnterprise* SystemTray::GetTrayEnterpriseForTesting() const { |
| 603 return tray_enterprise_; | 595 return tray_enterprise_; |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 708 .work_area() | 700 .work_area() |
| 709 .height(); | 701 .height(); |
| 710 if (work_area_height > 0) { | 702 if (work_area_height > 0) { |
| 711 UMA_HISTOGRAM_CUSTOM_COUNTS( | 703 UMA_HISTOGRAM_CUSTOM_COUNTS( |
| 712 "Ash.SystemMenu.PercentageOfWorkAreaHeightCoveredByMenu", | 704 "Ash.SystemMenu.PercentageOfWorkAreaHeightCoveredByMenu", |
| 713 100 * bubble_view->height() / work_area_height, 1, 300, 100); | 705 100 * bubble_view->height() / work_area_height, 1, 300, 100); |
| 714 } | 706 } |
| 715 } | 707 } |
| 716 | 708 |
| 717 } // namespace ash | 709 } // namespace ash |
| OLD | NEW |