Commit 980bc8e7 authored by wutao's avatar wutao Committed by Commit Bot

cros: Defocus search box after exiting search mode in KSV.

This cl defocus search box after exiting search mode in Keyboard
Shortcut Viewer (KSV).

Bug: 768932
Test: Tested on device.
Change-Id: I71bdfb3c923ec6ab73ae3125fd0a40e542ecdc0e
Reviewed-on: https://chromium-review.googlesource.com/923113Reviewed-by: default avatarAhmed Fakhry <afakhry@chromium.org>
Commit-Queue: Tao Wu <wutao@chromium.org>
Cr-Commit-Position: refs/heads/master@{#537427}
parent 7a9e74f5
...@@ -93,6 +93,7 @@ views::Widget* KeyboardShortcutView::Show(gfx::NativeWindow context) { ...@@ -93,6 +93,7 @@ views::Widget* KeyboardShortcutView::Show(gfx::NativeWindow context) {
new KeyboardShortcutView(), context, new KeyboardShortcutView(), context,
gfx::Rect(0, 0, kKSVWindowWidth, kKSVWindowHeight)); gfx::Rect(0, 0, kKSVWindowWidth, kKSVWindowHeight));
g_ksv_view->GetWidget()->Show(); g_ksv_view->GetWidget()->Show();
g_ksv_view->RequestFocusForActiveTab();
} }
return g_ksv_view->GetWidget(); return g_ksv_view->GetWidget();
} }
...@@ -168,6 +169,14 @@ void KeyboardShortcutView::InitViews() { ...@@ -168,6 +169,14 @@ void KeyboardShortcutView::InitViews() {
AddChildView(tabbed_pane_); AddChildView(tabbed_pane_);
} }
void KeyboardShortcutView::RequestFocusForActiveTab() {
// Get the |tab_strip_| of the |tabbed_pane_| in order to set focus on
// the selected tab.
tabbed_pane_->child_at(0)
->child_at(tabbed_pane_->GetSelectedTabIndex())
->RequestFocus();
}
bool KeyboardShortcutView::CanMaximize() const { bool KeyboardShortcutView::CanMaximize() const {
return false; return false;
} }
...@@ -288,8 +297,10 @@ void KeyboardShortcutView::ActiveChanged( ...@@ -288,8 +297,10 @@ void KeyboardShortcutView::ActiveChanged(
sender->ShowBackOrGoogleIcon(is_active); sender->ShowBackOrGoogleIcon(is_active);
search_results_container_->SetVisible(is_active); search_results_container_->SetVisible(is_active);
tabbed_pane_->SetVisible(!is_active); tabbed_pane_->SetVisible(!is_active);
if (!is_active) if (!is_active) {
search_results_container_->RemoveAllChildViews(true); search_results_container_->RemoveAllChildViews(true);
RequestFocusForActiveTab();
}
Layout(); Layout();
SchedulePaint(); SchedulePaint();
} }
......
...@@ -48,6 +48,8 @@ class KeyboardShortcutView : public views::WidgetDelegateView, ...@@ -48,6 +48,8 @@ class KeyboardShortcutView : public views::WidgetDelegateView,
void InitViews(); void InitViews();
void RequestFocusForActiveTab();
static KeyboardShortcutView* GetInstanceForTesting(); static KeyboardShortcutView* GetInstanceForTesting();
int GetCategoryNumberForTesting() const; int GetCategoryNumberForTesting() const;
int GetTabCountForTesting() const; int GetTabCountForTesting() const;
......
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