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

Unified Diff: ash/wm/overview/window_selector.cc

Issue 1138253002: Add user action for changing the active window in Ash overview mode (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: tests added Created 5 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ash/wm/overview/window_selector.h ('k') | ash/wm/overview/window_selector_item.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/wm/overview/window_selector.cc
diff --git a/ash/wm/overview/window_selector.cc b/ash/wm/overview/window_selector.cc
index 43771ea66ff59fadb9bf4361a13c5af4c7206859..3e033cc90de4e610c2821c765daee217e018ffd9 100644
--- a/ash/wm/overview/window_selector.cc
+++ b/ash/wm/overview/window_selector.cc
@@ -16,6 +16,7 @@
#include "ash/shell.h"
#include "ash/shell_window_ids.h"
#include "ash/switchable_windows.h"
+#include "ash/wm/mru_window_tracker.h"
#include "ash/wm/overview/window_grid.h"
#include "ash/wm/overview/window_selector_delegate.h"
#include "ash/wm/overview/window_selector_item.h"
@@ -393,6 +394,20 @@ void WindowSelector::OnGridEmpty(WindowGrid* grid) {
CancelSelection();
}
+void WindowSelector::SelectWindow(aura::Window* window) {
+ // Record UMA_WINDOW_OVERVIEW_ACTIVE_WINDOW_CHANGED if the user is selecting
+ // a window other than the window that was active prior to entering overview
+ // mode (i.e., the window at the front of the MRU list).
+ MruWindowTracker::WindowList window_list =
+ Shell::GetInstance()->mru_window_tracker()->BuildMruWindowList();
+ if (window_list.size() > 0 && window_list[0] != window) {
+ Shell::GetInstance()->metrics()->RecordUserMetricsAction(
+ UMA_WINDOW_OVERVIEW_ACTIVE_WINDOW_CHANGED);
+ }
+
+ wm::GetWindowState(window)->Activate();
+}
+
bool WindowSelector::HandleKeyEvent(views::Textfield* sender,
const ui::KeyEvent& key_event) {
if (key_event.type() != ui::ET_KEY_PRESSED)
@@ -430,8 +445,8 @@ bool WindowSelector::HandleKeyEvent(views::Textfield* sender,
(num_key_presses_ * 100) / num_items_, 1, 300, 30);
Shell::GetInstance()->metrics()->RecordUserMetricsAction(
UMA_WINDOW_OVERVIEW_ENTER_KEY);
- wm::GetWindowState(grid_list_[selected_grid_index_]->
- SelectedWindow()->GetWindow())->Activate();
+ SelectWindow(
+ grid_list_[selected_grid_index_]->SelectedWindow()->GetWindow());
break;
default:
// Not a key we are interested in, allow the textfield to handle it.
« no previous file with comments | « ash/wm/overview/window_selector.h ('k') | ash/wm/overview/window_selector_item.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698