OLD | NEW |
---|---|
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 631 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
642 return HandleCycleWindowMRU(WindowCycleController::FORWARD, false); | 642 return HandleCycleWindowMRU(WindowCycleController::FORWARD, false); |
643 // Disable the shortcut for minimizing full screen window due to | 643 // Disable the shortcut for minimizing full screen window due to |
644 // crbug.com/131709, which is a crashing issue related to minimizing | 644 // crbug.com/131709, which is a crashing issue related to minimizing |
645 // full screen pepper window. | 645 // full screen pepper window. |
646 if (!wm::IsWindowFullscreen(window)) { | 646 if (!wm::IsWindowFullscreen(window)) { |
647 wm::MinimizeWindow(window); | 647 wm::MinimizeWindow(window); |
648 return true; | 648 return true; |
649 } | 649 } |
650 break; | 650 break; |
651 } | 651 } |
652 case WINDOW_MAXIMIZE_RESTORE: { | 652 case TOGGLE_MAXIMIZED: { |
653 if (key_code == ui::VKEY_F4 && shell->delegate()) { | |
654 shell->delegate()->RecordUserMetricsAction( | |
655 UMA_ACCEL_MAXIMIZE_RESTORE_F4); | |
656 } | |
653 aura::Window* window = wm::GetActiveWindow(); | 657 aura::Window* window = wm::GetActiveWindow(); |
654 // Attempt to restore the window that would be cycled through next from | |
655 // the launcher when there is no active window. | |
656 if (!window) | 658 if (!window) |
657 return HandleCycleWindowMRU(WindowCycleController::FORWARD, false); | |
658 if (!wm::IsWindowFullscreen(window)) { | |
659 if (wm::IsWindowMaximized(window)) | |
660 wm::RestoreWindow(window); | |
661 else | |
662 wm::MaximizeWindow(window); | |
663 return true; | 659 return true; |
660 if (wm::IsWindowFullscreen(window)) { | |
661 // Chrome also uses VKEY_F4 as a shortcut. Its action is to toggle | |
662 // fullscreen. If we got here via VKEY_F4, chrome's action will | |
sky
2012/09/16 16:08:03
Change that last sentence to 'Return false so Chro
sschmitz
2012/09/17 15:22:05
Done.
| |
663 // execute next and fullscreen will be toggled off. | |
664 return false; | |
664 } | 665 } |
665 break; | 666 if (wm::IsWindowMaximized(window)) |
667 wm::RestoreWindow(window); | |
668 else if (wm::CanMaximizeWindow(window)) | |
669 wm::MaximizeWindow(window); | |
670 return true; | |
666 } | 671 } |
667 case WINDOW_POSITION_CENTER: { | 672 case WINDOW_POSITION_CENTER: { |
668 aura::Window* window = wm::GetActiveWindow(); | 673 aura::Window* window = wm::GetActiveWindow(); |
669 if (window) { | 674 if (window) { |
670 wm::CenterWindow(window); | 675 wm::CenterWindow(window); |
671 return true; | 676 return true; |
672 } | 677 } |
673 break; | 678 break; |
674 } | 679 } |
675 case ROTATE_WINDOWS: | 680 case ROTATE_WINDOWS: |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
793 accelerators_.insert( | 798 accelerators_.insert( |
794 std::make_pair(accelerator, accelerators[i].action)); | 799 std::make_pair(accelerator, accelerators[i].action)); |
795 } | 800 } |
796 } | 801 } |
797 | 802 |
798 bool AcceleratorController::CanHandleAccelerators() const { | 803 bool AcceleratorController::CanHandleAccelerators() const { |
799 return true; | 804 return true; |
800 } | 805 } |
801 | 806 |
802 } // namespace ash | 807 } // namespace ash |
OLD | NEW |