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

Unified Diff: chrome/browser/ui/views/autofill/autofill_dialog_views.cc

Issue 23756007: [rac] Show amex specific cvc hint (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Move icon dependency logic into controller for testability Created 7 years, 3 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/ui/views/autofill/autofill_dialog_views.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/views/autofill/autofill_dialog_views.cc
diff --git a/chrome/browser/ui/views/autofill/autofill_dialog_views.cc b/chrome/browser/ui/views/autofill/autofill_dialog_views.cc
index 8da87595200e51981cf2143645da31ab92b92040..5ceb00fbdb8534ab202a6c6abf28e058ef029290 100644
--- a/chrome/browser/ui/views/autofill/autofill_dialog_views.cc
+++ b/chrome/browser/ui/views/autofill/autofill_dialog_views.cc
@@ -2256,7 +2256,7 @@ void AutofillDialogViews::TextfieldEditedOrActivated(
SetValidityForInput<DecoratedTextfield>(
decorated,
delegate_->InputValidityMessage(group->section, type,
- textfield->text()));
+ textfield->text()));
// If the field transitioned from invalid to valid, re-validate the group,
// since inter-field checks become meaningful with valid fields.
@@ -2264,8 +2264,18 @@ void AutofillDialogViews::TextfieldEditedOrActivated(
ValidateGroup(*group, VALIDATE_EDIT);
}
- gfx::Image icon = delegate_->IconForField(type, textfield->text());
- decorated->SetIcon(icon);
+ if (!delegate_->IsIconDependentField(type))
+ decorated->SetIcon(delegate_->IconForField(type, textfield->text()));
+
+ ServerFieldType dependent_type = UNKNOWN_TYPE;
+ if (delegate_->IsIconDependencyField(type, &dependent_type)) {
+ DecoratedTextfield* dependent_field =
+ DecoratedTextfieldForServerFieldType(group, dependent_type);
+ if (dependent_field) {
+ dependent_field->SetIcon(
+ delegate_->IconForField(dependent_type, textfield->text()));
Evan Stade 2013/09/11 00:17:03 API abuse! you're passing a type and a textval tha
please use gerrit instead 2013/09/11 16:27:40 How about adding an API call "IconForDependentFiel
+ }
+ }
}
void AutofillDialogViews::UpdateButtonStripExtraView() {
@@ -2353,6 +2363,19 @@ void AutofillDialogViews::DetailsContainerBoundsChanged() {
error_bubble_->UpdatePosition();
}
+DecoratedTextfield* AutofillDialogViews::DecoratedTextfieldForServerFieldType(
+ const DetailsGroup* group,
+ ServerFieldType type) const {
+ for (TextfieldMap::const_iterator field_iter = group->textfields.begin();
+ field_iter != group->textfields.end();
+ ++field_iter) {
+ if (field_iter->first->type == type)
+ return field_iter->second;
+ }
+
+ return NULL;
+}
+
AutofillDialogViews::DetailsGroup::DetailsGroup(DialogSection section)
: section(section),
container(NULL),
« no previous file with comments | « chrome/browser/ui/views/autofill/autofill_dialog_views.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698