Chromium Code Reviews| Index: ash/common/wm/overview/window_selector.cc |
| diff --git a/ash/common/wm/overview/window_selector.cc b/ash/common/wm/overview/window_selector.cc |
| index b24142b14492ce3febf825e12b5aea27378d7c57..a297724df9f15979c3ecb0b41d82db4bd2ce5e95 100644 |
| --- a/ash/common/wm/overview/window_selector.cc |
| +++ b/ash/common/wm/overview/window_selector.cc |
| @@ -195,10 +195,11 @@ gfx::Rect GetTextFilterPosition(WmWindow* root_window) { |
| // Initializes the text filter on the top of the main root window and requests |
| // focus on its textfield. With Material Design uses |image| to place an icon |
| // to the left of the text field. |
| -views::Widget* CreateTextFilter(views::TextfieldController* controller, |
| - WmWindow* root_window, |
| - const gfx::ImageSkia& image, |
| - int* text_filter_bottom) { |
| +views::Widget* CreateAndActivateTextFilter( |
| + views::TextfieldController* controller, |
| + WmWindow* root_window, |
| + const gfx::ImageSkia& image, |
| + int* text_filter_bottom) { |
| views::Widget* widget = new views::Widget; |
| views::Widget::InitParams params; |
| params.type = views::Widget::InitParams::TYPE_WINDOW_FRAMELESS; |
| @@ -249,6 +250,11 @@ views::Widget* CreateTextFilter(views::TextfieldController* controller, |
| layout->SetFlexForView(textfield, 1); |
| widget->SetContentsView(container); |
| + // Deactivate the previously active window to prevent accelerators targeting |
|
tdanderson
2016/08/09 14:21:03
nit: "Deactivate the previously-active window to p
varkha
2016/08/09 16:50:14
Done.
|
| + // an active window from triggering actions during overview. |
| + WmWindow* active_window = WmShell::Get()->GetActiveWindow(); |
| + if (active_window) |
| + active_window->Deactivate(); |
|
tdanderson
2016/08/09 14:21:03
If possible it would be good to have a test for th
varkha
2016/08/09 16:50:13
Done.
|
| // The textfield initially contains no text, so shift its position to be |
| // outside the visible bounds of the screen. |
| gfx::Transform transform; |
| @@ -335,13 +341,13 @@ void WindowSelector::Init(const WindowList& windows) { |
| } |
| { |
| - // The calls to WindowGrid::PrepareForOverview() and CreateTextFilter(...) |
| - // requires some LayoutManagers (ie PanelLayoutManager) to perform layouts |
| - // so that windows are correctly visible and properly animated in overview |
| - // mode. Otherwise these layouts should be suppressed during overview mode |
| - // so they don't conflict with overview mode animations. The |
| - // |restoring_minimized_windows_| flag enables the PanelLayoutManager to |
| - // make this decision. |
| + // The calls to WindowGrid::PrepareForOverview() and |
| + // CreateAndActivateTextFilter(...) require some LayoutManagers (i.e. |
| + // PanelLayoutManager) to perform layouts so that windows are correctly |
| + // visible and properly animated in overview mode. Otherwise these layouts |
| + // should be suppressed during overview mode so they don't conflict with |
| + // overview mode animations. The |restoring_minimized_windows_| flag enables |
| + // the PanelLayoutManager to make this decision. |
| base::AutoReset<bool> auto_restoring_minimized_windows( |
| &restoring_minimized_windows_, true); |
| @@ -359,8 +365,8 @@ void WindowSelector::Init(const WindowList& windows) { |
| kTextFilterIconSize, kTextFilterIconColorMD); |
| } |
| WmWindow* root_window = shell->GetPrimaryRootWindow(); |
| - text_filter_widget_.reset(CreateTextFilter(this, root_window, search_image_, |
| - &text_filter_bottom_)); |
| + text_filter_widget_.reset(CreateAndActivateTextFilter( |
| + this, root_window, search_image_, &text_filter_bottom_)); |
| } |
| DCHECK(!grid_list_.empty()); |