Commit 255cb689 authored by Sammie Quon's avatar Sammie Quon Committed by Commit Bot

system: Allow keyboard navigation on user drop down menu on tray.

Allows user drop down menu to activatble so that it can be cycled
through.
Add a custom focus search so the drop down menu closes after all items
have been cycled through.
Migrate Closure to OnceClosure.
Make drop down menu a transient child of system bubble.

Test: manual
Bug: 799401
Change-Id: I67af2bb3e58c88f6926ab65ecf565d69325d00b8
Reviewed-on: https://chromium-review.googlesource.com/1038656Reviewed-by: default avatarSteven Bennetts <stevenjb@chromium.org>
Commit-Queue: Sammie Quon <sammiequon@chromium.org>
Cr-Commit-Position: refs/heads/master@{#555756}
parent 210545ea
......@@ -13,6 +13,7 @@
#include "ui/aura/window.h"
#include "ui/views/bubble/tray_bubble_view.h"
#include "ui/views/widget/widget.h"
#include "ui/wm/core/transient_window_manager.h"
#include "ui/wm/core/window_util.h"
#include "ui/wm/public/activation_client.h"
......@@ -43,6 +44,12 @@ TrayBubbleWrapper::~TrayBubbleWrapper() {
tray_->tray_event_filter()->RemoveWrapper(this);
if (bubble_widget_) {
auto* transient_manager = ::wm::TransientWindowManager::GetOrCreate(
bubble_widget_->GetNativeWindow());
if (transient_manager) {
for (auto* window : transient_manager->transient_children())
transient_manager->RemoveTransientChild(window);
}
bubble_widget_->GetNativeWindow()->GetRootWindow()->RemoveObserver(this);
bubble_widget_->RemoveObserver(this);
bubble_widget_->Close();
......
This diff is collapsed.
......@@ -60,13 +60,14 @@ class UserView : public views::View,
void AddLogoutButton(LoginStatus login);
void AddUserCard(LoginStatus login);
// Create the menu option to add another user. If |disabled| is set the user
// cannot actively click on the item.
void ToggleUserDropdownWidget();
// Create the menu option to add another user.
void ToggleUserDropdownWidget(bool toggled_by_key_event);
// Removes the add user menu option.
void HideUserDropdownWidget();
views::Widget* GetBubbleWidget();
// If |user_card_view_| is clickable, this is a ButtonFromView that wraps it.
// If |user_card_view_| is not clickable, this will be equal to
// |user_card_view_|.
......@@ -80,6 +81,9 @@ class UserView : public views::View,
views::View* logout_button_ = nullptr;
std::unique_ptr<views::Widget> user_dropdown_widget_;
// Tracks whether |user_dropdown_widget_| was opened with a key event. If
// true, HideUserDropdownWidget() will return focus to |user_card_container_|.
bool user_dropdown_widget_toggled_by_key_event_ = false;
// False when the add user panel is visible but not activatable.
bool add_user_enabled_ = 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