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

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

Issue 23611005: ash: Allow web pages to use the Ctrl-M minimize shortcut (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 3 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
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 <iostream> 9 #include <iostream>
10 #include <string> 10 #include <string>
11 11
12 #include "ash/accelerators/accelerator_commands.h"
12 #include "ash/accelerators/accelerator_table.h" 13 #include "ash/accelerators/accelerator_table.h"
13 #include "ash/ash_switches.h" 14 #include "ash/ash_switches.h"
14 #include "ash/caps_lock_delegate.h" 15 #include "ash/caps_lock_delegate.h"
15 #include "ash/debug.h" 16 #include "ash/debug.h"
16 #include "ash/desktop_background/desktop_background_controller.h" 17 #include "ash/desktop_background/desktop_background_controller.h"
17 #include "ash/desktop_background/user_wallpaper_delegate.h" 18 #include "ash/desktop_background/user_wallpaper_delegate.h"
18 #include "ash/display/display_controller.h" 19 #include "ash/display/display_controller.h"
19 #include "ash/display/display_manager.h" 20 #include "ash/display/display_manager.h"
20 #include "ash/focus_cycler.h" 21 #include "ash/focus_cycler.h"
21 #include "ash/ime_control_delegate.h" 22 #include "ash/ime_control_delegate.h"
(...skipping 814 matching lines...) Expand 10 before | Expand all | Expand 10 after
836 window->type() != aura::client::WINDOW_TYPE_NORMAL || 837 window->type() != aura::client::WINDOW_TYPE_NORMAL ||
837 wm::IsWindowFullscreen(window)) { 838 wm::IsWindowFullscreen(window)) {
838 break; 839 break;
839 } 840 }
840 841
841 internal::SnapSizer::SnapWindow(window, 842 internal::SnapSizer::SnapWindow(window,
842 action == WINDOW_SNAP_LEFT ? internal::SnapSizer::LEFT_EDGE : 843 action == WINDOW_SNAP_LEFT ? internal::SnapSizer::LEFT_EDGE :
843 internal::SnapSizer::RIGHT_EDGE); 844 internal::SnapSizer::RIGHT_EDGE);
844 return true; 845 return true;
845 } 846 }
846 case WINDOW_MINIMIZE: { 847 case WINDOW_MINIMIZE:
847 aura::Window* window = wm::GetActiveWindow(); 848 return accelerators::ToggleMinimized();
848 // Attempt to restore the window that would be cycled through next from
849 // the launcher when there is no active window.
850 if (!window)
851 return HandleCycleWindowMRU(WindowCycleController::FORWARD, false);
852 // Disable the shortcut for minimizing full screen window due to
853 // crbug.com/131709, which is a crashing issue related to minimizing
854 // full screen pepper window.
855 if (!wm::IsWindowFullscreen(window) && wm::CanMinimizeWindow(window)) {
856 ash::Shell::GetInstance()->delegate()->RecordUserMetricsAction(
857 ash::UMA_MINIMIZE_PER_KEY);
858 wm::MinimizeWindow(window);
859 return true;
860 }
861 break;
862 }
863 case TOGGLE_FULLSCREEN: { 849 case TOGGLE_FULLSCREEN: {
864 if (key_code == ui::VKEY_MEDIA_LAUNCH_APP2) { 850 if (key_code == ui::VKEY_MEDIA_LAUNCH_APP2) {
865 shell->delegate()->RecordUserMetricsAction( 851 shell->delegate()->RecordUserMetricsAction(
866 UMA_ACCEL_FULLSCREEN_F4); 852 UMA_ACCEL_FULLSCREEN_F4);
867 } 853 }
868 shell->delegate()->ToggleFullscreen(); 854 shell->delegate()->ToggleFullscreen();
869 return true; 855 return true;
870 } 856 }
871 case TOGGLE_MAXIMIZED: { 857 case TOGGLE_MAXIMIZED: {
872 shell->delegate()->ToggleMaximized(); 858 shell->delegate()->ToggleMaximized();
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
999 keyboard_brightness_control_delegate) { 985 keyboard_brightness_control_delegate) {
1000 keyboard_brightness_control_delegate_ = 986 keyboard_brightness_control_delegate_ =
1001 keyboard_brightness_control_delegate.Pass(); 987 keyboard_brightness_control_delegate.Pass();
1002 } 988 }
1003 989
1004 bool AcceleratorController::CanHandleAccelerators() const { 990 bool AcceleratorController::CanHandleAccelerators() const {
1005 return true; 991 return true;
1006 } 992 }
1007 993
1008 } // namespace ash 994 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698