| Index: athena/wm/window_manager_impl.cc
|
| diff --git a/athena/wm/window_manager_impl.cc b/athena/wm/window_manager_impl.cc
|
| index e507c462f1934706a9ce66717d5fd33a917ebbc1..073bdc3847771cee4880abb1b826bd2c088b54ca 100644
|
| --- a/athena/wm/window_manager_impl.cc
|
| +++ b/athena/wm/window_manager_impl.cc
|
| @@ -194,9 +194,16 @@ void WindowManagerImpl::ToggleSplitView() {
|
| }
|
|
|
| void WindowManagerImpl::ToggleOverview() {
|
| - if (IsOverviewModeActive()) {
|
| - SetInOverview(false);
|
| + ActivateOverview(!IsOverviewModeActive());
|
| +}
|
| +
|
| +// 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 +215,6 @@ void WindowManagerImpl::ToggleOverview() {
|
|
|
| wm::ActivateWindow(window);
|
| }
|
| - } else {
|
| - SetInOverview(true);
|
| }
|
| }
|
|
|
| @@ -222,6 +227,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 +243,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,6 +336,9 @@ 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();
|
| break;
|
|
|