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

Side by Side Diff: ash/common/wm/overview/window_grid.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 (tuning) 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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_grid.h" 5 #include "ash/common/wm/overview/window_grid.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 264 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 275
276 WindowGrid::WindowGrid(WmWindow* root_window, 276 WindowGrid::WindowGrid(WmWindow* root_window,
277 const std::vector<WmWindow*>& windows, 277 const std::vector<WmWindow*>& windows,
278 WindowSelector* window_selector) 278 WindowSelector* window_selector)
279 : root_window_(root_window), 279 : root_window_(root_window),
280 window_selector_(window_selector), 280 window_selector_(window_selector),
281 window_observer_(this), 281 window_observer_(this),
282 window_state_observer_(this), 282 window_state_observer_(this),
283 selected_index_(0), 283 selected_index_(0),
284 num_columns_(0), 284 num_columns_(0),
285 prepared_for_overview_(false) { 285 prepared_for_overview_(false),
286 skip_first_(false) {
286 std::vector<WmWindow*> windows_in_root; 287 std::vector<WmWindow*> windows_in_root;
287 for (auto* window : windows) { 288 for (auto* window : windows) {
288 if (window->GetRootWindow() == root_window) 289 if (window->GetRootWindow() == root_window)
289 windows_in_root.push_back(window); 290 windows_in_root.push_back(window);
290 } 291 }
291 292
292 for (auto* window : windows_in_root) { 293 for (auto* window : windows_in_root) {
293 window_observer_.Add(window); 294 window_observer_.Add(window);
294 window_state_observer_.Add(window->GetWindowState()); 295 window_state_observer_.Add(window->GetWindowState());
295 window_list_.push_back( 296 window_list_.push_back(
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
481 // [up] key is equivalent to [left] key and [down] key is equivalent to 482 // [up] key is equivalent to [left] key and [down] key is equivalent to
482 // [right] key. 483 // [right] key.
483 if (!selection_widget_) { 484 if (!selection_widget_) {
484 switch (direction) { 485 switch (direction) {
485 case WindowSelector::UP: 486 case WindowSelector::UP:
486 case WindowSelector::LEFT: 487 case WindowSelector::LEFT:
487 selected_index_ = window_list_.size() - 1; 488 selected_index_ = window_list_.size() - 1;
488 break; 489 break;
489 case WindowSelector::DOWN: 490 case WindowSelector::DOWN:
490 case WindowSelector::RIGHT: 491 case WindowSelector::RIGHT:
491 selected_index_ = 0; 492 selected_index_ = (skip_first_ && window_list_.size() > 1) ? 1 : 0;
492 break; 493 break;
493 } 494 }
495 skip_first_ = false;
494 changed_selection_index = true; 496 changed_selection_index = true;
495 } 497 }
496 while (!changed_selection_index || 498 while (!changed_selection_index ||
497 (!out_of_bounds && window_list_[selected_index_]->dimmed())) { 499 (!out_of_bounds && window_list_[selected_index_]->dimmed())) {
498 switch (direction) { 500 switch (direction) {
499 case WindowSelector::UP: 501 case WindowSelector::UP:
500 case WindowSelector::LEFT: 502 case WindowSelector::LEFT:
501 if (selected_index_ == 0) 503 if (selected_index_ == 0)
502 out_of_bounds = true; 504 out_of_bounds = true;
503 selected_index_--; 505 selected_index_--;
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after
838 *min_right = left; 840 *min_right = left;
839 if (*max_right < left) 841 if (*max_right < left)
840 *max_right = left; 842 *max_right = left;
841 } 843 }
842 *max_bottom = top + height; 844 *max_bottom = top + height;
843 } 845 }
844 return windows_fit; 846 return windows_fit;
845 } 847 }
846 848
847 } // namespace ash 849 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698