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 #include <functional> | 8 #include <functional> |
9 #include <set> | 9 #include <set> |
10 #include <utility> | 10 #include <utility> |
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
261 // windows. | 261 // windows. |
262 for (size_t i = 0; i < wm::kSwitchableWindowContainerIdsLength; ++i) { | 262 for (size_t i = 0; i < wm::kSwitchableWindowContainerIdsLength; ++i) { |
263 aura::Window* container = | 263 aura::Window* container = |
264 root->GetChildById(wm::kSwitchableWindowContainerIds[i]); | 264 root->GetChildById(wm::kSwitchableWindowContainerIds[i]); |
265 container->AddObserver(this); | 265 container->AddObserver(this); |
266 observed_windows_.insert(container); | 266 observed_windows_.insert(container); |
267 } | 267 } |
268 | 268 |
269 // Hide the callout widgets for panels. It is safe to call this for | 269 // Hide the callout widgets for panels. It is safe to call this for |
270 // root windows that don't contain any panel windows. | 270 // root windows that don't contain any panel windows. |
271 PanelLayoutManager::Get(WmWindow::Get(root))->SetShowCalloutWidgets(false); | 271 PanelLayoutManager::Get(root)->SetShowCalloutWidgets(false); |
272 | 272 |
273 std::unique_ptr<WindowGrid> grid(new WindowGrid(root, windows, this)); | 273 std::unique_ptr<WindowGrid> grid(new WindowGrid(root, windows, this)); |
274 if (grid->empty()) | 274 if (grid->empty()) |
275 continue; | 275 continue; |
276 num_items_ += grid->size(); | 276 num_items_ += grid->size(); |
277 grid_list_.push_back(std::move(grid)); | 277 grid_list_.push_back(std::move(grid)); |
278 } | 278 } |
279 | 279 |
280 { | 280 { |
281 // The calls to WindowGrid::PrepareForOverview() and CreateTextFilter(...) | 281 // The calls to WindowGrid::PrepareForOverview() and CreateTextFilter(...) |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
330 for (std::unique_ptr<WindowGrid>& window_grid : grid_list_) { | 330 for (std::unique_ptr<WindowGrid>& window_grid : grid_list_) { |
331 for (const auto& window_selector_item : window_grid->window_list()) | 331 for (const auto& window_selector_item : window_grid->window_list()) |
332 window_selector_item->RestoreWindow(); | 332 window_selector_item->RestoreWindow(); |
333 remaining_items += window_grid->size(); | 333 remaining_items += window_grid->size(); |
334 } | 334 } |
335 | 335 |
336 // Setting focus after restoring windows' state avoids unnecessary animations. | 336 // Setting focus after restoring windows' state avoids unnecessary animations. |
337 ResetFocusRestoreWindow(true); | 337 ResetFocusRestoreWindow(true); |
338 RemoveAllObservers(); | 338 RemoveAllObservers(); |
339 | 339 |
340 std::vector<WmWindow*> root_windows = ShellPort::Get()->GetAllRootWindows(); | 340 for (aura::Window* window : Shell::GetAllRootWindows()) { |
341 for (WmWindow* window : root_windows) { | |
342 // Un-hide the callout widgets for panels. It is safe to call this for | 341 // Un-hide the callout widgets for panels. It is safe to call this for |
343 // root_windows that don't contain any panel windows. | 342 // root_windows that don't contain any panel windows. |
344 PanelLayoutManager::Get(window)->SetShowCalloutWidgets(true); | 343 PanelLayoutManager::Get(window)->SetShowCalloutWidgets(true); |
345 } | 344 } |
346 | 345 |
347 for (std::unique_ptr<WindowGrid>& window_grid : grid_list_) | 346 for (std::unique_ptr<WindowGrid>& window_grid : grid_list_) |
348 window_grid->Shutdown(); | 347 window_grid->Shutdown(); |
349 | 348 |
350 DCHECK(num_items_ >= remaining_items); | 349 DCHECK(num_items_ >= remaining_items); |
351 UMA_HISTOGRAM_COUNTS_100("Ash.WindowSelector.OverviewClosedItems", | 350 UMA_HISTOGRAM_COUNTS_100("Ash.WindowSelector.OverviewClosedItems", |
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
679 for (size_t i = 0; i <= grid_list_.size() && | 678 for (size_t i = 0; i <= grid_list_.size() && |
680 grid_list_[selected_grid_index_]->Move(direction, animate); | 679 grid_list_[selected_grid_index_]->Move(direction, animate); |
681 i++) { | 680 i++) { |
682 selected_grid_index_ = | 681 selected_grid_index_ = |
683 (selected_grid_index_ + display_direction + grid_list_.size()) % | 682 (selected_grid_index_ + display_direction + grid_list_.size()) % |
684 grid_list_.size(); | 683 grid_list_.size(); |
685 } | 684 } |
686 } | 685 } |
687 | 686 |
688 } // namespace ash | 687 } // namespace ash |
OLD | NEW |