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

Unified Diff: athena/wm/window_manager_impl.cc

Issue 601333002: ESC accelerator and consistent overview mode for Athena homecard (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove ToggleOverview() Created 6 years, 2 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: athena/wm/window_manager_impl.cc
diff --git a/athena/wm/window_manager_impl.cc b/athena/wm/window_manager_impl.cc
index 35722c1adfa69f27a7743b3c6003d85468c88051..ec15bc2a445b83a6d5e869e51167ebe61e22caf4 100644
--- a/athena/wm/window_manager_impl.cc
+++ b/athena/wm/window_manager_impl.cc
@@ -193,10 +193,13 @@ void WindowManagerImpl::ToggleSplitView() {
}
}
-void WindowManagerImpl::ToggleOverview() {
- if (IsOverviewModeActive()) {
- SetInOverview(false);
+// Wraps SetInOverview(), and also activates old active window upon deactivation
+void WindowManagerImpl::ActivateOverview(bool activate) {
+ if (IsOverviewModeActive() == activate)
+ return;
+ SetInOverview(activate);
+ if (!activate) {
// Activate the window which was active prior to entering overview.
const aura::Window::Windows windows =
window_list_provider_->GetWindowList();
@@ -208,8 +211,6 @@ void WindowManagerImpl::ToggleOverview() {
wm::ActivateWindow(window);
}
- } else {
- SetInOverview(true);
}
}
@@ -222,6 +223,12 @@ void WindowManagerImpl::SetInOverview(bool active) {
if (active == in_overview)
return;
+ const AcceleratorData esc_accelerator_data = {TRIGGER_ON_PRESS,
+ ui::VKEY_ESCAPE,
+ ui::EF_NONE,
+ CMD_EXIT_OVERVIEW,
+ AF_NONE};
+
bezel_controller_->set_left_right_delegate(
active ? NULL : split_view_controller_.get());
if (active) {
@@ -232,9 +239,12 @@ void WindowManagerImpl::SetInOverview(bool active) {
overview_ = WindowOverviewMode::Create(
container_.get(), window_list_provider_.get(),
split_view_controller_.get(), this);
+ AcceleratorManager::Get()->RegisterAccelerator(esc_accelerator_data, this);
} else {
overview_.reset();
FOR_EACH_OBSERVER(WindowManagerObserver, observers_, OnOverviewModeExit());
+ AcceleratorManager::Get()->UnregisterAccelerator(esc_accelerator_data,
+ this);
}
}
@@ -322,8 +332,11 @@ bool WindowManagerImpl::IsCommandEnabled(int command_id) const {
bool WindowManagerImpl::OnAcceleratorFired(int command_id,
const ui::Accelerator& accelerator) {
switch (command_id) {
+ case CMD_EXIT_OVERVIEW:
+ ActivateOverview(false);
+ break;
case CMD_TOGGLE_OVERVIEW:
- ToggleOverview();
+ ActivateOverview(!IsOverviewModeActive());
break;
case CMD_TOGGLE_SPLIT_VIEW:
ToggleSplitView();

Powered by Google App Engine
This is Rietveld 408576698