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

Side by Side Diff: chrome/browser/ui/autofill/autofill_dialog_controller_impl.cc

Issue 13607006: rAc: don't clobber user input when accepting autofill popup suggestion (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: a couple more bugs Created 7 years, 8 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/ui/autofill/autofill_dialog_controller_impl.h" 5 #include "chrome/browser/ui/autofill/autofill_dialog_controller_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 835 matching lines...) Expand 10 before | Expand all | Expand 10 after
846 DialogSection section) const { 846 DialogSection section) const {
847 return section != SECTION_CC_BILLING || !IsSubmitPausedOn(wallet::VERIFY_CVV); 847 return section != SECTION_CC_BILLING || !IsSubmitPausedOn(wallet::VERIFY_CVV);
848 } 848 }
849 849
850 void AutofillDialogControllerImpl::EditClickedForSection( 850 void AutofillDialogControllerImpl::EditClickedForSection(
851 DialogSection section) { 851 DialogSection section) {
852 DetailInputs* inputs = MutableRequestedFieldsForSection(section); 852 DetailInputs* inputs = MutableRequestedFieldsForSection(section);
853 scoped_ptr<DataModelWrapper> model = CreateWrapper(section); 853 scoped_ptr<DataModelWrapper> model = CreateWrapper(section);
854 model->FillInputs(inputs); 854 model->FillInputs(inputs);
855 section_editing_state_[section] = true; 855 section_editing_state_[section] = true;
856 view_->UpdateSection(section); 856 view_->UpdateSection(section, CLEAR_USER_INPUT);
857 } 857 }
858 858
859 void AutofillDialogControllerImpl::EditCancelledForSection( 859 void AutofillDialogControllerImpl::EditCancelledForSection(
860 DialogSection section) { 860 DialogSection section) {
861 DetailInputs* inputs = MutableRequestedFieldsForSection(section); 861 DetailInputs* inputs = MutableRequestedFieldsForSection(section);
862 for (size_t i = 0; i < inputs->size(); ++i) 862 for (size_t i = 0; i < inputs->size(); ++i)
863 (*inputs)[i].initial_value.clear(); 863 (*inputs)[i].initial_value.clear();
864 section_editing_state_[section] = false; 864 section_editing_state_[section] = false;
865 view_->UpdateSection(section); 865 view_->UpdateSection(section, CLEAR_USER_INPUT);
866 } 866 }
867 867
868 gfx::Image AutofillDialogControllerImpl::IconForField( 868 gfx::Image AutofillDialogControllerImpl::IconForField(
869 AutofillFieldType type, const string16& user_input) const { 869 AutofillFieldType type, const string16& user_input) const {
870 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); 870 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
871 if (type == CREDIT_CARD_VERIFICATION_CODE) 871 if (type == CREDIT_CARD_VERIFICATION_CODE)
872 return rb.GetImageNamed(IDR_CREDIT_CARD_CVC_HINT); 872 return rb.GetImageNamed(IDR_CREDIT_CARD_CVC_HINT);
873 873
874 // For the credit card, we show a few grayscale images, and possibly one 874 // For the credit card, we show a few grayscale images, and possibly one
875 // color image if |user_input| is a valid card number. 875 // color image if |user_input| is a valid card number.
(...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after
1264 1264
1265 FormGroup* form_group = section_showing_popup_ == SECTION_CC ? 1265 FormGroup* form_group = section_showing_popup_ == SECTION_CC ?
1266 static_cast<FormGroup*>(GetManager()->GetCreditCardByGUID(pair.first)) : 1266 static_cast<FormGroup*>(GetManager()->GetCreditCardByGUID(pair.first)) :
1267 // TODO(estade): need to use the variant, |pair.second|. 1267 // TODO(estade): need to use the variant, |pair.second|.
1268 static_cast<FormGroup*>(GetManager()->GetProfileByGUID(pair.first)); 1268 static_cast<FormGroup*>(GetManager()->GetProfileByGUID(pair.first));
1269 DCHECK(form_group); 1269 DCHECK(form_group);
1270 1270
1271 FillInputFromFormGroup( 1271 FillInputFromFormGroup(
1272 form_group, 1272 form_group,
1273 MutableRequestedFieldsForSection(section_showing_popup_)); 1273 MutableRequestedFieldsForSection(section_showing_popup_));
1274 view_->UpdateSection(section_showing_popup_); 1274 view_->UpdateSection(section_showing_popup_, KEEP_USER_INPUT);
1275 1275
1276 metric_logger_.LogDialogPopupEvent( 1276 metric_logger_.LogDialogPopupEvent(
1277 dialog_type_, AutofillMetrics::DIALOG_POPUP_FORM_FILLED); 1277 dialog_type_, AutofillMetrics::DIALOG_POPUP_FORM_FILLED);
1278 1278
1279 // TODO(estade): not sure why it's necessary to do this explicitly. 1279 // TODO(estade): not sure why it's necessary to do this explicitly.
1280 HidePopup(); 1280 HidePopup();
1281 } 1281 }
1282 1282
1283 void AutofillDialogControllerImpl::RemoveSuggestion(const string16& value, 1283 void AutofillDialogControllerImpl::RemoveSuggestion(const string16& value,
1284 int identifier) { 1284 int identifier) {
(...skipping 792 matching lines...) Expand 10 before | Expand all | Expand 10 after
2077 AutofillMetrics::DIALOG_USER_SIGNED_IN_NO_WALLET_NO_AUTOFILL; 2077 AutofillMetrics::DIALOG_USER_SIGNED_IN_NO_WALLET_NO_AUTOFILL;
2078 } 2078 }
2079 2079
2080 // Has Wallet items. 2080 // Has Wallet items.
2081 return has_autofill_profiles ? 2081 return has_autofill_profiles ?
2082 AutofillMetrics::DIALOG_USER_SIGNED_IN_HAS_WALLET_HAS_AUTOFILL : 2082 AutofillMetrics::DIALOG_USER_SIGNED_IN_HAS_WALLET_HAS_AUTOFILL :
2083 AutofillMetrics::DIALOG_USER_SIGNED_IN_HAS_WALLET_NO_AUTOFILL; 2083 AutofillMetrics::DIALOG_USER_SIGNED_IN_HAS_WALLET_NO_AUTOFILL;
2084 } 2084 }
2085 2085
2086 } // namespace autofill 2086 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698