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

Unified Diff: chrome/browser/views/autofill_profiles_view_win.cc

Issue 2828014: AutoFill: Add support for multi-select and delete. (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: '' Created 10 years, 6 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 | « chrome/browser/views/autofill_profiles_view_win.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/views/autofill_profiles_view_win.cc
===================================================================
--- chrome/browser/views/autofill_profiles_view_win.cc (revision 50320)
+++ chrome/browser/views/autofill_profiles_view_win.cc (working copy)
@@ -163,9 +163,17 @@
void AutoFillProfilesView::DeleteClicked() {
DCHECK(scroll_view_);
DCHECK(table_model_.get());
- int selected_item_index = scroll_view_->FirstSelectedRow();
- DCHECK(selected_item_index >= 0);
- table_model_->RemoveItem(selected_item_index);
+ DCHECK_GT(scroll_view_->SelectedRowCount(), 0);
+ int last_view_row = -1;
+ for (views::TableView::iterator i = scroll_view_->SelectionBegin();
+ i != scroll_view_->SelectionEnd(); ++i) {
+ last_view_row = scroll_view_->ModelToView(*i);
+ table_model_->RemoveItem(*i);
+ }
+ if (last_view_row >= table_model_->RowCount())
+ last_view_row = table_model_->RowCount() - 1;
+ if (last_view_row >= 0)
+ scroll_view_->Select(scroll_view_->ViewToModel(last_view_row));
UpdateButtonState();
}
@@ -181,9 +189,9 @@
add_credit_card_button_->SetEnabled(personal_data_manager_->IsDataLoaded() &&
!child_dialog_opened_);
- int selected_item_index = scroll_view_->FirstSelectedRow();
- edit_button_->SetEnabled(selected_item_index >= 0 && !child_dialog_opened_);
- remove_button_->SetEnabled(selected_item_index >= 0 && !child_dialog_opened_);
+ int selected_row_count = scroll_view_->SelectedRowCount();
+ edit_button_->SetEnabled(selected_row_count == 1 && !child_dialog_opened_);
+ remove_button_->SetEnabled(selected_row_count > 0 && !child_dialog_opened_);
}
void AutoFillProfilesView::ChildWindowOpened() {
@@ -383,7 +391,7 @@
columns.back().sortable = false;
scroll_view_ = new views::TableView(table_model_.get(), columns,
- views::TEXT_ONLY, true, true, true);
+ views::TEXT_ONLY, false, true, true);
scroll_view_->SetObserver(this);
add_address_button_ = new views::NativeButton(this,
« no previous file with comments | « chrome/browser/views/autofill_profiles_view_win.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698