| 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/common/wm/overview/window_selector.h" | 5 #include "ash/common/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 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 400 selected_grid_index_--; | 400 selected_grid_index_--; |
| 401 // If the grid which became empty was the one with the selected window, we | 401 // If the grid which became empty was the one with the selected window, we |
| 402 // need to select a window on the newly selected grid. | 402 // need to select a window on the newly selected grid. |
| 403 if (selected_grid_index_ == index - 1) | 403 if (selected_grid_index_ == index - 1) |
| 404 Move(LEFT, true); | 404 Move(LEFT, true); |
| 405 } | 405 } |
| 406 if (grid_list_.empty()) | 406 if (grid_list_.empty()) |
| 407 CancelSelection(); | 407 CancelSelection(); |
| 408 } | 408 } |
| 409 | 409 |
| 410 void WindowSelector::IncrementSelection(int increment) { |
| 411 const Direction direction = |
| 412 increment > 0 ? WindowSelector::RIGHT : WindowSelector::LEFT; |
| 413 for (int step = 0; step < abs(increment); ++step) |
| 414 Move(direction, true); |
| 415 } |
| 416 |
| 417 bool WindowSelector::AcceptSelection() { |
| 418 if (!grid_list_[selected_grid_index_]->is_selecting()) |
| 419 return false; |
| 420 SelectWindow(grid_list_[selected_grid_index_]->SelectedWindow()); |
| 421 return true; |
| 422 } |
| 423 |
| 410 void WindowSelector::SelectWindow(WindowSelectorItem* item) { | 424 void WindowSelector::SelectWindow(WindowSelectorItem* item) { |
| 411 WmWindow* window = item->GetWindow(); | 425 WmWindow* window = item->GetWindow(); |
| 412 std::vector<WmWindow*> window_list = | 426 std::vector<WmWindow*> window_list = |
| 413 WmShell::Get()->mru_window_tracker()->BuildMruWindowList(); | 427 WmShell::Get()->mru_window_tracker()->BuildMruWindowList(); |
| 414 if (!window_list.empty()) { | 428 if (!window_list.empty()) { |
| 415 // Record UMA_WINDOW_OVERVIEW_ACTIVE_WINDOW_CHANGED if the user is selecting | 429 // Record UMA_WINDOW_OVERVIEW_ACTIVE_WINDOW_CHANGED if the user is selecting |
| 416 // a window other than the window that was active prior to entering overview | 430 // a window other than the window that was active prior to entering overview |
| 417 // mode (i.e., the window at the front of the MRU list). | 431 // mode (i.e., the window at the front of the MRU list). |
| 418 if (window_list[0] != window) { | 432 if (window_list[0] != window) { |
| 419 WmShell::Get()->RecordUserMetricsAction( | 433 WmShell::Get()->RecordUserMetricsAction( |
| (...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 666 for (size_t i = 0; i <= grid_list_.size() && | 680 for (size_t i = 0; i <= grid_list_.size() && |
| 667 grid_list_[selected_grid_index_]->Move(direction, animate); | 681 grid_list_[selected_grid_index_]->Move(direction, animate); |
| 668 i++) { | 682 i++) { |
| 669 selected_grid_index_ = | 683 selected_grid_index_ = |
| 670 (selected_grid_index_ + display_direction + grid_list_.size()) % | 684 (selected_grid_index_ + display_direction + grid_list_.size()) % |
| 671 grid_list_.size(); | 685 grid_list_.size(); |
| 672 } | 686 } |
| 673 } | 687 } |
| 674 | 688 |
| 675 } // namespace ash | 689 } // namespace ash |
| OLD | NEW |