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

Side by Side Diff: chrome/browser/views/autofill_profiles_view_win.cc

Issue 3806008: Never allow empty preview entries. As some data is always present (we drop co... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 1 month 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/views/autofill_profiles_view_win.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/views/autofill_profiles_view_win.h" 5 #include "chrome/browser/views/autofill_profiles_view_win.h"
6 6
7 #include <vsstyle.h> 7 #include <vsstyle.h>
8 #include <vssym32.h> 8 #include <vssym32.h>
9 9
10 #include "app/l10n_util.h" 10 #include "app/l10n_util.h"
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 !child_dialog_opened_ && 251 !child_dialog_opened_ &&
252 autofill_enabled); 252 autofill_enabled);
253 253
254 int selected_row_count = scroll_view_->SelectedRowCount(); 254 int selected_row_count = scroll_view_->SelectedRowCount();
255 edit_button_->SetEnabled(selected_row_count == 1 && !child_dialog_opened_ && 255 edit_button_->SetEnabled(selected_row_count == 1 && !child_dialog_opened_ &&
256 autofill_enabled); 256 autofill_enabled);
257 remove_button_->SetEnabled(selected_row_count > 0 && !child_dialog_opened_ && 257 remove_button_->SetEnabled(selected_row_count > 0 && !child_dialog_opened_ &&
258 autofill_enabled); 258 autofill_enabled);
259 } 259 }
260 260
261 void AutoFillProfilesView::UpdateProfileLabels() {
262 std::vector<AutoFillProfile*> profiles;
263 profiles.resize(profiles_set_.size());
264 for (size_t i = 0; i < profiles_set_.size(); ++i) {
265 profiles[i] = &(profiles_set_[i].address);
266 }
267 AutoFillProfile::AdjustInferredLabels(&profiles);
268 }
269
270 void AutoFillProfilesView::ChildWindowOpened() { 261 void AutoFillProfilesView::ChildWindowOpened() {
271 child_dialog_opened_ = true; 262 child_dialog_opened_ = true;
272 UpdateWidgetState(); 263 UpdateWidgetState();
273 } 264 }
274 265
275 void AutoFillProfilesView::ChildWindowClosed() { 266 void AutoFillProfilesView::ChildWindowClosed() {
276 child_dialog_opened_ = false; 267 child_dialog_opened_ = false;
277 UpdateWidgetState(); 268 UpdateWidgetState();
278 } 269 }
279 270
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
439 } 430 }
440 431
441 void AutoFillProfilesView::OnPersonalDataChanged() { 432 void AutoFillProfilesView::OnPersonalDataChanged() {
442 profiles_set_.clear(); 433 profiles_set_.clear();
443 for (std::vector<AutoFillProfile*>::const_iterator address_it = 434 for (std::vector<AutoFillProfile*>::const_iterator address_it =
444 personal_data_manager_->profiles().begin(); 435 personal_data_manager_->profiles().begin();
445 address_it != personal_data_manager_->profiles().end(); 436 address_it != personal_data_manager_->profiles().end();
446 ++address_it) { 437 ++address_it) {
447 profiles_set_.push_back(EditableSetInfo(*address_it)); 438 profiles_set_.push_back(EditableSetInfo(*address_it));
448 } 439 }
449 UpdateProfileLabels();
450 440
451 credit_card_set_.clear(); 441 credit_card_set_.clear();
452 for (std::vector<CreditCard*>::const_iterator cc_it = 442 for (std::vector<CreditCard*>::const_iterator cc_it =
453 personal_data_manager_->credit_cards().begin(); 443 personal_data_manager_->credit_cards().begin();
454 cc_it != personal_data_manager_->credit_cards().end(); 444 cc_it != personal_data_manager_->credit_cards().end();
455 ++cc_it) { 445 ++cc_it) {
456 credit_card_set_.push_back(EditableSetInfo(*cc_it)); 446 credit_card_set_.push_back(EditableSetInfo(*cc_it));
457 } 447 }
458 448
459 if (table_model_.get()) 449 if (table_model_.get())
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
556 !credit_card_set_.empty(); 546 !credit_card_set_.empty();
557 if (!imported_data_present) { 547 if (!imported_data_present) {
558 profiles_set_.reserve(personal_data_manager_->profiles().size()); 548 profiles_set_.reserve(personal_data_manager_->profiles().size());
559 for (std::vector<AutoFillProfile*>::const_iterator address_it = 549 for (std::vector<AutoFillProfile*>::const_iterator address_it =
560 personal_data_manager_->profiles().begin(); 550 personal_data_manager_->profiles().begin();
561 address_it != personal_data_manager_->profiles().end(); 551 address_it != personal_data_manager_->profiles().end();
562 ++address_it) { 552 ++address_it) {
563 profiles_set_.push_back(EditableSetInfo(*address_it)); 553 profiles_set_.push_back(EditableSetInfo(*address_it));
564 } 554 }
565 } 555 }
566 UpdateProfileLabels();
567 556
568 if (!imported_data_present) { 557 if (!imported_data_present) {
569 credit_card_set_.reserve(personal_data_manager_->credit_cards().size()); 558 credit_card_set_.reserve(personal_data_manager_->credit_cards().size());
570 for (std::vector<CreditCard*>::const_iterator cc_it = 559 for (std::vector<CreditCard*>::const_iterator cc_it =
571 personal_data_manager_->credit_cards().begin(); 560 personal_data_manager_->credit_cards().begin();
572 cc_it != personal_data_manager_->credit_cards().end(); 561 cc_it != personal_data_manager_->credit_cards().end();
573 ++cc_it) { 562 ++cc_it) {
574 credit_card_set_.push_back(EditableSetInfo(*cc_it)); 563 credit_card_set_.push_back(EditableSetInfo(*cc_it));
575 } 564 }
576 } 565 }
(...skipping 729 matching lines...) Expand 10 before | Expand all | Expand 10 after
1306 } 1295 }
1307 1296
1308 int AutoFillProfilesView::ContentListTableModel::RowCount() { 1297 int AutoFillProfilesView::ContentListTableModel::RowCount() {
1309 return profiles_->size() + credit_cards_->size(); 1298 return profiles_->size() + credit_cards_->size();
1310 } 1299 }
1311 1300
1312 std::wstring AutoFillProfilesView::ContentListTableModel::GetText( 1301 std::wstring AutoFillProfilesView::ContentListTableModel::GetText(
1313 int row, int column_id) { 1302 int row, int column_id) {
1314 DCHECK(row < static_cast<int>(profiles_->size() + credit_cards_->size())); 1303 DCHECK(row < static_cast<int>(profiles_->size() + credit_cards_->size()));
1315 if (row < static_cast<int>(profiles_->size())) { 1304 if (row < static_cast<int>(profiles_->size())) {
1316 return profiles_->at(row).address.PreviewSummary(); 1305 return profiles_->at(row).address.Label();
1317 } else { 1306 } else {
1318 row -= profiles_->size(); 1307 row -= profiles_->size();
1319 return credit_cards_->at(row).credit_card.PreviewSummary(); 1308 return credit_cards_->at(row).credit_card.PreviewSummary();
1320 } 1309 }
1321 } 1310 }
1322 1311
1323 TableModel::Groups AutoFillProfilesView::ContentListTableModel::GetGroups() { 1312 TableModel::Groups AutoFillProfilesView::ContentListTableModel::GetGroups() {
1324 TableModel::Groups groups; 1313 TableModel::Groups groups;
1325 1314
1326 TableModel::Group profile_group; 1315 TableModel::Group profile_group;
(...skipping 26 matching lines...) Expand all
1353 AutoFillDialogObserver* observer, 1342 AutoFillDialogObserver* observer,
1354 Profile* profile) { 1343 Profile* profile) {
1355 DCHECK(profile); 1344 DCHECK(profile);
1356 1345
1357 PersonalDataManager* personal_data_manager = 1346 PersonalDataManager* personal_data_manager =
1358 profile->GetPersonalDataManager(); 1347 profile->GetPersonalDataManager();
1359 DCHECK(personal_data_manager); 1348 DCHECK(personal_data_manager);
1360 AutoFillProfilesView::Show(parent, observer, personal_data_manager, profile, 1349 AutoFillProfilesView::Show(parent, observer, personal_data_manager, profile,
1361 profile->GetPrefs(), NULL, NULL); 1350 profile->GetPrefs(), NULL, NULL);
1362 } 1351 }
OLDNEW
« 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