Chromium Code Reviews| Index: ash/common/wm/overview/window_grid.cc |
| diff --git a/ash/common/wm/overview/window_grid.cc b/ash/common/wm/overview/window_grid.cc |
| index 9510eda43d5ba8a19e13bb15445eed35cd7d0db7..9b29986c9c2b2efbc1224aac0494ec9423ae19ef 100644 |
| --- a/ash/common/wm/overview/window_grid.cc |
| +++ b/ash/common/wm/overview/window_grid.cc |
| @@ -262,6 +262,11 @@ views::Widget* CreateBackgroundWidget(WmWindow* root_window, |
| return widget; |
| } |
| +bool IsMinimizedStateType(wm::WindowStateType type) { |
| + return type == wm::WINDOW_STATE_TYPE_DOCKED_MINIMIZED || |
| + type == wm::WINDOW_STATE_TYPE_MINIMIZED; |
| +} |
| + |
| } // namespace |
| WindowGrid::WindowGrid(WmWindow* root_window, |
| @@ -270,6 +275,7 @@ WindowGrid::WindowGrid(WmWindow* root_window, |
| : root_window_(root_window), |
| window_selector_(window_selector), |
| window_observer_(this), |
| + window_state_observer_(this), |
| selected_index_(0), |
| num_columns_(0), |
| prepared_for_overview_(false) { |
| @@ -281,6 +287,7 @@ WindowGrid::WindowGrid(WmWindow* root_window, |
| for (auto* window : windows_in_root) { |
| window_observer_.Add(window); |
| + window_state_observer_.Add(window->GetWindowState()); |
| window_list_.push_back(new WindowSelectorItem(window, window_selector_)); |
| } |
| } |
| @@ -558,6 +565,7 @@ void WindowGrid::WindowClosing(WindowSelectorItem* window) { |
| void WindowGrid::OnWindowDestroying(WmWindow* window) { |
| window_observer_.Remove(window); |
| + window_state_observer_.Remove(window->GetWindowState()); |
| ScopedVector<WindowSelectorItem>::iterator iter = |
| std::find_if(window_list_.begin(), window_list_.end(), |
| WindowSelectorItemComparator(window)); |
| @@ -590,9 +598,8 @@ void WindowGrid::OnWindowDestroying(WmWindow* window) { |
| void WindowGrid::OnWindowBoundsChanged(WmWindow* window, |
| const gfx::Rect& old_bounds, |
| const gfx::Rect& new_bounds) { |
| - // During preparation, window bounds can change (e.g. by unminimizing a |
| - // window). Ignore bounds change notifications in this case; we'll reposition |
| - // soon. |
| + // During preparation, window bounds can change. Ignore bounds |
| + // change notifications in this case; we'll reposition soon. |
| if (!prepared_for_overview_) |
| return; |
| @@ -605,6 +612,27 @@ void WindowGrid::OnWindowBoundsChanged(WmWindow* window, |
| PositionWindows(false); |
| } |
| +void WindowGrid::OnPostWindowStateTypeChange(wm::WindowState* window_state, |
| + wm::WindowStateType old_type) { |
| + // During preparation, window state can change. (e.g. updating shelf |
| + // visibility may show the temporary hidden (minimized) panels. |
|
varkha
2016/11/08 00:02:56
nit: temporarily
nit: mismatched () in the comment
|
| + if (!prepared_for_overview_) |
| + return; |
| + |
| + wm::WindowStateType new_type = window_state->GetStateType(); |
| + if (IsMinimizedStateType(old_type) == IsMinimizedStateType(new_type)) |
| + return; |
| + |
| + auto iter = std::find_if(window_list_.begin(), window_list_.end(), |
| + [window_state](WindowSelectorItem* item) { |
| + return item->Contains(window_state->window()); |
| + }); |
| + if (iter != window_list_.end()) { |
| + (*iter)->OnMinimizedStateChanged(); |
| + PositionWindows(false); |
| + } |
| +} |
| + |
| void WindowGrid::InitShieldWidget() { |
| // TODO(varkha): The code assumes that SHELF_BACKGROUND_MAXIMIZED is |
| // synonymous with a black shelf background. Update this code if that |