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

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

Issue 2654153002: [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 405 matching lines...) Expand 10 before | Expand all | Expand 10 after
416 selected_grid_index_--; 416 selected_grid_index_--;
417 // If the grid which became empty was the one with the selected window, we 417 // If the grid which became empty was the one with the selected window, we
418 // need to select a window on the newly selected grid. 418 // need to select a window on the newly selected grid.
419 if (selected_grid_index_ == index - 1) 419 if (selected_grid_index_ == index - 1)
420 Move(LEFT, true); 420 Move(LEFT, true);
421 } 421 }
422 if (grid_list_.empty()) 422 if (grid_list_.empty())
423 CancelSelection(); 423 CancelSelection();
424 } 424 }
425 425
426 void WindowSelector::SelectWindow(WmWindow* window) { 426 void WindowSelector::SelectWindow(WindowSelectorItem* item) {
427 WmWindow* window = item->GetWindow();
427 std::vector<WmWindow*> window_list = 428 std::vector<WmWindow*> window_list =
428 WmShell::Get()->mru_window_tracker()->BuildMruWindowList(); 429 WmShell::Get()->mru_window_tracker()->BuildMruWindowList();
429 if (!window_list.empty()) { 430 if (!window_list.empty()) {
430 // Record UMA_WINDOW_OVERVIEW_ACTIVE_WINDOW_CHANGED if the user is selecting 431 // Record UMA_WINDOW_OVERVIEW_ACTIVE_WINDOW_CHANGED if the user is selecting
431 // a window other than the window that was active prior to entering overview 432 // a window other than the window that was active prior to entering overview
432 // mode (i.e., the window at the front of the MRU list). 433 // mode (i.e., the window at the front of the MRU list).
433 if (window_list[0] != window) { 434 if (window_list[0] != window) {
434 WmShell::Get()->RecordUserMetricsAction( 435 WmShell::Get()->RecordUserMetricsAction(
435 UMA_WINDOW_OVERVIEW_ACTIVE_WINDOW_CHANGED); 436 UMA_WINDOW_OVERVIEW_ACTIVE_WINDOW_CHANGED);
436 } 437 }
437 const auto it = std::find(window_list.begin(), window_list.end(), window); 438 const auto it = std::find(window_list.begin(), window_list.end(), window);
438 if (it != window_list.end()) { 439 if (it != window_list.end()) {
439 // Record 1-based index so that selecting a top MRU window will record 1. 440 // Record 1-based index so that selecting a top MRU window will record 1.
440 UMA_HISTOGRAM_COUNTS_100("Ash.WindowSelector.SelectionDepth", 441 UMA_HISTOGRAM_COUNTS_100("Ash.WindowSelector.SelectionDepth",
441 1 + it - window_list.begin()); 442 1 + it - window_list.begin());
442 } 443 }
443 } 444 }
444 445 item->EnsureVisible();
445 window->GetWindowState()->Activate(); 446 window->GetWindowState()->Activate();
446 } 447 }
447 448
448 void WindowSelector::WindowClosing(WindowSelectorItem* window) { 449 void WindowSelector::WindowClosing(WindowSelectorItem* window) {
449 grid_list_[selected_grid_index_]->WindowClosing(window); 450 grid_list_[selected_grid_index_]->WindowClosing(window);
450 } 451 }
451 452
452 bool WindowSelector::HandleKeyEvent(views::Textfield* sender, 453 bool WindowSelector::HandleKeyEvent(views::Textfield* sender,
453 const ui::KeyEvent& key_event) { 454 const ui::KeyEvent& key_event) {
454 if (key_event.type() != ui::ET_KEY_PRESSED) 455 if (key_event.type() != ui::ET_KEY_PRESSED)
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
490 case ui::VKEY_RETURN: 491 case ui::VKEY_RETURN:
491 // Ignore if no item is selected. 492 // Ignore if no item is selected.
492 if (!grid_list_[selected_grid_index_]->is_selecting()) 493 if (!grid_list_[selected_grid_index_]->is_selecting())
493 return false; 494 return false;
494 UMA_HISTOGRAM_COUNTS_100("Ash.WindowSelector.ArrowKeyPresses", 495 UMA_HISTOGRAM_COUNTS_100("Ash.WindowSelector.ArrowKeyPresses",
495 num_key_presses_); 496 num_key_presses_);
496 UMA_HISTOGRAM_CUSTOM_COUNTS("Ash.WindowSelector.KeyPressesOverItemsRatio", 497 UMA_HISTOGRAM_CUSTOM_COUNTS("Ash.WindowSelector.KeyPressesOverItemsRatio",
497 (num_key_presses_ * 100) / num_items_, 1, 300, 498 (num_key_presses_ * 100) / num_items_, 1, 300,
498 30); 499 30);
499 WmShell::Get()->RecordUserMetricsAction(UMA_WINDOW_OVERVIEW_ENTER_KEY); 500 WmShell::Get()->RecordUserMetricsAction(UMA_WINDOW_OVERVIEW_ENTER_KEY);
500 SelectWindow( 501 SelectWindow(grid_list_[selected_grid_index_]->SelectedWindow());
501 grid_list_[selected_grid_index_]->SelectedWindow()->GetWindow());
502 break; 502 break;
503 default: 503 default:
504 // Not a key we are interested in, allow the textfield to handle it. 504 // Not a key we are interested in, allow the textfield to handle it.
505 return false; 505 return false;
506 } 506 }
507 return true; 507 return true;
508 } 508 }
509 509
510 void WindowSelector::OnDisplayAdded(const display::Display& display) {} 510 void WindowSelector::OnDisplayAdded(const display::Display& display) {}
511 511
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
674 for (size_t i = 0; i <= grid_list_.size() && 674 for (size_t i = 0; i <= grid_list_.size() &&
675 grid_list_[selected_grid_index_]->Move(direction, animate); 675 grid_list_[selected_grid_index_]->Move(direction, animate);
676 i++) { 676 i++) {
677 selected_grid_index_ = 677 selected_grid_index_ =
678 (selected_grid_index_ + display_direction + grid_list_.size()) % 678 (selected_grid_index_ + display_direction + grid_list_.size()) %
679 grid_list_.size(); 679 grid_list_.size();
680 } 680 }
681 } 681 }
682 682
683 } // namespace ash 683 } // 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