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

Side by Side Diff: ash/common/wm/overview/window_selector.cc

Issue 2667293002: [ash-md] Adds support for gesture to move selection in overview mode (Closed)
Patch Set: [ash-md] Adds support for gesture to move selection in overview mode (no skipping 1st) Created 3 years, 10 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 unified diff | Download patch
OLDNEW
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 386 matching lines...) Expand 10 before | Expand all | Expand 10 after
397 selected_grid_index_--; 397 selected_grid_index_--;
398 // If the grid which became empty was the one with the selected window, we 398 // If the grid which became empty was the one with the selected window, we
399 // need to select a window on the newly selected grid. 399 // need to select a window on the newly selected grid.
400 if (selected_grid_index_ == index - 1) 400 if (selected_grid_index_ == index - 1)
401 Move(LEFT, true); 401 Move(LEFT, true);
402 } 402 }
403 if (grid_list_.empty()) 403 if (grid_list_.empty())
404 CancelSelection(); 404 CancelSelection();
405 } 405 }
406 406
407 void WindowSelector::IncrementSelection(int increment) {
408 const Direction direction =
409 increment > 0 ? WindowSelector::RIGHT : WindowSelector::LEFT;
410 for (int step = 0; step < abs(increment); ++step)
411 Move(direction, true);
412 }
413
414 bool WindowSelector::AcceptSelection() {
415 if (!grid_list_[selected_grid_index_]->is_selecting())
416 return false;
417 SelectWindow(grid_list_[selected_grid_index_]->SelectedWindow());
418 return true;
419 }
420
407 void WindowSelector::SelectWindow(WindowSelectorItem* item) { 421 void WindowSelector::SelectWindow(WindowSelectorItem* item) {
408 WmWindow* window = item->GetWindow(); 422 WmWindow* window = item->GetWindow();
409 std::vector<WmWindow*> window_list = 423 std::vector<WmWindow*> window_list =
410 WmShell::Get()->mru_window_tracker()->BuildMruWindowList(); 424 WmShell::Get()->mru_window_tracker()->BuildMruWindowList();
411 if (!window_list.empty()) { 425 if (!window_list.empty()) {
412 // Record UMA_WINDOW_OVERVIEW_ACTIVE_WINDOW_CHANGED if the user is selecting 426 // Record UMA_WINDOW_OVERVIEW_ACTIVE_WINDOW_CHANGED if the user is selecting
413 // a window other than the window that was active prior to entering overview 427 // a window other than the window that was active prior to entering overview
414 // mode (i.e., the window at the front of the MRU list). 428 // mode (i.e., the window at the front of the MRU list).
415 if (window_list[0] != window) { 429 if (window_list[0] != window) {
416 WmShell::Get()->RecordUserMetricsAction( 430 WmShell::Get()->RecordUserMetricsAction(
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
663 for (size_t i = 0; i <= grid_list_.size() && 677 for (size_t i = 0; i <= grid_list_.size() &&
664 grid_list_[selected_grid_index_]->Move(direction, animate); 678 grid_list_[selected_grid_index_]->Move(direction, animate);
665 i++) { 679 i++) {
666 selected_grid_index_ = 680 selected_grid_index_ =
667 (selected_grid_index_ + display_direction + grid_list_.size()) % 681 (selected_grid_index_ + display_direction + grid_list_.size()) %
668 grid_list_.size(); 682 grid_list_.size();
669 } 683 }
670 } 684 }
671 685
672 } // namespace ash 686 } // namespace ash
OLDNEW
« no previous file with comments | « ash/common/wm/overview/window_selector.h ('k') | ash/common/wm/overview/window_selector_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698