Commit 996ba055 authored by Gauthier Ambard's avatar Gauthier Ambard Committed by Commit Bot

Add HapticFeedback on popup menus

This CL adds HapticFeedback when the popup menus are displayed when
long pressing the toolbar buttons.

Bug: 864923
Cq-Include-Trybots: luci.chromium.try:ios-simulator-full-configs;master.tryserver.chromium.mac:ios-simulator-cronet
Change-Id: I7fad41d33b500874e578d1f913d792a20baf5a15
Reviewed-on: https://chromium-review.googlesource.com/1141949Reviewed-by: default avatarOlivier Robin <olivierrobin@chromium.org>
Reviewed-by: default avatarRohit Rao <rohitrao@chromium.org>
Commit-Queue: Gauthier Ambard <gambard@chromium.org>
Cr-Commit-Position: refs/heads/master@{#576408}
parent 5cda8443
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
#import "ios/chrome/browser/ui/popup_menu/popup_menu_constants.h" #import "ios/chrome/browser/ui/popup_menu/popup_menu_constants.h"
#import "ios/chrome/browser/ui/popup_menu/popup_menu_table_view_controller_commands.h" #import "ios/chrome/browser/ui/popup_menu/popup_menu_table_view_controller_commands.h"
#import "ios/chrome/browser/ui/table_view/chrome_table_view_styler.h" #import "ios/chrome/browser/ui/table_view/chrome_table_view_styler.h"
#import "ios/chrome/browser/ui/uikit_ui_util.h"
#if !defined(__has_feature) || !__has_feature(objc_arc) #if !defined(__has_feature) || !__has_feature(objc_arc)
#error "This file requires ARC support." #error "This file requires ARC support."
...@@ -79,6 +80,7 @@ const CGFloat kScrollIndicatorVerticalInsets = 11; ...@@ -79,6 +80,7 @@ const CGFloat kScrollIndicatorVerticalInsets = 11;
[self.tableView selectRowAtIndexPath:rowIndexPath [self.tableView selectRowAtIndexPath:rowIndexPath
animated:NO animated:NO
scrollPosition:UITableViewScrollPositionNone]; scrollPosition:UITableViewScrollPositionNone];
TriggerHapticFeedbackForSelectionChange();
} }
} }
......
...@@ -1182,6 +1182,7 @@ NSString* StringForItemCount(long count) { ...@@ -1182,6 +1182,7 @@ NSString* StringForItemCount(long count) {
- (void)handleTabSwitcherLongPress:(UILongPressGestureRecognizer*)gesture { - (void)handleTabSwitcherLongPress:(UILongPressGestureRecognizer*)gesture {
if (gesture.state == UIGestureRecognizerStateBegan) { if (gesture.state == UIGestureRecognizerStateBegan) {
[self.dispatcher showTabStripTabGridButtonPopup]; [self.dispatcher showTabStripTabGridButtonPopup];
TriggerHapticFeedbackForAction();
} else if (gesture.state == UIGestureRecognizerStateEnded) { } else if (gesture.state == UIGestureRecognizerStateEnded) {
[self.longPressDelegate [self.longPressDelegate
longPressEndedAtPoint:[gesture locationOfTouch:0 inView:nil]]; longPressEndedAtPoint:[gesture locationOfTouch:0 inView:nil]];
......
...@@ -368,11 +368,11 @@ const CGFloat kTabGridAnimationsTotalDuration = 0.5; ...@@ -368,11 +368,11 @@ const CGFloat kTabGridAnimationsTotalDuration = 0.5;
// Adds a LongPressGesture to the |view|, with target on -|handleLongPress:|. // Adds a LongPressGesture to the |view|, with target on -|handleLongPress:|.
- (void)addLongPressGestureToView:(UIView*)view { - (void)addLongPressGestureToView:(UIView*)view {
UILongPressGestureRecognizer* navigationHistoryLongPress = UILongPressGestureRecognizer* longPressGestureRecognizer =
[[UILongPressGestureRecognizer alloc] [[UILongPressGestureRecognizer alloc]
initWithTarget:self initWithTarget:self
action:@selector(handleLongPress:)]; action:@selector(handleLongPress:)];
[view addGestureRecognizer:navigationHistoryLongPress]; [view addGestureRecognizer:longPressGestureRecognizer];
} }
// Handles the long press on the views. // Handles the long press on the views.
...@@ -390,6 +390,7 @@ const CGFloat kTabGridAnimationsTotalDuration = 0.5; ...@@ -390,6 +390,7 @@ const CGFloat kTabGridAnimationsTotalDuration = 0.5;
base::RecordAction(base::UserMetricsAction("MobileToolbarShowMenu")); base::RecordAction(base::UserMetricsAction("MobileToolbarShowMenu"));
[self.dispatcher showToolsMenuPopup]; [self.dispatcher showToolsMenuPopup];
} }
TriggerHapticFeedbackForAction();
} else if (gesture.state == UIGestureRecognizerStateEnded) { } else if (gesture.state == UIGestureRecognizerStateEnded) {
[self.longPressDelegate [self.longPressDelegate
longPressEndedAtPoint:[gesture locationOfTouch:0 inView:nil]]; longPressEndedAtPoint:[gesture locationOfTouch:0 inView:nil]];
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment