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 #include <utility> |
10 | 11 |
11 #include "ash/accelerators/accelerator_commands.h" | 12 #include "ash/accelerators/accelerator_commands.h" |
12 #include "ash/accelerators/debug_commands.h" | 13 #include "ash/accelerators/debug_commands.h" |
13 #include "ash/ash_switches.h" | 14 #include "ash/ash_switches.h" |
14 #include "ash/debug.h" | 15 #include "ash/debug.h" |
15 #include "ash/display/window_tree_host_manager.h" | 16 #include "ash/display/window_tree_host_manager.h" |
16 #include "ash/focus_cycler.h" | 17 #include "ash/focus_cycler.h" |
17 #include "ash/gpu_support.h" | 18 #include "ash/gpu_support.h" |
18 #include "ash/ime_control_delegate.h" | 19 #include "ash/ime_control_delegate.h" |
19 #include "ash/magnifier/magnification_controller.h" | 20 #include "ash/magnifier/magnification_controller.h" |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 new message_center::Notification( | 163 new message_center::Notification( |
163 message_center::NOTIFICATION_TYPE_SIMPLE, notification_id, | 164 message_center::NOTIFICATION_TYPE_SIMPLE, notification_id, |
164 base::string16(), message, | 165 base::string16(), message, |
165 Shell::GetInstance()->delegate()->GetDeprecatedAcceleratorImage(), | 166 Shell::GetInstance()->delegate()->GetDeprecatedAcceleratorImage(), |
166 base::string16(), GURL(), | 167 base::string16(), GURL(), |
167 message_center::NotifierId( | 168 message_center::NotifierId( |
168 message_center::NotifierId::SYSTEM_COMPONENT, | 169 message_center::NotifierId::SYSTEM_COMPONENT, |
169 system_notifier::kNotifierDeprecatedAccelerator), | 170 system_notifier::kNotifierDeprecatedAccelerator), |
170 message_center::RichNotificationData(), | 171 message_center::RichNotificationData(), |
171 new DeprecatedAcceleratorNotificationDelegate)); | 172 new DeprecatedAcceleratorNotificationDelegate)); |
172 message_center::MessageCenter::Get()->AddNotification(notification.Pass()); | 173 message_center::MessageCenter::Get()->AddNotification( |
| 174 std::move(notification)); |
173 } | 175 } |
174 | 176 |
175 void RecordUmaHistogram(const char* histogram_name, | 177 void RecordUmaHistogram(const char* histogram_name, |
176 DeprecatedAcceleratorUsage sample) { | 178 DeprecatedAcceleratorUsage sample) { |
177 auto histogram = base::LinearHistogram::FactoryGet( | 179 auto histogram = base::LinearHistogram::FactoryGet( |
178 histogram_name, 1, DEPRECATED_USAGE_COUNT, DEPRECATED_USAGE_COUNT + 1, | 180 histogram_name, 1, DEPRECATED_USAGE_COUNT, DEPRECATED_USAGE_COUNT + 1, |
179 base::HistogramBase::kUmaTargetedHistogramFlag); | 181 base::HistogramBase::kUmaTargetedHistogramFlag); |
180 histogram->Add(sample); | 182 histogram->Add(sample); |
181 } | 183 } |
182 | 184 |
(...skipping 641 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
824 return false; | 826 return false; |
825 } | 827 } |
826 | 828 |
827 AcceleratorController::AcceleratorProcessingRestriction | 829 AcceleratorController::AcceleratorProcessingRestriction |
828 AcceleratorController::GetCurrentAcceleratorRestriction() { | 830 AcceleratorController::GetCurrentAcceleratorRestriction() { |
829 return GetAcceleratorProcessingRestriction(-1); | 831 return GetAcceleratorProcessingRestriction(-1); |
830 } | 832 } |
831 | 833 |
832 void AcceleratorController::SetBrightnessControlDelegate( | 834 void AcceleratorController::SetBrightnessControlDelegate( |
833 scoped_ptr<BrightnessControlDelegate> brightness_control_delegate) { | 835 scoped_ptr<BrightnessControlDelegate> brightness_control_delegate) { |
834 brightness_control_delegate_ = brightness_control_delegate.Pass(); | 836 brightness_control_delegate_ = std::move(brightness_control_delegate); |
835 } | 837 } |
836 | 838 |
837 void AcceleratorController::SetImeControlDelegate( | 839 void AcceleratorController::SetImeControlDelegate( |
838 scoped_ptr<ImeControlDelegate> ime_control_delegate) { | 840 scoped_ptr<ImeControlDelegate> ime_control_delegate) { |
839 ime_control_delegate_ = ime_control_delegate.Pass(); | 841 ime_control_delegate_ = std::move(ime_control_delegate); |
840 } | 842 } |
841 | 843 |
842 void AcceleratorController::SetScreenshotDelegate( | 844 void AcceleratorController::SetScreenshotDelegate( |
843 scoped_ptr<ScreenshotDelegate> screenshot_delegate) { | 845 scoped_ptr<ScreenshotDelegate> screenshot_delegate) { |
844 screenshot_delegate_ = screenshot_delegate.Pass(); | 846 screenshot_delegate_ = std::move(screenshot_delegate); |
845 } | 847 } |
846 | 848 |
847 bool AcceleratorController::ShouldCloseMenuAndRepostAccelerator( | 849 bool AcceleratorController::ShouldCloseMenuAndRepostAccelerator( |
848 const ui::Accelerator& accelerator) const { | 850 const ui::Accelerator& accelerator) const { |
849 auto itr = accelerators_.find(accelerator); | 851 auto itr = accelerators_.find(accelerator); |
850 if (itr == accelerators_.end()) | 852 if (itr == accelerators_.end()) |
851 return false; // Menu shouldn't be closed for an invalid accelerator. | 853 return false; // Menu shouldn't be closed for an invalid accelerator. |
852 | 854 |
853 AcceleratorAction action = itr->second; | 855 AcceleratorAction action = itr->second; |
854 return actions_keeping_menu_open_.count(action) == 0; | 856 return actions_keeping_menu_open_.count(action) == 0; |
(...skipping 592 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1447 ui::A11Y_ALERT_WINDOW_NEEDED); | 1449 ui::A11Y_ALERT_WINDOW_NEEDED); |
1448 return RESTRICTION_PREVENT_PROCESSING_AND_PROPAGATION; | 1450 return RESTRICTION_PREVENT_PROCESSING_AND_PROPAGATION; |
1449 } | 1451 } |
1450 return RESTRICTION_NONE; | 1452 return RESTRICTION_NONE; |
1451 } | 1453 } |
1452 | 1454 |
1453 void AcceleratorController::SetKeyboardBrightnessControlDelegate( | 1455 void AcceleratorController::SetKeyboardBrightnessControlDelegate( |
1454 scoped_ptr<KeyboardBrightnessControlDelegate> | 1456 scoped_ptr<KeyboardBrightnessControlDelegate> |
1455 keyboard_brightness_control_delegate) { | 1457 keyboard_brightness_control_delegate) { |
1456 keyboard_brightness_control_delegate_ = | 1458 keyboard_brightness_control_delegate_ = |
1457 keyboard_brightness_control_delegate.Pass(); | 1459 std::move(keyboard_brightness_control_delegate); |
1458 } | 1460 } |
1459 | 1461 |
1460 } // namespace ash | 1462 } // namespace ash |
OLD | NEW |