Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2340)

Unified Diff: ash/system/tray/system_tray.cc

Issue 2897553002: Do not activate TrayBubbleView by default (Closed)
Patch Set: Add comment. Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ash/system/tray/system_tray.cc
diff --git a/ash/system/tray/system_tray.cc b/ash/system/tray/system_tray.cc
index 121f24539ac1f98607b70ae99f87f5819fe4429b..264cde7806d1fb8846c02ff9a2eb4a3a5bd76825 100644
--- a/ash/system/tray/system_tray.cc
+++ b/ash/system/tray/system_tray.cc
@@ -8,6 +8,7 @@
#include <map>
#include <vector>
+#include "ash/accelerators/accelerator_controller.h"
#include "ash/key_event_watcher.h"
#include "ash/login_status.h"
#include "ash/public/cpp/config.h"
@@ -210,7 +211,6 @@ SystemTray::SystemTray(Shelf* shelf) : TrayBackgroundView(shelf) {
SystemTray::~SystemTray() {
// Destroy any child views that might have back pointers before ~View().
activation_observer_.reset();
- key_event_watcher_.reset();
system_bubble_.reset();
for (const auto& item : items_)
item->OnTrayViewDestroyed();
@@ -437,8 +437,6 @@ void SystemTray::ShowItems(const std::vector<SystemTrayItem*>& items,
if (system_bubble_.get() && creation_type == BUBBLE_USE_EXISTING) {
system_bubble_->bubble()->UpdateView(items, bubble_type);
// If ChromeVox is enabled, focus the default item if no item is focused.
James Cook 2017/06/09 16:06:13 Is this comment still needed?
yawano 2017/06/12 09:11:03 No longer necessary. Deleted.
- if (Shell::Get()->accessibility_delegate()->IsSpokenFeedbackEnabled())
- system_bubble_->bubble()->FocusDefaultIfNeeded();
} else {
// Cleanup the existing bubble before showing a new one. Otherwise, it's
// possible to confuse the new system bubble with the old one during
@@ -486,10 +484,6 @@ void SystemTray::ShowItems(const std::vector<SystemTrayItem*>& items,
if (!detailed)
default_bubble_height_ = system_bubble_->bubble_view()->height();
- key_event_watcher_.reset();
- if (can_activate)
- CreateKeyEventWatcher();
-
if (detailed && items.size() > 0)
detailed_item_ = items[0];
else
@@ -580,10 +574,26 @@ void SystemTray::OnMouseExitedView() {
system_bubble_->bubble()->RestartAutoCloseTimer();
}
+void SystemTray::RegisterAccelerators(
+ const std::vector<ui::Accelerator>& accelerators,
+ views::TrayBubbleView* tray_bubble_view) {
+ Shell::Get()->accelerator_controller()->Register(accelerators,
+ tray_bubble_view);
+}
+
+void SystemTray::UnregisterAllAccelerators(
+ views::TrayBubbleView* tray_bubble_view) {
+ Shell::Get()->accelerator_controller()->UnregisterAll(tray_bubble_view);
+}
+
base::string16 SystemTray::GetAccessibleNameForBubble() {
return GetAccessibleNameForTray();
}
+bool SystemTray::ShouldEnableExtraKeyboardAccessibility() {
+ return Shell::Get()->accessibility_delegate()->IsSpokenFeedbackEnabled();
+}
+
void SystemTray::HideBubble(const TrayBubbleView* bubble_view) {
HideBubbleWithView(bubble_view);
}
@@ -625,24 +635,6 @@ void SystemTray::ActivateAndStartNavigation(const ui::KeyEvent& key_event) {
widget->GetFocusManager()->OnKeyEvent(key_event);
}
-void SystemTray::CreateKeyEventWatcher() {
- key_event_watcher_ = ShellPort::Get()->CreateKeyEventWatcher();
- // mustash does not yet support KeyEventWatcher. http://crbug.com/649600.
- if (!key_event_watcher_)
- return;
- key_event_watcher_->AddKeyEventCallback(
- ui::Accelerator(ui::VKEY_ESCAPE, ui::EF_NONE),
- base::Bind(&SystemTray::CloseBubble, base::Unretained(this)));
- key_event_watcher_->AddKeyEventCallback(
- ui::Accelerator(ui::VKEY_TAB, ui::EF_NONE),
- base::Bind(&SystemTray::ActivateAndStartNavigation,
- base::Unretained(this)));
- key_event_watcher_->AddKeyEventCallback(
- ui::Accelerator(ui::VKEY_TAB, ui::EF_SHIFT_DOWN),
- base::Bind(&SystemTray::ActivateAndStartNavigation,
- base::Unretained(this)));
-}
-
void SystemTray::ActivateBubble() {
TrayBubbleView* bubble_view = GetSystemBubble()->bubble_view();
// If system tray bubble is in the process of closing, do not try to activate
@@ -670,7 +662,6 @@ bool SystemTray::PerformAction(const ui::Event& event) {
void SystemTray::CloseSystemBubbleAndDeactivateSystemTray() {
activation_observer_.reset();
- key_event_watcher_.reset();
system_bubble_.reset();
// When closing a system bubble with the alternate shelf layout, we need to
// turn off the active tinting of the shelf.

Powered by Google App Engine
This is Rietveld 408576698