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

Unified Diff: ui/app_list/views/app_list_view.cc

Issue 960133005: Correctly handle tab navigation in the app list. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@fix_sorting_order
Patch Set: address comments Created 5 years, 10 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
« no previous file with comments | « ui/app_list/views/app_list_view.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/app_list/views/app_list_view.cc
diff --git a/ui/app_list/views/app_list_view.cc b/ui/app_list/views/app_list_view.cc
index c1bdb1edb175a75e3b73c46b380c1638611d966b..216abf4d4505b16a46ee4977aada5e6bc56ef716 100644
--- a/ui/app_list/views/app_list_view.cc
+++ b/ui/app_list/views/app_list_view.cc
@@ -83,6 +83,25 @@ bool SupportsShadow() {
return true;
}
+// This view forwards the focus to the search box widget by providing it as a
+// FocusTraversable when a focus search is provided.
+class SearchBoxFocusHost : public views::View {
+ public:
+ explicit SearchBoxFocusHost(views::Widget* search_box_widget)
+ : search_box_widget_(search_box_widget) {}
+
+ ~SearchBoxFocusHost() override {}
+
+ views::FocusTraversable* GetFocusTraversable() override {
+ return search_box_widget_;
+ }
+
+ private:
+ views::Widget* search_box_widget_;
+
+ DISALLOW_COPY_AND_ASSIGN(SearchBoxFocusHost);
+};
+
// The view for the App List overlay, which appears as a white rounded
// rectangle with the given radius.
class AppListOverlayView : public views::View {
@@ -182,6 +201,7 @@ AppListView::AppListView(AppListViewDelegate* delegate)
: delegate_(delegate),
app_list_main_view_(nullptr),
speech_view_(nullptr),
+ search_box_focus_host_(nullptr),
search_box_widget_(nullptr),
search_box_view_(nullptr),
overlay_view_(nullptr),
@@ -463,6 +483,15 @@ void AppListView::InitChildWidgets() {
search_box_widget_->Init(search_box_widget_params);
search_box_widget_->SetContentsView(search_box_view_);
+ // The search box will not naturally receive focus by itself (because it is in
+ // a separate widget). Create this SearchBoxFocusHost in the main widget to
+ // forward the focus search into to the search box.
+ search_box_focus_host_ = new SearchBoxFocusHost(search_box_widget_);
+ AddChildView(search_box_focus_host_);
+ search_box_widget_->SetFocusTraversableParentView(search_box_focus_host_);
+ search_box_widget_->SetFocusTraversableParent(
+ GetWidget()->GetFocusTraversable());
+
#if defined(USE_AURA)
// Mouse events on the search box shadow should not be captured.
aura::Window* window = search_box_widget_->GetNativeWindow();
« no previous file with comments | « ui/app_list/views/app_list_view.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698