OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "ash/wm/overview/window_selector.h" | 5 #include "ash/wm/overview/window_selector.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "ash/accessibility_delegate.h" | 9 #include "ash/accessibility_delegate.h" |
10 #include "ash/ash_switches.h" | 10 #include "ash/ash_switches.h" |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 container->AddObserver(this); | 117 container->AddObserver(this); |
118 observed_windows_.insert(container); | 118 observed_windows_.insert(container); |
119 } | 119 } |
120 scoped_ptr<WindowGrid> grid(new WindowGrid(*iter, windows, this)); | 120 scoped_ptr<WindowGrid> grid(new WindowGrid(*iter, windows, this)); |
121 if (grid->empty()) | 121 if (grid->empty()) |
122 continue; | 122 continue; |
123 num_items_ += grid->size(); | 123 num_items_ += grid->size(); |
124 grid_list_.push_back(grid.release()); | 124 grid_list_.push_back(grid.release()); |
125 } | 125 } |
126 | 126 |
| 127 // Do not call PrepareForOverview until all items are added to window_list_ as |
| 128 // we don't want to cause any window updates until all windows in overview |
| 129 // are observed. See http://crbug.com/384495. |
| 130 for (ScopedVector<WindowGrid>::iterator iter = grid_list_.begin(); |
| 131 iter != grid_list_.end(); ++iter) { |
| 132 (*iter)->PrepareForOverview(); |
| 133 (*iter)->PositionWindows(true); |
| 134 } |
| 135 |
127 DCHECK(!grid_list_.empty()); | 136 DCHECK(!grid_list_.empty()); |
128 UMA_HISTOGRAM_COUNTS_100("Ash.WindowSelector.Items", num_items_); | 137 UMA_HISTOGRAM_COUNTS_100("Ash.WindowSelector.Items", num_items_); |
129 | 138 |
130 shell->activation_client()->AddObserver(this); | 139 shell->activation_client()->AddObserver(this); |
131 | 140 |
132 // Remove focus from active window before entering overview. | 141 // Remove focus from active window before entering overview. |
133 aura::client::GetFocusClient( | 142 aura::client::GetFocusClient( |
134 Shell::GetPrimaryRootWindow())->FocusWindow(NULL); | 143 Shell::GetPrimaryRootWindow())->FocusWindow(NULL); |
135 | 144 |
136 shell->PrependPreTargetHandler(this); | 145 shell->PrependPreTargetHandler(this); |
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
386 // root window, identify it and call Move() on it to initialize the | 395 // root window, identify it and call Move() on it to initialize the |
387 // selection widget. | 396 // selection widget. |
388 // TODO(nsatragno): If there are more than two monitors, move between grids | 397 // TODO(nsatragno): If there are more than two monitors, move between grids |
389 // in the requested direction. | 398 // in the requested direction. |
390 selected_grid_index_ = (selected_grid_index_ + 1) % grid_list_.size(); | 399 selected_grid_index_ = (selected_grid_index_ + 1) % grid_list_.size(); |
391 grid_list_[selected_grid_index_]->Move(direction); | 400 grid_list_[selected_grid_index_]->Move(direction); |
392 } | 401 } |
393 } | 402 } |
394 | 403 |
395 } // namespace ash | 404 } // namespace ash |
OLD | NEW |