Skip to content
This repository has been archived by the owner on Apr 3, 2020. It is now read-only.

Commit

Permalink
Add a callback for cancelling the context menu.
Browse files Browse the repository at this point in the history
The callback updates the |visible| property to NO so clients can
correctly determine if the context menu has been dismissed.

BUG=489121

Review URL: https://codereview.chromium.org/1144873002

Cr-Commit-Position: refs/heads/master@{#330562}
  • Loading branch information
lliabraa authored and Commit bot committed May 19, 2015
1 parent 601f2ef commit 1f113f3
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion ui/base/ios/cru_context_menu_controller.mm
Original file line number Diff line number Diff line change
Expand Up @@ -268,10 +268,13 @@ - (void)showWithHolder:(CRUContextMenuHolder*)menuHolder
}];

// Cancel button goes last, to match other browsers.
void (^cancelHandler)(UIAlertAction*) = ^(UIAlertAction* action) {
[weakSelf setVisible:NO];
};
UIAlertAction* cancel_action =
[UIAlertAction actionWithTitle:l10n_util::GetNSString(IDS_APP_CANCEL)
style:UIAlertActionStyleCancel
handler:nil];
handler:cancelHandler];
[alert addAction:cancel_action];

// Present sheet/popover using controller that is added to view hierarchy.
Expand Down

0 comments on commit 1f113f3

Please sign in to comment.