Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(36)

Unified Diff: chrome/browser/autofill/autofill_dialog_controller_mac.mm

Issue 3056005: AutoFill Profiles dialog handles multi-select and delete on Mac (Follow up) (Closed)
Patch Set: Addressing nits. Created 10 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/autofill/autofill_dialog_controller_mac.mm
diff --git a/chrome/browser/autofill/autofill_dialog_controller_mac.mm b/chrome/browser/autofill/autofill_dialog_controller_mac.mm
index d0e16ae4cdc81c258a55013aaade9f570f74785e..912d97086548e24aaaafeae7b22864c04bb1ce91 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_);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698