OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 #import "ios/chrome/browser/ui/uikit_ui_util.h" | 5 #import "ios/chrome/browser/ui/uikit_ui_util.h" |
6 | 6 |
7 #import <Accelerate/Accelerate.h> | 7 #import <Accelerate/Accelerate.h> |
8 #import <Foundation/Foundation.h> | 8 #import <Foundation/Foundation.h> |
9 #import <QuartzCore/QuartzCore.h> | 9 #import <QuartzCore/QuartzCore.h> |
10 #include <stddef.h> | 10 #include <stddef.h> |
(...skipping 663 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
674 | 674 |
675 // On iOS10 and above, trigger a haptic vibration for the change in selection. | 675 // On iOS10 and above, trigger a haptic vibration for the change in selection. |
676 // This is a no-op for devices that do not support it. | 676 // This is a no-op for devices that do not support it. |
677 void TriggerHapticFeedbackForSelectionChange() { | 677 void TriggerHapticFeedbackForSelectionChange() { |
678 if (base::ios::IsRunningOnIOS10OrLater()) { | 678 if (base::ios::IsRunningOnIOS10OrLater()) { |
679 UISelectionFeedbackGenerator* generator = | 679 UISelectionFeedbackGenerator* generator = |
680 [[UISelectionFeedbackGenerator alloc] init]; | 680 [[UISelectionFeedbackGenerator alloc] init]; |
681 [generator selectionChanged]; | 681 [generator selectionChanged]; |
682 } | 682 } |
683 } | 683 } |
| 684 |
| 685 // On iOS10 and above, trigger a haptic vibration for a notification. |
| 686 // This is a no-op for devices that do not support it. |
| 687 void TriggerHapticFeedbackForNotification(UINotificationFeedbackType type) { |
| 688 if (base::ios::IsRunningOnIOS10OrLater()) { |
| 689 UINotificationFeedbackGenerator* generator = |
| 690 [[UINotificationFeedbackGenerator alloc] init]; |
| 691 [generator notificationOccurred:type]; |
| 692 } |
| 693 } |
OLD | NEW |