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

Side by Side Diff: ash/accelerators/accelerator_controller.cc

Issue 342823002: Prevents windows that cannot snap from snapping using a keyboard accelerator (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "ash/accelerators/accelerator_controller.h" 5 #include "ash/accelerators/accelerator_controller.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 #include <string> 9 #include <string>
10 10
(...skipping 491 matching lines...) Expand 10 before | Expand all | Expand 10 after
502 Shell::GetPrimaryRootWindowController()->ash_host()->ToggleFullScreen(); 502 Shell::GetPrimaryRootWindowController()->ash_host()->ToggleFullScreen();
503 return true; 503 return true;
504 } 504 }
505 505
506 bool HandleWindowSnap(int action) { 506 bool HandleWindowSnap(int action) {
507 wm::WindowState* window_state = wm::GetActiveWindowState(); 507 wm::WindowState* window_state = wm::GetActiveWindowState();
508 // Disable window snapping shortcut key for full screen window due to 508 // Disable window snapping shortcut key for full screen window due to
509 // http://crbug.com/135487. 509 // http://crbug.com/135487.
510 if (!window_state || 510 if (!window_state ||
511 window_state->window()->type() != ui::wm::WINDOW_TYPE_NORMAL || 511 window_state->window()->type() != ui::wm::WINDOW_TYPE_NORMAL ||
512 window_state->IsFullscreen()) { 512 window_state->IsFullscreen() ||
513 !window_state->CanSnap()) {
513 return false; 514 return false;
514 } 515 }
515 516
516 if (action == WINDOW_SNAP_LEFT) { 517 if (action == WINDOW_SNAP_LEFT) {
517 base::RecordAction(UserMetricsAction("Accel_Window_Snap_Left")); 518 base::RecordAction(UserMetricsAction("Accel_Window_Snap_Left"));
518 } else { 519 } else {
519 base::RecordAction(UserMetricsAction("Accel_Window_Snap_Right")); 520 base::RecordAction(UserMetricsAction("Accel_Window_Snap_Right"));
520 } 521 }
521 const wm::WMEvent event(action == WINDOW_SNAP_LEFT ? 522 const wm::WMEvent event(action == WINDOW_SNAP_LEFT ?
522 wm::WM_EVENT_SNAP_LEFT : wm::WM_EVENT_SNAP_RIGHT); 523 wm::WM_EVENT_SNAP_LEFT : wm::WM_EVENT_SNAP_RIGHT);
(...skipping 661 matching lines...) Expand 10 before | Expand all | Expand 10 after
1184 keyboard_brightness_control_delegate) { 1185 keyboard_brightness_control_delegate) {
1185 keyboard_brightness_control_delegate_ = 1186 keyboard_brightness_control_delegate_ =
1186 keyboard_brightness_control_delegate.Pass(); 1187 keyboard_brightness_control_delegate.Pass();
1187 } 1188 }
1188 1189
1189 bool AcceleratorController::CanHandleAccelerators() const { 1190 bool AcceleratorController::CanHandleAccelerators() const {
1190 return true; 1191 return true;
1191 } 1192 }
1192 1193
1193 } // namespace ash 1194 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698