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

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

Issue 2657453003: [ash-md] Makes sure that minimized windows can be activated in overview (Closed)
Patch Set: Created 3 years, 11 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
« no previous file with comments | « ash/common/wm/overview/window_selector.h ('k') | ash/common/wm/overview/window_selector_item.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 389 matching lines...) Expand 10 before | Expand all | Expand 10 after
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::SelectWindow(WmWindow* window) { 410 void WindowSelector::SelectWindow(WindowSelectorItem* item) {
411 WmWindow* window = item->GetWindow();
411 std::vector<WmWindow*> window_list = 412 std::vector<WmWindow*> window_list =
412 WmShell::Get()->mru_window_tracker()->BuildMruWindowList(); 413 WmShell::Get()->mru_window_tracker()->BuildMruWindowList();
413 if (!window_list.empty()) { 414 if (!window_list.empty()) {
414 // Record UMA_WINDOW_OVERVIEW_ACTIVE_WINDOW_CHANGED if the user is selecting 415 // Record UMA_WINDOW_OVERVIEW_ACTIVE_WINDOW_CHANGED if the user is selecting
415 // a window other than the window that was active prior to entering overview 416 // a window other than the window that was active prior to entering overview
416 // mode (i.e., the window at the front of the MRU list). 417 // mode (i.e., the window at the front of the MRU list).
417 if (window_list[0] != window) { 418 if (window_list[0] != window) {
418 WmShell::Get()->RecordUserMetricsAction( 419 WmShell::Get()->RecordUserMetricsAction(
419 UMA_WINDOW_OVERVIEW_ACTIVE_WINDOW_CHANGED); 420 UMA_WINDOW_OVERVIEW_ACTIVE_WINDOW_CHANGED);
420 } 421 }
421 const auto it = std::find(window_list.begin(), window_list.end(), window); 422 const auto it = std::find(window_list.begin(), window_list.end(), window);
422 if (it != window_list.end()) { 423 if (it != window_list.end()) {
423 // Record 1-based index so that selecting a top MRU window will record 1. 424 // Record 1-based index so that selecting a top MRU window will record 1.
424 UMA_HISTOGRAM_COUNTS_100("Ash.WindowSelector.SelectionDepth", 425 UMA_HISTOGRAM_COUNTS_100("Ash.WindowSelector.SelectionDepth",
425 1 + it - window_list.begin()); 426 1 + it - window_list.begin());
426 } 427 }
427 } 428 }
428 429 item->EnsureVisible();
429 window->GetWindowState()->Activate(); 430 window->GetWindowState()->Activate();
430 } 431 }
431 432
432 void WindowSelector::WindowClosing(WindowSelectorItem* window) { 433 void WindowSelector::WindowClosing(WindowSelectorItem* window) {
433 grid_list_[selected_grid_index_]->WindowClosing(window); 434 grid_list_[selected_grid_index_]->WindowClosing(window);
434 } 435 }
435 436
436 bool WindowSelector::HandleKeyEvent(views::Textfield* sender, 437 bool WindowSelector::HandleKeyEvent(views::Textfield* sender,
437 const ui::KeyEvent& key_event) { 438 const ui::KeyEvent& key_event) {
438 if (key_event.type() != ui::ET_KEY_PRESSED) 439 if (key_event.type() != ui::ET_KEY_PRESSED)
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
474 case ui::VKEY_RETURN: 475 case ui::VKEY_RETURN:
475 // Ignore if no item is selected. 476 // Ignore if no item is selected.
476 if (!grid_list_[selected_grid_index_]->is_selecting()) 477 if (!grid_list_[selected_grid_index_]->is_selecting())
477 return false; 478 return false;
478 UMA_HISTOGRAM_COUNTS_100("Ash.WindowSelector.ArrowKeyPresses", 479 UMA_HISTOGRAM_COUNTS_100("Ash.WindowSelector.ArrowKeyPresses",
479 num_key_presses_); 480 num_key_presses_);
480 UMA_HISTOGRAM_CUSTOM_COUNTS("Ash.WindowSelector.KeyPressesOverItemsRatio", 481 UMA_HISTOGRAM_CUSTOM_COUNTS("Ash.WindowSelector.KeyPressesOverItemsRatio",
481 (num_key_presses_ * 100) / num_items_, 1, 300, 482 (num_key_presses_ * 100) / num_items_, 1, 300,
482 30); 483 30);
483 WmShell::Get()->RecordUserMetricsAction(UMA_WINDOW_OVERVIEW_ENTER_KEY); 484 WmShell::Get()->RecordUserMetricsAction(UMA_WINDOW_OVERVIEW_ENTER_KEY);
484 SelectWindow( 485 SelectWindow(grid_list_[selected_grid_index_]->SelectedWindow());
485 grid_list_[selected_grid_index_]->SelectedWindow()->GetWindow());
486 break; 486 break;
487 default: 487 default:
488 // Not a key we are interested in, allow the textfield to handle it. 488 // Not a key we are interested in, allow the textfield to handle it.
489 return false; 489 return false;
490 } 490 }
491 return true; 491 return true;
492 } 492 }
493 493
494 void WindowSelector::OnDisplayAdded(const display::Display& display) {} 494 void WindowSelector::OnDisplayAdded(const display::Display& display) {}
495 495
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
666 for (size_t i = 0; i <= grid_list_.size() && 666 for (size_t i = 0; i <= grid_list_.size() &&
667 grid_list_[selected_grid_index_]->Move(direction, animate); 667 grid_list_[selected_grid_index_]->Move(direction, animate);
668 i++) { 668 i++) {
669 selected_grid_index_ = 669 selected_grid_index_ =
670 (selected_grid_index_ + display_direction + grid_list_.size()) % 670 (selected_grid_index_ + display_direction + grid_list_.size()) %
671 grid_list_.size(); 671 grid_list_.size();
672 } 672 }
673 } 673 }
674 674
675 } // namespace ash 675 } // namespace ash
OLDNEW
« no previous file with comments | « ash/common/wm/overview/window_selector.h ('k') | ash/common/wm/overview/window_selector_item.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698