| 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> |
| 11 #include <vector> | 11 #include <vector> |
| 12 | 12 |
| 13 #include "ash/accessibility_delegate.h" | 13 #include "ash/accessibility_delegate.h" |
| 14 #include "ash/ash_switches.h" | 14 #include "ash/ash_switches.h" |
| 15 #include "ash/metrics/user_metrics_recorder.h" | 15 #include "ash/metrics/user_metrics_recorder.h" |
| 16 #include "ash/root_window_controller.h" | 16 #include "ash/root_window_controller.h" |
| 17 #include "ash/shell.h" | 17 #include "ash/shell.h" |
| 18 #include "ash/shell_window_ids.h" | 18 #include "ash/shell_window_ids.h" |
| 19 #include "ash/switchable_windows.h" | 19 #include "ash/switchable_windows.h" |
| 20 #include "ash/wm/aura/wm_window_aura.h" |
| 20 #include "ash/wm/mru_window_tracker.h" | 21 #include "ash/wm/mru_window_tracker.h" |
| 21 #include "ash/wm/overview/window_grid.h" | 22 #include "ash/wm/overview/window_grid.h" |
| 22 #include "ash/wm/overview/window_selector_delegate.h" | 23 #include "ash/wm/overview/window_selector_delegate.h" |
| 23 #include "ash/wm/overview/window_selector_item.h" | 24 #include "ash/wm/overview/window_selector_item.h" |
| 24 #include "ash/wm/panels/panel_layout_manager.h" | 25 #include "ash/wm/panels/panel_layout_manager.h" |
| 25 #include "ash/wm/window_state.h" | 26 #include "ash/wm/window_state.h" |
| 26 #include "ash/wm/window_state_aura.h" | 27 #include "ash/wm/window_state_aura.h" |
| 27 #include "ash/wm/window_util.h" | 28 #include "ash/wm/window_util.h" |
| 28 #include "base/auto_reset.h" | 29 #include "base/auto_reset.h" |
| 29 #include "base/command_line.h" | 30 #include "base/command_line.h" |
| (...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 271 // windows. | 272 // windows. |
| 272 for (size_t i = 0; i < kSwitchableWindowContainerIdsLength; ++i) { | 273 for (size_t i = 0; i < kSwitchableWindowContainerIdsLength; ++i) { |
| 273 aura::Window* container = Shell::GetContainer(*iter, | 274 aura::Window* container = Shell::GetContainer(*iter, |
| 274 kSwitchableWindowContainerIds[i]); | 275 kSwitchableWindowContainerIds[i]); |
| 275 container->AddObserver(this); | 276 container->AddObserver(this); |
| 276 observed_windows_.insert(container); | 277 observed_windows_.insert(container); |
| 277 } | 278 } |
| 278 | 279 |
| 279 // Hide the callout widgets for panels. It is safe to call this for | 280 // Hide the callout widgets for panels. It is safe to call this for |
| 280 // root windows that don't contain any panel windows. | 281 // root windows that don't contain any panel windows. |
| 281 static_cast<PanelLayoutManager*>( | 282 PanelLayoutManager::Get(wm::WmWindowAura::Get(*iter)) |
| 282 Shell::GetContainer(*iter, kShellWindowId_PanelContainer) | 283 ->SetShowCalloutWidgets(false); |
| 283 ->layout_manager())->SetShowCalloutWidgets(false); | |
| 284 | 284 |
| 285 std::unique_ptr<WindowGrid> grid(new WindowGrid(*iter, windows, this)); | 285 std::unique_ptr<WindowGrid> grid(new WindowGrid(*iter, windows, this)); |
| 286 if (grid->empty()) | 286 if (grid->empty()) |
| 287 continue; | 287 continue; |
| 288 num_items_ += grid->size(); | 288 num_items_ += grid->size(); |
| 289 grid_list_.push_back(std::move(grid)); | 289 grid_list_.push_back(std::move(grid)); |
| 290 } | 290 } |
| 291 | 291 |
| 292 { | 292 { |
| 293 // The calls to WindowGrid::PrepareForOverview() and CreateTextFilter(...) | 293 // The calls to WindowGrid::PrepareForOverview() and CreateTextFilter(...) |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 333 // calls to restoring_minimized_windows() on a partially destructed object. | 333 // calls to restoring_minimized_windows() on a partially destructed object. |
| 334 void WindowSelector::Shutdown() { | 334 void WindowSelector::Shutdown() { |
| 335 ResetFocusRestoreWindow(true); | 335 ResetFocusRestoreWindow(true); |
| 336 RemoveAllObservers(); | 336 RemoveAllObservers(); |
| 337 | 337 |
| 338 aura::Window::Windows root_windows = Shell::GetAllRootWindows(); | 338 aura::Window::Windows root_windows = Shell::GetAllRootWindows(); |
| 339 for (aura::Window::Windows::const_iterator iter = root_windows.begin(); | 339 for (aura::Window::Windows::const_iterator iter = root_windows.begin(); |
| 340 iter != root_windows.end(); iter++) { | 340 iter != root_windows.end(); iter++) { |
| 341 // 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 |
| 342 // root_windows that don't contain any panel windows. | 342 // root_windows that don't contain any panel windows. |
| 343 static_cast<PanelLayoutManager*>( | 343 PanelLayoutManager::Get(wm::WmWindowAura::Get(*iter)) |
| 344 Shell::GetContainer(*iter, kShellWindowId_PanelContainer) | 344 ->SetShowCalloutWidgets(true); |
| 345 ->layout_manager())->SetShowCalloutWidgets(true); | |
| 346 } | 345 } |
| 347 | 346 |
| 348 size_t remaining_items = 0; | 347 size_t remaining_items = 0; |
| 349 for (WindowGrid* window_grid : grid_list_) { | 348 for (WindowGrid* window_grid : grid_list_) { |
| 350 for (WindowSelectorItem* window_selector_item : window_grid->window_list()) | 349 for (WindowSelectorItem* window_selector_item : window_grid->window_list()) |
| 351 window_selector_item->RestoreWindow(); | 350 window_selector_item->RestoreWindow(); |
| 352 remaining_items += window_grid->size(); | 351 remaining_items += window_grid->size(); |
| 353 } | 352 } |
| 354 | 353 |
| 355 DCHECK(num_items_ >= remaining_items); | 354 DCHECK(num_items_ >= remaining_items); |
| (...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 636 for (size_t i = 0; | 635 for (size_t i = 0; |
| 637 i <= grid_list_.size() && | 636 i <= grid_list_.size() && |
| 638 grid_list_[selected_grid_index_]->Move(direction, animate); i++) { | 637 grid_list_[selected_grid_index_]->Move(direction, animate); i++) { |
| 639 selected_grid_index_ = | 638 selected_grid_index_ = |
| 640 (selected_grid_index_ + display_direction + grid_list_.size()) % | 639 (selected_grid_index_ + display_direction + grid_list_.size()) % |
| 641 grid_list_.size(); | 640 grid_list_.size(); |
| 642 } | 641 } |
| 643 } | 642 } |
| 644 | 643 |
| 645 } // namespace ash | 644 } // namespace ash |
| OLD | NEW |