| 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/ash_switches.h" | 7 #include "ash/common/ash_switches.h" |
| 8 #include "ash/common/login_status.h" | 8 #include "ash/common/login_status.h" |
| 9 #include "ash/common/session/session_state_delegate.h" | 9 #include "ash/common/session/session_state_delegate.h" |
| 10 #include "ash/common/shelf/wm_shelf.h" | 10 #include "ash/common/shelf/wm_shelf.h" |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 LoginStatus login_status = | 90 LoginStatus login_status = |
| 91 WmShell::Get()->system_tray_delegate()->GetUserLoginStatus(); | 91 WmShell::Get()->system_tray_delegate()->GetUserLoginStatus(); |
| 92 bubble_->InitView(anchor, login_status, init_params); | 92 bubble_->InitView(anchor, login_status, init_params); |
| 93 bubble_wrapper_.reset(new TrayBubbleWrapper(tray, bubble_->bubble_view())); | 93 bubble_wrapper_.reset(new TrayBubbleWrapper(tray, bubble_->bubble_view())); |
| 94 // The system bubble should not have an arrow. | 94 // The system bubble should not have an arrow. |
| 95 bubble_->bubble_view()->SetArrowPaintType(views::BubbleBorder::PAINT_NONE); | 95 bubble_->bubble_view()->SetArrowPaintType(views::BubbleBorder::PAINT_NONE); |
| 96 is_persistent_ = is_persistent; | 96 is_persistent_ = is_persistent; |
| 97 | 97 |
| 98 // If ChromeVox is enabled, focus the default item if no item is focused and | 98 // If ChromeVox is enabled, focus the default item if no item is focused and |
| 99 // there isn't a delayed close. | 99 // there isn't a delayed close. |
| 100 if (WmShell::Get()->GetAccessibilityDelegate()->IsSpokenFeedbackEnabled() && | 100 if (WmShell::Get()->accessibility_delegate()->IsSpokenFeedbackEnabled() && |
| 101 !is_persistent) { | 101 !is_persistent) { |
| 102 bubble_->FocusDefaultIfNeeded(); | 102 bubble_->FocusDefaultIfNeeded(); |
| 103 } | 103 } |
| 104 } | 104 } |
| 105 | 105 |
| 106 // Convenience accessors: | 106 // Convenience accessors: |
| 107 SystemTrayBubble* bubble() const { return bubble_.get(); } | 107 SystemTrayBubble* bubble() const { return bubble_.get(); } |
| 108 SystemTrayBubble::BubbleType bubble_type() const { | 108 SystemTrayBubble::BubbleType bubble_type() const { |
| 109 return bubble_->bubble_type(); | 109 return bubble_->bubble_type(); |
| 110 } | 110 } |
| (...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 455 SystemTrayBubble::BubbleType bubble_type = | 455 SystemTrayBubble::BubbleType bubble_type = |
| 456 detailed ? SystemTrayBubble::BUBBLE_TYPE_DETAILED | 456 detailed ? SystemTrayBubble::BUBBLE_TYPE_DETAILED |
| 457 : SystemTrayBubble::BUBBLE_TYPE_DEFAULT; | 457 : SystemTrayBubble::BUBBLE_TYPE_DEFAULT; |
| 458 | 458 |
| 459 // Destroy the notification bubble here so that it doesn't get rebuilt | 459 // Destroy the notification bubble here so that it doesn't get rebuilt |
| 460 // while we add items to the main bubble_ (e.g. in HideNotificationView). | 460 // while we add items to the main bubble_ (e.g. in HideNotificationView). |
| 461 notification_bubble_.reset(); | 461 notification_bubble_.reset(); |
| 462 if (system_bubble_.get() && creation_type == BUBBLE_USE_EXISTING) { | 462 if (system_bubble_.get() && creation_type == BUBBLE_USE_EXISTING) { |
| 463 system_bubble_->bubble()->UpdateView(items, bubble_type); | 463 system_bubble_->bubble()->UpdateView(items, bubble_type); |
| 464 // If ChromeVox is enabled, focus the default item if no item is focused. | 464 // If ChromeVox is enabled, focus the default item if no item is focused. |
| 465 if (WmShell::Get()->GetAccessibilityDelegate()->IsSpokenFeedbackEnabled()) | 465 if (WmShell::Get()->accessibility_delegate()->IsSpokenFeedbackEnabled()) |
| 466 system_bubble_->bubble()->FocusDefaultIfNeeded(); | 466 system_bubble_->bubble()->FocusDefaultIfNeeded(); |
| 467 } else { | 467 } else { |
| 468 // Cleanup the existing bubble before showing a new one. Otherwise, it's | 468 // Cleanup the existing bubble before showing a new one. Otherwise, it's |
| 469 // possible to confuse the new system bubble with the old one during | 469 // possible to confuse the new system bubble with the old one during |
| 470 // destruction, leading to subtle errors/crashes such as crbug.com/545166. | 470 // destruction, leading to subtle errors/crashes such as crbug.com/545166. |
| 471 DestroySystemBubble(); | 471 DestroySystemBubble(); |
| 472 | 472 |
| 473 // Remember if the menu is a single property (like e.g. volume) or the | 473 // Remember if the menu is a single property (like e.g. volume) or the |
| 474 // full tray menu. Note that in case of the |BUBBLE_USE_EXISTING| case | 474 // full tray menu. Note that in case of the |BUBBLE_USE_EXISTING| case |
| 475 // above, |full_system_tray_menu_| does not get changed since the fact that | 475 // above, |full_system_tray_menu_| does not get changed since the fact that |
| (...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 767 .work_area() | 767 .work_area() |
| 768 .height(); | 768 .height(); |
| 769 if (work_area_height > 0) { | 769 if (work_area_height > 0) { |
| 770 UMA_HISTOGRAM_CUSTOM_COUNTS( | 770 UMA_HISTOGRAM_CUSTOM_COUNTS( |
| 771 "Ash.SystemMenu.PercentageOfWorkAreaHeightCoveredByMenu", | 771 "Ash.SystemMenu.PercentageOfWorkAreaHeightCoveredByMenu", |
| 772 100 * bubble_view->height() / work_area_height, 1, 300, 100); | 772 100 * bubble_view->height() / work_area_height, 1, 300, 100); |
| 773 } | 773 } |
| 774 } | 774 } |
| 775 | 775 |
| 776 } // namespace ash | 776 } // namespace ash |
| OLD | NEW |