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 437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
448 // If the grid which became empty was the one with the selected window, we | 448 // If the grid which became empty was the one with the selected window, we |
449 // need to select a window on the newly selected grid. | 449 // need to select a window on the newly selected grid. |
450 if (selected_grid_index_ == index - 1) | 450 if (selected_grid_index_ == index - 1) |
451 Move(LEFT, true); | 451 Move(LEFT, true); |
452 } | 452 } |
453 if (grid_list_.empty()) | 453 if (grid_list_.empty()) |
454 CancelSelection(); | 454 CancelSelection(); |
455 } | 455 } |
456 | 456 |
457 void WindowSelector::SelectWindow(WmWindow* window) { | 457 void WindowSelector::SelectWindow(WmWindow* window) { |
458 // Record UMA_WINDOW_OVERVIEW_ACTIVE_WINDOW_CHANGED if the user is selecting | |
459 // a window other than the window that was active prior to entering overview | |
460 // mode (i.e., the window at the front of the MRU list). | |
461 std::vector<WmWindow*> window_list = | 458 std::vector<WmWindow*> window_list = |
462 WmShell::Get()->GetMruWindowTracker()->BuildMruWindowList(); | 459 WmShell::Get()->GetMruWindowTracker()->BuildMruWindowList(); |
463 if (!window_list.empty() && window_list[0] != window) { | 460 if (!window_list.empty()) { |
464 WmShell::Get()->RecordUserMetricsAction( | 461 // Record UMA_WINDOW_OVERVIEW_ACTIVE_WINDOW_CHANGED if the user is selecting |
465 UMA_WINDOW_OVERVIEW_ACTIVE_WINDOW_CHANGED); | 462 // a window other than the window that was active prior to entering overview |
| 463 // mode (i.e., the window at the front of the MRU list). |
| 464 if (window_list[0] != window) { |
| 465 WmShell::Get()->RecordUserMetricsAction( |
| 466 UMA_WINDOW_OVERVIEW_ACTIVE_WINDOW_CHANGED); |
| 467 } |
| 468 const auto it = std::find(window_list.begin(), window_list.end(), window); |
| 469 if (it != window_list.end()) { |
| 470 // Record 1-based index so that selecting a top MRU window will record 1. |
| 471 UMA_HISTOGRAM_COUNTS_100("Ash.WindowSelector.SelectionDepth", |
| 472 1 + it - window_list.begin()); |
| 473 } |
466 } | 474 } |
467 | 475 |
468 window->GetWindowState()->Activate(); | 476 window->GetWindowState()->Activate(); |
469 } | 477 } |
470 | 478 |
471 bool WindowSelector::HandleKeyEvent(views::Textfield* sender, | 479 bool WindowSelector::HandleKeyEvent(views::Textfield* sender, |
472 const ui::KeyEvent& key_event) { | 480 const ui::KeyEvent& key_event) { |
473 if (key_event.type() != ui::ET_KEY_PRESSED) | 481 if (key_event.type() != ui::ET_KEY_PRESSED) |
474 return false; | 482 return false; |
475 | 483 |
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
679 for (size_t i = 0; i <= grid_list_.size() && | 687 for (size_t i = 0; i <= grid_list_.size() && |
680 grid_list_[selected_grid_index_]->Move(direction, animate); | 688 grid_list_[selected_grid_index_]->Move(direction, animate); |
681 i++) { | 689 i++) { |
682 selected_grid_index_ = | 690 selected_grid_index_ = |
683 (selected_grid_index_ + display_direction + grid_list_.size()) % | 691 (selected_grid_index_ + display_direction + grid_list_.size()) % |
684 grid_list_.size(); | 692 grid_list_.size(); |
685 } | 693 } |
686 } | 694 } |
687 | 695 |
688 } // namespace ash | 696 } // namespace ash |
OLD | NEW |