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 632 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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 WINDOW_MAXIMIZE_RESTORE: { |
653 if (key_code == ui::VKEY_F4 && shell->delegate()) | |
654 shell->delegate()->RecordUserMetricsAction(UMA_ACCEL_MAXIMIZE_RESTORE); | |
653 aura::Window* window = wm::GetActiveWindow(); | 655 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) | 656 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; | 657 return true; |
658 if (wm::IsWindowFullscreen(window)) { | |
659 if (shell->delegate()) | |
660 shell->delegate()->ToggleFullscreenMode(); | |
661 } else if (wm::IsWindowMaximized(window)) { | |
662 wm::RestoreWindow(window); | |
663 } else if (wm::CanMaximizeWindow(window)) { | |
664 wm::MaximizeWindow(window); | |
664 } | 665 } |
666 return true; | |
665 break; | 667 break; |
sky
2012/09/13 00:46:22
no break.
sschmitz
2012/09/13 19:34:13
Done.
| |
666 } | 668 } |
667 case WINDOW_POSITION_CENTER: { | 669 case WINDOW_POSITION_CENTER: { |
668 aura::Window* window = wm::GetActiveWindow(); | 670 aura::Window* window = wm::GetActiveWindow(); |
669 if (window) { | 671 if (window) { |
670 wm::CenterWindow(window); | 672 wm::CenterWindow(window); |
671 return true; | 673 return true; |
672 } | 674 } |
673 break; | 675 break; |
674 } | 676 } |
675 case ROTATE_WINDOWS: | 677 case ROTATE_WINDOWS: |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
793 accelerators_.insert( | 795 accelerators_.insert( |
794 std::make_pair(accelerator, accelerators[i].action)); | 796 std::make_pair(accelerator, accelerators[i].action)); |
795 } | 797 } |
796 } | 798 } |
797 | 799 |
798 bool AcceleratorController::CanHandleAccelerators() const { | 800 bool AcceleratorController::CanHandleAccelerators() const { |
799 return true; | 801 return true; |
800 } | 802 } |
801 | 803 |
802 } // namespace ash | 804 } // namespace ash |
OLD | NEW |