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

Unified Diff: ash/wm/overview/window_selector.cc

Issue 844763006: Change overview mode to so that docked panel windows are not grouped together. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Moved restore window animation out of the ScopedTransformOverviewWindow destructor. Created 5 years, 11 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
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..a59fb3e0dcaf4aa3b6e696e39096ab6ab88e79ad 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,32 @@ 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 (auto window_grid : grid_list_) {
+ window_grid->PrepareForOverview();
+ window_grid->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 +306,7 @@ WindowSelector::WindowSelector(const WindowList& windows,
UpdateShelfVisibility();
}
-WindowSelector::~WindowSelector() {
+void WindowSelector::Shutdown() {
Shell* shell = Shell::GetInstance();
ResetFocusRestoreWindow(true);
@@ -322,9 +339,10 @@ WindowSelector::~WindowSelector() {
shell->GetScreen()->RemoveObserver(this);
size_t remaining_items = 0;
- for (ScopedVector<WindowGrid>::iterator iter = grid_list_.begin();
- iter != grid_list_.end(); iter++) {
- remaining_items += (*iter)->size();
+ for (auto window_grid : grid_list_) {
+ for (auto window_selector_item : window_grid->window_list())
+ window_selector_item->RestoreWindow();
+ remaining_items += window_grid->size();
}
DCHECK(num_items_ >= remaining_items);
@@ -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.
@@ -474,7 +492,7 @@ void WindowSelector::OnWindowActivated(aura::Window* gained_active,
WindowSelectorItemTargetComparator(gained_active));
if (iter != windows.end())
- (*iter)->RestoreWindowOnExit(gained_active);
+ (*iter)->ShowWindowOnExit();
// Don't restore focus on exit if a window was just activated.
ResetFocusRestoreWindow(false);

Powered by Google App Engine
This is Rietveld 408576698