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

Unified Diff: ash/system/overview/overview_button_tray.cc

Issue 2882073004: wm: Allow double tap on overview button to quick switch. (Closed)
Patch Set: Use tap_count(). Created 3 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
Index: ash/system/overview/overview_button_tray.cc
diff --git a/ash/system/overview/overview_button_tray.cc b/ash/system/overview/overview_button_tray.cc
index ff5771027ba9b53f02d238ae51b78c4e693a439b..ebb54218ff3e69af5300c1529ff78a288fe3eaca 100644
--- a/ash/system/overview/overview_button_tray.cc
+++ b/ash/system/overview/overview_button_tray.cc
@@ -13,11 +13,14 @@
#include "ash/system/tray/tray_constants.h"
#include "ash/system/tray/tray_container.h"
#include "ash/wm/maximize_mode/maximize_mode_controller.h"
+#include "ash/wm/mru_window_tracker.h"
#include "ash/wm/overview/window_selector_controller.h"
+#include "ash/wm_window.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/gfx/paint_vector_icon.h"
#include "ui/views/border.h"
#include "ui/views/controls/image_view.h"
+#include "ui/wm/core/window_util.h"
namespace ash {
@@ -52,9 +55,30 @@ void OverviewButtonTray::UpdateAfterLoginStatusChange(LoginStatus status) {
}
bool OverviewButtonTray::PerformAction(const ui::Event& event) {
+ if (event.type() == ui::ET_GESTURE_TAP) {
+ if (event.AsGestureEvent()->details().tap_count() == 2) {
+ // Ignore double taps if we are on the window selection page.
+ if (Shell::Get()->window_selector_controller()->IsSelecting())
+ return true;
+
+ MruWindowTracker::WindowList mru_window_list =
+ Shell::Get()->mru_window_tracker()->BuildMruWindowList();
+
+ // Switch to the second most recently used window (most recent is the
+ // current window), if it exists.
+ if (mru_window_list.size() > 1) {
+ AnimateInkDrop(views::InkDropState::DEACTIVATED, nullptr);
+ ::wm::ActivateWindow(WmWindow::GetAuraWindow(mru_window_list[1]));
+ return true;
+ }
+ }
+ }
+
WindowSelectorController* controller =
Shell::Get()->window_selector_controller();
- // Toggling overview mode will fail if there is no window to show.
+ // Note: Toggling overview mode will fail if there is no window to show, the
+ // screen is locked, a modal dialog is open or is running in kiosk app
+ // session.
bool performed = controller->ToggleOverview();
ShellPort::Get()->RecordUserMetricsAction(UMA_TRAY_OVERVIEW);
return performed;

Powered by Google App Engine
This is Rietveld 408576698