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

Side by Side 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: 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "athena/wm/window_manager_impl.h" 5 #include "athena/wm/window_manager_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "athena/screen/public/screen_manager.h" 9 #include "athena/screen/public/screen_manager.h"
10 #include "athena/util/container_priorities.h" 10 #include "athena/util/container_priorities.h"
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 196
197 bool WindowManagerImpl::IsOverviewModeActive() { 197 bool WindowManagerImpl::IsOverviewModeActive() {
198 return overview_; 198 return overview_;
199 } 199 }
200 200
201 void WindowManagerImpl::SetInOverview(bool active) { 201 void WindowManagerImpl::SetInOverview(bool active) {
202 bool in_overview = !!overview_; 202 bool in_overview = !!overview_;
203 if (active == in_overview) 203 if (active == in_overview)
204 return; 204 return;
205 205
206 const AcceleratorData esc_accelerator_data = {
207 TRIGGER_ON_PRESS, ui::VKEY_ESCAPE, ui::EF_NONE, CMD_EXIT_OVERVIEW,
208 AF_NONE};
209
206 bezel_controller_->set_left_right_delegate( 210 bezel_controller_->set_left_right_delegate(
207 active ? NULL : split_view_controller_.get()); 211 active ? NULL : split_view_controller_.get());
208 if (active) { 212 if (active) {
209 FOR_EACH_OBSERVER(WindowManagerObserver, observers_, OnOverviewModeEnter()); 213 FOR_EACH_OBSERVER(WindowManagerObserver, observers_, OnOverviewModeEnter());
210 214
211 // Note: The window_list_provider_ resembles the exact window list of the 215 // Note: The window_list_provider_ resembles the exact window list of the
212 // container, so no re-stacking is required before showing the OverviewMode. 216 // container, so no re-stacking is required before showing the OverviewMode.
213 overview_ = WindowOverviewMode::Create( 217 overview_ = WindowOverviewMode::Create(
214 container_.get(), window_list_provider_.get(), 218 container_.get(), window_list_provider_.get(),
215 split_view_controller_.get(), this); 219 split_view_controller_.get(), this);
220 AcceleratorManager::Get()->RegisterAccelerator(esc_accelerator_data, this);
216 } else { 221 } else {
217 overview_.reset(); 222 overview_.reset();
218 FOR_EACH_OBSERVER(WindowManagerObserver, observers_, OnOverviewModeExit()); 223 FOR_EACH_OBSERVER(WindowManagerObserver, observers_, OnOverviewModeExit());
224 AcceleratorManager::Get()->UnregisterAccelerator(esc_accelerator_data,
225 this);
219 } 226 }
220 } 227 }
221 228
222 void WindowManagerImpl::InstallAccelerators() { 229 void WindowManagerImpl::InstallAccelerators() {
223 const AcceleratorData accelerator_data[] = { 230 const AcceleratorData accelerator_data[] = {
224 {TRIGGER_ON_PRESS, ui::VKEY_F6, ui::EF_NONE, CMD_TOGGLE_OVERVIEW, 231 {TRIGGER_ON_PRESS, ui::VKEY_F6, ui::EF_NONE, CMD_TOGGLE_OVERVIEW,
225 AF_NONE}, 232 AF_NONE},
226 {TRIGGER_ON_PRESS, ui::VKEY_F6, ui::EF_CONTROL_DOWN, 233 {TRIGGER_ON_PRESS, ui::VKEY_F6, ui::EF_CONTROL_DOWN,
227 CMD_TOGGLE_SPLIT_VIEW, AF_NONE}, 234 CMD_TOGGLE_SPLIT_VIEW, AF_NONE},
228 }; 235 };
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 FOR_EACH_OBSERVER(WindowManagerObserver, observers_, OnSplitViewModeEnter()); 297 FOR_EACH_OBSERVER(WindowManagerObserver, observers_, OnSplitViewModeEnter());
291 split_view_controller_->ActivateSplitMode(left, right); 298 split_view_controller_->ActivateSplitMode(left, right);
292 wm::ActivateWindow(to_activate); 299 wm::ActivateWindow(to_activate);
293 } 300 }
294 301
295 void WindowManagerImpl::OnWindowDestroying(aura::Window* window) { 302 void WindowManagerImpl::OnWindowDestroying(aura::Window* window) {
296 if (window == container_) 303 if (window == container_)
297 container_.reset(); 304 container_.reset();
298 } 305 }
299 306
300 bool WindowManagerImpl::IsCommandEnabled(int command_id) const { 307 bool WindowManagerImpl::IsCommandEnabled(int command_id) const {
Jun Mukai 2014/09/25 21:53:41 Isn't it good enough to make this returning false
Jun Mukai 2014/09/25 22:37:45 FYI: if you want to keep register/unregister struc
Greg Levin 2014/10/02 21:56:09 Based on our conversation, I'm leaving this alone.
Greg Levin 2014/10/02 21:56:09 Leaving as is based on our conversation with Oshim
301 return true; 308 return true;
302 } 309 }
303 310
304 bool WindowManagerImpl::OnAcceleratorFired(int command_id, 311 bool WindowManagerImpl::OnAcceleratorFired(int command_id,
305 const ui::Accelerator& accelerator) { 312 const ui::Accelerator& accelerator) {
306 switch (command_id) { 313 switch (command_id) {
314 case CMD_EXIT_OVERVIEW:
315 if (!IsOverviewModeActive())
316 break; // else fall through & Toggle
307 case CMD_TOGGLE_OVERVIEW: 317 case CMD_TOGGLE_OVERVIEW:
308 ToggleOverview(); 318 ToggleOverview();
309 break; 319 break;
310 case CMD_TOGGLE_SPLIT_VIEW: 320 case CMD_TOGGLE_SPLIT_VIEW:
311 ToggleSplitview(); 321 ToggleSplitview();
312 break; 322 break;
313 } 323 }
314 return true; 324 return true;
315 } 325 }
316 326
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
425 DCHECK(!instance); 435 DCHECK(!instance);
426 } 436 }
427 437
428 // static 438 // static
429 WindowManager* WindowManager::GetInstance() { 439 WindowManager* WindowManager::GetInstance() {
430 DCHECK(instance); 440 DCHECK(instance);
431 return instance; 441 return instance;
432 } 442 }
433 443
434 } // namespace athena 444 } // namespace athena
OLDNEW
« athena/input/public/accelerator_manager.h ('K') | « athena/wm/window_manager_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698