Chromium Code Reviews| Index: ash/wm/overview/window_selector.cc |
| diff --git a/ash/wm/overview/window_selector.cc b/ash/wm/overview/window_selector.cc |
| index 76eb46a10de22b2b98d4e610d1ea44844cbcd665..5f512783365bdb3f2de80f750c1a7ad9e748ed35 100644 |
| --- a/ash/wm/overview/window_selector.cc |
| +++ b/ash/wm/overview/window_selector.cc |
| @@ -92,7 +92,7 @@ struct WindowSelectorItemTargetComparator |
| } |
| bool operator()(WindowSelectorItem* window) const { |
| - return window->Contains(target); |
| + return window->GetWindow() == target; |
| } |
| const aura::Window* target; |
| @@ -217,8 +217,7 @@ views::Widget* CreateTextFilter(views::TextfieldController* controller, |
| const int WindowSelector::kTextFilterBottomEdge = |
| kTextFilterDistanceFromTop + kTextFilterHeight; |
| -WindowSelector::WindowSelector(const WindowList& windows, |
| - WindowSelectorDelegate* delegate) |
| +WindowSelector::WindowSelector(WindowSelectorDelegate* delegate) |
| : delegate_(delegate), |
| restore_focus_window_(aura::client::GetFocusClient( |
| Shell::GetPrimaryRootWindow())->GetFocusedWindow()), |
| @@ -229,8 +228,15 @@ WindowSelector::WindowSelector(const WindowList& windows, |
| num_items_(0), |
| showing_selection_widget_(false), |
| text_filter_string_length_(0), |
| - num_times_textfield_cleared_(0) { |
| + num_times_textfield_cleared_(0), |
| + restoring_minimized_windows_(false) { |
| DCHECK(delegate_); |
| +} |
| + |
| +WindowSelector::~WindowSelector() { |
| +} |
| + |
| +void WindowSelector::Init(const WindowList& windows) { |
| Shell* shell = Shell::GetInstance(); |
| shell->OnOverviewModeStarting(); |
| @@ -262,21 +268,33 @@ WindowSelector::WindowSelector(const WindowList& windows, |
| grid_list_.push_back(grid.release()); |
| } |
| - // Do not call PrepareForOverview until all items are added to window_list_ as |
| - // we don't want to cause any window updates until all windows in overview |
| - // are observed. See http://crbug.com/384495. |
| - for (ScopedVector<WindowGrid>::iterator iter = grid_list_.begin(); |
| - iter != grid_list_.end(); ++iter) { |
| - (*iter)->PrepareForOverview(); |
| - (*iter)->PositionWindows(true); |
| + { |
| + // 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. |
| + base::AutoReset<bool> auto_restoring_minimized_windows_( |
| + &restoring_minimized_windows_, true); |
| + |
| + // Do not call PrepareForOverview until all items are added to window_list_ |
| + // as we don't want to cause any window updates until all windows in |
| + // overview are observed. See http://crbug.com/384495. |
| + for (ScopedVector<WindowGrid>::iterator iter = grid_list_.begin(); |
|
jonross
2015/01/15 13:37:47
switch to for(auto iter : grid_list_)
bruthig
2015/01/15 18:27:25
Done.
|
| + iter != grid_list_.end(); ++iter) { |
| + (*iter)->PrepareForOverview(); |
| + (*iter)->PositionWindows(true); |
| + } |
| + |
| + text_filter_widget_.reset( |
| + CreateTextFilter(this, Shell::GetPrimaryRootWindow())); |
| } |
| DCHECK(!grid_list_.empty()); |
| UMA_HISTOGRAM_COUNTS_100("Ash.WindowSelector.Items", num_items_); |
| - text_filter_widget_.reset( |
| - CreateTextFilter(this, Shell::GetPrimaryRootWindow())); |
| - |
| shell->activation_client()->AddObserver(this); |
| shell->GetScreen()->AddObserver(this); |
| @@ -289,7 +307,7 @@ WindowSelector::WindowSelector(const WindowList& windows, |
| UpdateShelfVisibility(); |
| } |
| -WindowSelector::~WindowSelector() { |
| +void WindowSelector::Shutdown() { |
| Shell* shell = Shell::GetInstance(); |
| ResetFocusRestoreWindow(true); |
| @@ -409,7 +427,7 @@ bool WindowSelector::HandleKeyEvent(views::Textfield* sender, |
| Shell::GetInstance()->metrics()->RecordUserMetricsAction( |
| UMA_WINDOW_OVERVIEW_ENTER_KEY); |
| wm::GetWindowState(grid_list_[selected_grid_index_]-> |
| - SelectedWindow()->SelectionWindow())->Activate(); |
| + SelectedWindow()->GetWindow())->Activate(); |
| break; |
| default: |
| // Not a key we are interested in, allow the textfield to handle it. |