Commit 2c474b75 authored by Tetsui Ohkubo's avatar Tetsui Ohkubo Committed by Commit Bot

Fix tab focusing to system tray in OOBE screen.

Recently, UnifiedSystemTray replaced SystemTray class.
WebUILoginView ignored UnifiedSystemTray because I misunderstood
views login will completely replace WebUILoginView. However,
WebUILoginView is still used in OOBE screen, so we should fix it to also
work with UnifiedSystemTray.

TEST=manual
BUG=853713

Change-Id: I3842eba971a928af5ba1599283c52f9711d83cc4
Reviewed-on: https://chromium-review.googlesource.com/1107520
Commit-Queue: Tetsui Ohkubo <tetsui@chromium.org>
Reviewed-by: default avatarJames Cook <jamescook@chromium.org>
Cr-Commit-Position: refs/heads/master@{#570996}
parent 3dcf99fc
...@@ -38,6 +38,9 @@ ...@@ -38,6 +38,9 @@
#include "ash/shell_state.h" #include "ash/shell_state.h"
#include "ash/system/status_area_layout_manager.h" #include "ash/system/status_area_layout_manager.h"
#include "ash/system/status_area_widget.h" #include "ash/system/status_area_widget.h"
#include "ash/system/tray/system_tray.h"
#include "ash/system/tray/tray_background_view.h"
#include "ash/system/unified/unified_system_tray.h"
#include "ash/touch/touch_hud_debug.h" #include "ash/touch/touch_hud_debug.h"
#include "ash/touch/touch_hud_projection.h" #include "ash/touch/touch_hud_projection.h"
#include "ash/touch/touch_observer_hud.h" #include "ash/touch/touch_observer_hud.h"
...@@ -395,6 +398,15 @@ SystemTray* RootWindowController::GetSystemTray() { ...@@ -395,6 +398,15 @@ SystemTray* RootWindowController::GetSystemTray() {
return shelf_->shelf_widget()->status_area_widget()->system_tray(); return shelf_->shelf_widget()->status_area_widget()->system_tray();
} }
bool RootWindowController::IsSystemTrayVisible() {
TrayBackgroundView* tray = nullptr;
if (features::IsSystemTrayUnifiedEnabled())
tray = GetStatusAreaWidget()->unified_system_tray();
else
tray = GetSystemTray();
return tray && tray->GetWidget()->IsVisible() && tray->visible();
}
bool RootWindowController::CanWindowReceiveEvents(aura::Window* window) { bool RootWindowController::CanWindowReceiveEvents(aura::Window* window) {
if (GetRootWindow() != window->GetRootWindow()) if (GetRootWindow() != window->GetRootWindow())
return false; return false;
......
...@@ -169,6 +169,9 @@ class ASH_EXPORT RootWindowController { ...@@ -169,6 +169,9 @@ class ASH_EXPORT RootWindowController {
// lead to a crash. // lead to a crash.
SystemTray* GetSystemTray(); SystemTray* GetSystemTray();
// Returns if system tray and its widget is visible.
bool IsSystemTrayVisible();
// True if the window can receive events on this root window. // True if the window can receive events on this root window.
bool CanWindowReceiveEvents(aura::Window* window); bool CanWindowReceiveEvents(aura::Window* window);
......
...@@ -573,10 +573,6 @@ bool WebUILoginView::MoveFocusToSystemTray(bool reverse) { ...@@ -573,10 +573,6 @@ bool WebUILoginView::MoveFocusToSystemTray(bool reverse) {
if (!features::IsAshInBrowserProcess()) if (!features::IsAshInBrowserProcess())
return true; return true;
// The old system tray is not available when UnifiedSystemTray is enabled.
if (ash::features::IsSystemTrayUnifiedEnabled())
return true;
// The focus should not move to the system tray if voice interaction OOOBE is // The focus should not move to the system tray if voice interaction OOOBE is
// active. // active.
if (LoginDisplayHost::default_host() && if (LoginDisplayHost::default_host() &&
...@@ -595,10 +591,9 @@ bool WebUILoginView::MoveFocusToSystemTray(bool reverse) { ...@@ -595,10 +591,9 @@ bool WebUILoginView::MoveFocusToSystemTray(bool reverse) {
return true; return true;
} }
ash::SystemTray* tray = ash::RootWindowController* primary_controller =
ash::RootWindowController::ForWindow(GetWidget()->GetNativeWindow()) ash::RootWindowController::ForWindow(GetWidget()->GetNativeWindow());
->GetSystemTray(); if (!primary_controller->IsSystemTrayVisible())
if (!tray || !tray->GetWidget()->IsVisible() || !tray->visible())
return false; return false;
shelf->GetStatusAreaWidget() shelf->GetStatusAreaWidget()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment