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

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: merge 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 840 matching lines...) Expand 10 before | Expand all | Expand 10 after
851 DialogSection section) const { 851 DialogSection section) const {
852 return section != SECTION_CC_BILLING || !IsSubmitPausedOn(wallet::VERIFY_CVV); 852 return section != SECTION_CC_BILLING || !IsSubmitPausedOn(wallet::VERIFY_CVV);
853 } 853 }
854 854
855 void AutofillDialogControllerImpl::EditClickedForSection( 855 void AutofillDialogControllerImpl::EditClickedForSection(
856 DialogSection section) { 856 DialogSection section) {
857 DetailInputs* inputs = MutableRequestedFieldsForSection(section); 857 DetailInputs* inputs = MutableRequestedFieldsForSection(section);
858 scoped_ptr<DataModelWrapper> model = CreateWrapper(section); 858 scoped_ptr<DataModelWrapper> model = CreateWrapper(section);
859 model->FillInputs(inputs); 859 model->FillInputs(inputs);
860 section_editing_state_[section] = true; 860 section_editing_state_[section] = true;
861 view_->UpdateSection(section); 861 view_->UpdateSection(section, CLEAR_USER_INPUT);
862 } 862 }
863 863
864 void AutofillDialogControllerImpl::EditCancelledForSection( 864 void AutofillDialogControllerImpl::EditCancelledForSection(
865 DialogSection section) { 865 DialogSection section) {
866 ResetManualInputForSection(section); 866 ResetManualInputForSection(section);
867 view_->UpdateSection(section); 867 view_->UpdateSection(section, CLEAR_USER_INPUT);
868 } 868 }
869 869
870 gfx::Image AutofillDialogControllerImpl::IconForField( 870 gfx::Image AutofillDialogControllerImpl::IconForField(
871 AutofillFieldType type, const string16& user_input) const { 871 AutofillFieldType type, const string16& user_input) const {
872 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); 872 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
873 if (type == CREDIT_CARD_VERIFICATION_CODE) 873 if (type == CREDIT_CARD_VERIFICATION_CODE)
874 return rb.GetImageNamed(IDR_CREDIT_CARD_CVC_HINT); 874 return rb.GetImageNamed(IDR_CREDIT_CARD_CVC_HINT);
875 875
876 // For the credit card, we show a few grayscale images, and possibly one 876 // For the credit card, we show a few grayscale images, and possibly one
877 // color image if |user_input| is a valid card number. 877 // color image if |user_input| is a valid card number.
(...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after
1275 1275
1276 // TODO(estade): use isherman's method of looping. 1276 // TODO(estade): use isherman's method of looping.
1277 static const DialogSection sections[] = { SECTION_EMAIL, 1277 static const DialogSection sections[] = { SECTION_EMAIL,
1278 SECTION_CC, 1278 SECTION_CC,
1279 SECTION_CC_BILLING, 1279 SECTION_CC_BILLING,
1280 SECTION_BILLING, 1280 SECTION_BILLING,
1281 SECTION_SHIPPING }; 1281 SECTION_SHIPPING };
1282 for (size_t i = 0; i < arraysize(sections); ++i) { 1282 for (size_t i = 0; i < arraysize(sections); ++i) {
1283 DialogSection section = sections[i]; 1283 DialogSection section = sections[i];
1284 wrapper->FillInputs(MutableRequestedFieldsForSection(section)); 1284 wrapper->FillInputs(MutableRequestedFieldsForSection(section));
1285 view_->UpdateSection(section); 1285 view_->UpdateSection(section, KEEP_USER_INPUT);
1286 } 1286 }
1287 1287
1288 metric_logger_.LogDialogPopupEvent( 1288 metric_logger_.LogDialogPopupEvent(
1289 dialog_type_, AutofillMetrics::DIALOG_POPUP_FORM_FILLED); 1289 dialog_type_, AutofillMetrics::DIALOG_POPUP_FORM_FILLED);
1290 1290
1291 // TODO(estade): not sure why it's necessary to do this explicitly. 1291 // TODO(estade): not sure why it's necessary to do this explicitly.
1292 HidePopup(); 1292 HidePopup();
1293 } 1293 }
1294 1294
1295 void AutofillDialogControllerImpl::RemoveSuggestion(const string16& value, 1295 void AutofillDialogControllerImpl::RemoveSuggestion(const string16& value,
(...skipping 795 matching lines...) Expand 10 before | Expand all | Expand 10 after
2091 AutofillMetrics::DIALOG_USER_SIGNED_IN_NO_WALLET_NO_AUTOFILL; 2091 AutofillMetrics::DIALOG_USER_SIGNED_IN_NO_WALLET_NO_AUTOFILL;
2092 } 2092 }
2093 2093
2094 // Has Wallet items. 2094 // Has Wallet items.
2095 return has_autofill_profiles ? 2095 return has_autofill_profiles ?
2096 AutofillMetrics::DIALOG_USER_SIGNED_IN_HAS_WALLET_HAS_AUTOFILL : 2096 AutofillMetrics::DIALOG_USER_SIGNED_IN_HAS_WALLET_HAS_AUTOFILL :
2097 AutofillMetrics::DIALOG_USER_SIGNED_IN_HAS_WALLET_NO_AUTOFILL; 2097 AutofillMetrics::DIALOG_USER_SIGNED_IN_HAS_WALLET_NO_AUTOFILL;
2098 } 2098 }
2099 2099
2100 } // namespace autofill 2100 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698