| 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 15 matching lines...) Expand all Loading... |
| 26 #include "ash/screenshot_delegate.h" | 26 #include "ash/screenshot_delegate.h" |
| 27 #include "ash/shell.h" | 27 #include "ash/shell.h" |
| 28 #include "ash/shell_delegate.h" | 28 #include "ash/shell_delegate.h" |
| 29 #include "ash/shell_window_ids.h" | 29 #include "ash/shell_window_ids.h" |
| 30 #include "ash/system/brightness/brightness_control_delegate.h" | 30 #include "ash/system/brightness/brightness_control_delegate.h" |
| 31 #include "ash/system/keyboard_brightness/keyboard_brightness_control_delegate.h" | 31 #include "ash/system/keyboard_brightness/keyboard_brightness_control_delegate.h" |
| 32 #include "ash/system/tray/system_tray.h" | 32 #include "ash/system/tray/system_tray.h" |
| 33 #include "ash/system/tray/system_tray_delegate.h" | 33 #include "ash/system/tray/system_tray_delegate.h" |
| 34 #include "ash/volume_control_delegate.h" | 34 #include "ash/volume_control_delegate.h" |
| 35 #include "ash/wm/partial_screenshot_view.h" | 35 #include "ash/wm/partial_screenshot_view.h" |
| 36 #include "ash/wm/power_button_controller.h" | |
| 37 #include "ash/wm/property_util.h" | 36 #include "ash/wm/property_util.h" |
| 38 #include "ash/wm/window_cycle_controller.h" | 37 #include "ash/wm/window_cycle_controller.h" |
| 39 #include "ash/wm/window_util.h" | 38 #include "ash/wm/window_util.h" |
| 40 #include "ash/wm/workspace/snap_sizer.h" | 39 #include "ash/wm/workspace/snap_sizer.h" |
| 41 #include "base/bind.h" | 40 #include "base/bind.h" |
| 42 #include "base/command_line.h" | 41 #include "base/command_line.h" |
| 43 #include "ui/aura/env.h" | 42 #include "ui/aura/env.h" |
| 44 #include "ui/aura/root_window.h" | 43 #include "ui/aura/root_window.h" |
| 45 #include "ui/base/accelerators/accelerator.h" | 44 #include "ui/base/accelerators/accelerator.h" |
| 46 #include "ui/base/accelerators/accelerator_manager.h" | 45 #include "ui/base/accelerators/accelerator_manager.h" |
| 47 #include "ui/base/events/event.h" | 46 #include "ui/base/events/event.h" |
| 48 #include "ui/base/keycodes/keyboard_codes.h" | 47 #include "ui/base/keycodes/keyboard_codes.h" |
| 49 #include "ui/compositor/debug_utils.h" | 48 #include "ui/compositor/debug_utils.h" |
| 50 #include "ui/compositor/layer.h" | 49 #include "ui/compositor/layer.h" |
| 51 #include "ui/compositor/layer_animation_sequence.h" | 50 #include "ui/compositor/layer_animation_sequence.h" |
| 52 #include "ui/compositor/layer_animator.h" | 51 #include "ui/compositor/layer_animator.h" |
| 53 #include "ui/gfx/screen.h" | 52 #include "ui/gfx/screen.h" |
| 54 #include "ui/oak/oak.h" | 53 #include "ui/oak/oak.h" |
| 55 #include "ui/views/debug_utils.h" | 54 #include "ui/views/debug_utils.h" |
| 56 #include "ui/views/widget/widget.h" | 55 #include "ui/views/widget/widget.h" |
| 57 | 56 |
| 58 #if defined(OS_CHROMEOS) | 57 #if defined(OS_CHROMEOS) |
| 59 #include "ash/display/output_configurator_animation.h" | 58 #include "ash/display/output_configurator_animation.h" |
| 60 #include "base/chromeos/chromeos_version.h" | 59 #include "base/chromeos/chromeos_version.h" |
| 61 #include "base/time.h" | |
| 62 #include "chromeos/display/output_configurator.h" | 60 #include "chromeos/display/output_configurator.h" |
| 63 #endif // defined(OS_CHROMEOS) | 61 #endif // defined(OS_CHROMEOS) |
| 64 | 62 |
| 65 namespace ash { | 63 namespace ash { |
| 66 namespace { | 64 namespace { |
| 67 | 65 |
| 68 // Factor of magnification scale. For example, when this value is 1.189, scale | 66 // Factor of magnification scale. For example, when this value is 1.189, scale |
| 69 // value will be changed x1.000, x1.189, x1.414, x1.681, x2.000, ... | 67 // value will be changed x1.000, x1.189, x1.414, x1.681, x2.000, ... |
| 70 // Note: this value is 2.0 ^ (1 / 4). | 68 // Note: this value is 2.0 ^ (1 / 4). |
| 71 const float kMagnificationFactor = 1.18920712f; | 69 const float kMagnificationFactor = 1.18920712f; |
| (...skipping 686 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 758 case MAGNIFY_SCREEN_ZOOM_OUT: | 756 case MAGNIFY_SCREEN_ZOOM_OUT: |
| 759 return HandleMagnifyScreen(-1); | 757 return HandleMagnifyScreen(-1); |
| 760 case MEDIA_NEXT_TRACK: | 758 case MEDIA_NEXT_TRACK: |
| 761 return HandleMediaNextTrack(); | 759 return HandleMediaNextTrack(); |
| 762 case MEDIA_PLAY_PAUSE: | 760 case MEDIA_PLAY_PAUSE: |
| 763 return HandleMediaPlayPause(); | 761 return HandleMediaPlayPause(); |
| 764 case MEDIA_PREV_TRACK: | 762 case MEDIA_PREV_TRACK: |
| 765 return HandleMediaPrevTrack(); | 763 return HandleMediaPrevTrack(); |
| 766 case POWER_PRESSED: // fallthrough | 764 case POWER_PRESSED: // fallthrough |
| 767 case POWER_RELEASED: | 765 case POWER_RELEASED: |
| 768 #if defined(OS_CHROMEOS) | 766 // We don't do anything with these at present, but we consume them to |
| 769 if (!base::chromeos::IsRunningOnChromeOS()) { | 767 // prevent them from getting passed to apps -- see |
| 770 // There is no powerd in linux desktop, so call the | 768 // http://crbug.com/146609. |
| 771 // PowerButtonController here. | 769 return true; |
| 772 Shell::GetInstance()->power_button_controller()-> | |
| 773 OnPowerButtonEvent(action == POWER_PRESSED, base::TimeTicks()); | |
| 774 } | |
| 775 #endif | |
| 776 // We don't do anything with these at present on the device, | |
| 777 // (power button evets are reported to us from powerm via | |
| 778 // D-BUS), but we consume them to prevent them from getting | |
| 779 // passed to apps -- see http://crbug.com/146609. | |
| 780 return true; | |
| 781 case LOCK_PRESSED: | |
| 782 case LOCK_RELEASED: | |
| 783 #if defined(OS_CHROMEOS) | |
| 784 if (!base::chromeos::IsRunningOnChromeOS()) { | |
| 785 // There is no powerd in linux desktop, so call the | |
| 786 // PowerButtonController here. | |
| 787 Shell::GetInstance()->power_button_controller()-> | |
| 788 OnLockButtonEvent(action == LOCK_PRESSED, base::TimeTicks()); | |
| 789 return true; | |
| 790 } | |
| 791 #endif | |
| 792 // LOCK_PRESSED/RELEASED in debug only action that is meant for | |
| 793 // testing lock behavior on linux desktop. If we ever reached | |
| 794 // here (when you run a debug build on the device), pass it onto | |
| 795 // apps. | |
| 796 return false; | |
| 797 #if !defined(NDEBUG) | 770 #if !defined(NDEBUG) |
| 798 case PRINT_LAYER_HIERARCHY: | 771 case PRINT_LAYER_HIERARCHY: |
| 799 return HandlePrintLayerHierarchy(); | 772 return HandlePrintLayerHierarchy(); |
| 800 case PRINT_VIEW_HIERARCHY: | 773 case PRINT_VIEW_HIERARCHY: |
| 801 return HandlePrintViewHierarchy(); | 774 return HandlePrintViewHierarchy(); |
| 802 case PRINT_WINDOW_HIERARCHY: | 775 case PRINT_WINDOW_HIERARCHY: |
| 803 return HandlePrintWindowHierarchy(); | 776 return HandlePrintWindowHierarchy(); |
| 804 #endif | 777 #endif |
| 805 default: | 778 default: |
| 806 NOTREACHED() << "Unhandled action " << action; | 779 NOTREACHED() << "Unhandled action " << action; |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 888 accelerators_.insert( | 861 accelerators_.insert( |
| 889 std::make_pair(accelerator, accelerators[i].action)); | 862 std::make_pair(accelerator, accelerators[i].action)); |
| 890 } | 863 } |
| 891 } | 864 } |
| 892 | 865 |
| 893 bool AcceleratorController::CanHandleAccelerators() const { | 866 bool AcceleratorController::CanHandleAccelerators() const { |
| 894 return true; | 867 return true; |
| 895 } | 868 } |
| 896 | 869 |
| 897 } // namespace ash | 870 } // namespace ash |
| OLD | NEW |