summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/browser/autofill/autofill_dialog_controller_mac.mm17
1 files changed, 7 insertions, 10 deletions
diff --git a/chrome/browser/autofill/autofill_dialog_controller_mac.mm b/chrome/browser/autofill/autofill_dialog_controller_mac.mm
index d0e16ae..912d970 100644
--- a/chrome/browser/autofill/autofill_dialog_controller_mac.mm
+++ b/chrome/browser/autofill/autofill_dialog_controller_mac.mm
@@ -360,19 +360,16 @@ void PersonalDataManagerObserver::OnPersonalDataLoaded() {
// Deletes selected items; either addresses, credit cards, or a mixture of the
// two depending on the items selected.
- (IBAction)deleteSelection:(id)sender {
- NSIndexSet* selectedRows = [tableView_ selectedRowIndexes];
+ NSIndexSet* selection = [tableView_ selectedRowIndexes];
NSInteger selectedRow = [tableView_ selectedRow];
- NSInteger rowCount = [tableView_ numberOfRows];
// Loop through from last to first deleting selected items as we go.
- for (NSInteger i = rowCount-1; i>=0; --i) {
- if (![selectedRows containsIndex:i])
- continue;
-
+ for (NSUInteger i = [selection lastIndex];
+ i != NSNotFound;
+ i = [selection indexLessThanIndex:i]) {
// We keep track of the "top most" selection in the list so we know where
- // to to set new selection below.
- if (i < selectedRow)
- selectedRow = i;
+ // to set new selection below.
+ selectedRow = i;
if ([self isProfileRow:i]) {
profiles_.erase(
@@ -391,7 +388,7 @@ void PersonalDataManagerObserver::OnPersonalDataLoaded() {
[tableView_ selectRowIndexes:[NSIndexSet indexSetWithIndex:selectedRow]
byExtendingSelection:NO];
} else {
- [tableView_ selectRowIndexes:[NSIndexSet indexSet] byExtendingSelection:NO];
+ [tableView_ deselectAll:self];
}
UpdateProfileLabels(&profiles_);