| Index: ios/chrome/browser/ui/uikit_ui_util.mm
|
| diff --git a/ios/chrome/browser/ui/uikit_ui_util.mm b/ios/chrome/browser/ui/uikit_ui_util.mm
|
| index 381ffc198c98e5f63670977d94d4ca0e3c0caa78..45d3ce5d0403735a1c11072793906ba0c6ef518d 100644
|
| --- a/ios/chrome/browser/ui/uikit_ui_util.mm
|
| +++ b/ios/chrome/browser/ui/uikit_ui_util.mm
|
| @@ -12,6 +12,7 @@
|
| #import <UIKit/UIKit.h>
|
| #include <cmath>
|
|
|
| +#include "base/ios/ios_util.h"
|
| #include "base/logging.h"
|
| #include "base/mac/foundation_util.h"
|
| #include "ios/chrome/browser/experimental_flags.h"
|
| @@ -660,3 +661,23 @@ UIResponder* GetFirstResponder() {
|
| gFirstResponder = nil;
|
| return firstResponder;
|
| }
|
| +
|
| +// On iOS10 and above, trigger a haptic vibration for the user selecting an
|
| +// action. This is a no-op for devices that do not support it.
|
| +void TriggerHapticFeedbackForAction() {
|
| + if (base::ios::IsRunningOnIOS10OrLater()) {
|
| + UIImpactFeedbackGenerator* generator =
|
| + [[UIImpactFeedbackGenerator alloc] init];
|
| + [generator impactOccurred];
|
| + }
|
| +}
|
| +
|
| +// On iOS10 and above, trigger a haptic vibration for the change in selection.
|
| +// This is a no-op for devices that do not support it.
|
| +void TriggerHapticFeedbackForSelectionChange() {
|
| + if (base::ios::IsRunningOnIOS10OrLater()) {
|
| + UISelectionFeedbackGenerator* generator =
|
| + [[UISelectionFeedbackGenerator alloc] init];
|
| + [generator selectionChanged];
|
| + }
|
| +}
|
|
|