Commit d96b4d74 authored by Jun Mukai's avatar Jun Mukai Committed by Commit Bot

Remove ash dependency on WebUILoginView::MoveFocusToSystemTray

LoginScreen::FocusLoginShelf() mojo API can be reused.

BUG=854346
TEST=trybot

Change-Id: Ide7dad98e1da57826d37d5dff4c3e269aee07c14
Reviewed-on: https://chromium-review.googlesource.com/c/1325689Reviewed-by: default avatarJacob Dufault <jdufault@chromium.org>
Commit-Queue: Jun Mukai <mukai@chromium.org>
Cr-Commit-Position: refs/heads/master@{#606662}
parent cd8d31b4
......@@ -495,7 +495,9 @@ void LoginScreenController::FocusLoginShelf(bool reverse) {
Shelf* shelf = Shelf::ForWindow(Shell::Get()->GetPrimaryRootWindow());
// Tell the focus direction to the status area or the shelf so they can focus
// the correct child view.
if (reverse) {
if (reverse && !ShelfWidget::IsUsingViewsShelf()) {
if (Shell::GetPrimaryRootWindowController()->IsSystemTrayVisible())
return;
shelf->GetStatusAreaWidget()
->status_area_widget_delegate()
->set_default_last_focusable_child(reverse);
......
......@@ -11,18 +11,10 @@ specific_include_rules = {
"input_events_blocker\.cc": [
"+ash/shell.h",
],
# TODO(mash): Fix. https://crbug.com/854328
"login_display_host_common\.cc": [
"+ash/shell.h",
],
# TODO(mash): Fix. https://crbug.com/854346
"webui_login_view.*": [
"+ash/accelerators/accelerator_controller.h",
"+ash/focus_cycler.h",
"+ash/public/cpp/ash_features.h",
"+ash/root_window_controller.h",
"+ash/shelf/shelf.h",
"+ash/shelf/shelf_widget.h",
"+ash/shell.h",
"+ash/system",
],
......
......@@ -4,7 +4,6 @@
#include "chrome/browser/chromeos/login/ui/login_display_host_common.h"
#include "ash/shell.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/chrome_notification_types.h"
#include "chrome/browser/chromeos/login/app_launch_controller.h"
......
......@@ -7,14 +7,8 @@
#include <memory>
#include "ash/accelerators/accelerator_controller.h"
#include "ash/focus_cycler.h"
#include "ash/public/cpp/ash_features.h"
#include "ash/root_window_controller.h"
#include "ash/shelf/shelf.h"
#include "ash/shelf/shelf_widget.h"
#include "ash/shell.h"
#include "ash/system/status_area_widget.h"
#include "ash/system/status_area_widget_delegate.h"
#include "ash/system/tray/system_tray_notifier.h"
#include "base/bind.h"
#include "base/callback.h"
......@@ -39,6 +33,7 @@
#include "chrome/browser/renderer_preferences_util.h"
#include "chrome/browser/sessions/session_tab_helper.h"
#include "chrome/browser/ui/ash/chrome_keyboard_controller_client.h"
#include "chrome/browser/ui/ash/login_screen_client.h"
#include "chrome/browser/ui/ash/system_tray_client.h"
#include "chrome/browser/ui/autofill/chrome_autofill_client.h"
#include "chrome/browser/ui/webui/chromeos/internet_detail_dialog.h"
......@@ -558,38 +553,14 @@ void WebUILoginView::OnFocusLeavingSystemTray(bool reverse) {
}
bool WebUILoginView::MoveFocusToSystemTray(bool reverse) {
// Focus is accepted, but the Ash system tray is not available in Mash, so
// exit early. https://crbug.com/782072
if (features::IsMultiProcessMash())
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 OOBE is
// active.
if (LoginDisplayHost::default_host() &&
LoginDisplayHost::default_host()->IsVoiceInteractionOobe()) {
return false;
}
// If shift+tab is used (|reverse| is true) and views-based shelf is shown,
// focus goes to the shelf widget. If views-based shelf is disabled, focus
// goes to the system tray, because the web-UI shelf has already been
// traversed when we reach here.
ash::Shelf* shelf = ash::Shelf::ForWindow(GetWidget()->GetNativeWindow());
if (!reverse && ash::ShelfWidget::IsUsingViewsShelf()) {
shelf->shelf_widget()->set_default_last_focusable_child(reverse);
ash::Shell::Get()->focus_cycler()->FocusWidget(shelf->shelf_widget());
return true;
}
ash::RootWindowController* primary_controller =
ash::RootWindowController::ForWindow(GetWidget()->GetNativeWindow());
if (!primary_controller->IsSystemTrayVisible())
return false;
shelf->GetStatusAreaWidget()
->status_area_widget_delegate()
->set_default_last_focusable_child(reverse);
ash::Shell::Get()->focus_cycler()->FocusWidget(shelf->GetStatusAreaWidget());
LoginScreenClient::Get()->login_screen()->FocusLoginShelf(reverse);
return true;
}
......
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