This commit is contained in:
trop[bot] 2018-08-19 14:14:05 -07:00 committed by Samuel Attard
parent 4e3aa2e061
commit 0783eb9881

View file

@ -97,11 +97,6 @@ NSAlert* CreateNSAlert(NativeWindow* parent_window,
NSArray* ns_buttons = [alert buttons];
int button_count = static_cast<int>([ns_buttons count]);
// Bind cancel id button to escape key if there is more than one button
if (button_count > 1 && cancel_id >= 0 && cancel_id < button_count) {
[[ns_buttons objectAtIndex:cancel_id] setKeyEquivalent:@"\e"];
}
if (default_id >= 0 && default_id < button_count) {
// Focus the button at default_id if the user opted to do so.
// The first button added gets set as the default selected.
@ -110,6 +105,11 @@ NSAlert* CreateNSAlert(NativeWindow* parent_window,
[[ns_buttons objectAtIndex:default_id] setKeyEquivalent:@"\r"];
}
// Bind cancel id button to escape key if there is more than one button
if (button_count > 1 && cancel_id >= 0 && cancel_id < button_count) {
[[ns_buttons objectAtIndex:cancel_id] setKeyEquivalent:@"\e"];
}
if (!checkbox_label.empty()) {
alert.showsSuppressionButton = YES;
alert.suppressionButton.title = base::SysUTF8ToNSString(checkbox_label);