| 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 460 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 471 // full tray menu. Note that in case of the |BUBBLE_USE_EXISTING| case | 471 // full tray menu. Note that in case of the |BUBBLE_USE_EXISTING| case |
| 472 // above, |full_system_tray_menu_| does not get changed since the fact that | 472 // above, |full_system_tray_menu_| does not get changed since the fact that |
| 473 // the menu is full (or not) doesn't change even if a "single property" | 473 // the menu is full (or not) doesn't change even if a "single property" |
| 474 // (like network) replaces most of the menu. | 474 // (like network) replaces most of the menu. |
| 475 full_system_tray_menu_ = items.size() > 1; | 475 full_system_tray_menu_ = items.size() > 1; |
| 476 | 476 |
| 477 TrayBubbleView::InitParams init_params( | 477 TrayBubbleView::InitParams init_params( |
| 478 GetAnchorAlignment(), kTrayMenuMinimumWidth, kTrayPopupMaxWidth); | 478 GetAnchorAlignment(), kTrayMenuMinimumWidth, kTrayPopupMaxWidth); |
| 479 // TODO(oshima): Change TrayBubbleView itself. | 479 // TODO(oshima): Change TrayBubbleView itself. |
| 480 init_params.can_activate = false; | 480 init_params.can_activate = false; |
| 481 // The bubble is not initially activatable, but will become activatable if |
| 482 // the user presses Tab. For behavioral consistency with the non-activatable |
| 483 // scenario, don't close on deactivation after Tab either. |
| 484 init_params.close_on_deactivate = false; |
| 481 if (detailed) { | 485 if (detailed) { |
| 482 // This is the case where a volume control or brightness control bubble | 486 // This is the case where a volume control or brightness control bubble |
| 483 // is created. | 487 // is created. |
| 484 init_params.max_height = default_bubble_height_; | 488 init_params.max_height = default_bubble_height_; |
| 485 init_params.bg_color = kBackgroundColor; | 489 init_params.bg_color = kBackgroundColor; |
| 486 } else { | 490 } else { |
| 487 init_params.bg_color = kHeaderBackgroundColor; | 491 init_params.bg_color = kHeaderBackgroundColor; |
| 488 } | 492 } |
| 489 if (bubble_type == SystemTrayBubble::BUBBLE_TYPE_DEFAULT) | |
| 490 init_params.close_on_deactivate = !persistent; | |
| 491 SystemTrayBubble* bubble = new SystemTrayBubble(this, items, bubble_type); | 493 SystemTrayBubble* bubble = new SystemTrayBubble(this, items, bubble_type); |
| 492 | 494 |
| 493 system_bubble_.reset(new SystemBubbleWrapper(bubble)); | 495 system_bubble_.reset(new SystemBubbleWrapper(bubble)); |
| 494 system_bubble_->InitView(this, GetBubbleAnchor(), GetBubbleAnchorInsets(), | 496 system_bubble_->InitView(this, GetBubbleAnchor(), GetBubbleAnchorInsets(), |
| 495 &init_params, persistent); | 497 &init_params, persistent); |
| 496 | 498 |
| 497 activation_observer_.reset(persistent ? nullptr | 499 activation_observer_.reset(persistent ? nullptr |
| 498 : new ActivationObserver(this)); | 500 : new ActivationObserver(this)); |
| 499 | 501 |
| 500 // Record metrics for the system menu when the default view is invoked. | 502 // Record metrics for the system menu when the default view is invoked. |
| (...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 731 .work_area() | 733 .work_area() |
| 732 .height(); | 734 .height(); |
| 733 if (work_area_height > 0) { | 735 if (work_area_height > 0) { |
| 734 UMA_HISTOGRAM_CUSTOM_COUNTS( | 736 UMA_HISTOGRAM_CUSTOM_COUNTS( |
| 735 "Ash.SystemMenu.PercentageOfWorkAreaHeightCoveredByMenu", | 737 "Ash.SystemMenu.PercentageOfWorkAreaHeightCoveredByMenu", |
| 736 100 * bubble_view->height() / work_area_height, 1, 300, 100); | 738 100 * bubble_view->height() / work_area_height, 1, 300, 100); |
| 737 } | 739 } |
| 738 } | 740 } |
| 739 | 741 |
| 740 } // namespace ash | 742 } // namespace ash |
| OLD | NEW |