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

Unified Diff: chrome/browser/ui/cocoa/autofill/autofill_section_container.mm

Issue 88943003: [rAC, OSX] Update 'enabled' status on edits. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Exclude invalid fields - prevents DCHECK from firing. Created 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/cocoa/autofill/autofill_section_container.mm
diff --git a/chrome/browser/ui/cocoa/autofill/autofill_section_container.mm b/chrome/browser/ui/cocoa/autofill/autofill_section_container.mm
index be76f04169b309345865a3df79f8dcc5b7c97aeb..15ad900fcc56ea000b756f2a7da40834212bea25 100644
--- a/chrome/browser/ui/cocoa/autofill/autofill_section_container.mm
+++ b/chrome/browser/ui/cocoa/autofill/autofill_section_container.mm
@@ -117,6 +117,9 @@ bool CompareInputRows(const autofill::DetailInput* input1,
// Refresh all field icons based on |delegate_| status.
- (void)updateFieldIcons;
+// Refresh the enabled/disabled state of all input fields.
+- (void)updateEditability;
+
@end
@implementation AutofillSectionContainer
@@ -282,6 +285,7 @@ bool CompareInputRows(const autofill::DetailInput* input1,
delegate_->FocusMoved();
[validationDelegate_ hideErrorBubble];
[self validateFor:autofill::VALIDATE_EDIT];
+ [self updateEditability];
}
- (void)updateSuggestionState {
@@ -379,7 +383,10 @@ bool CompareInputRows(const autofill::DetailInput* input1,
- (void)addInputsToArray:(NSMutableArray*)array {
[array addObjectsFromArray:[inputs_ subviews]];
- [array addObject:[suggestContainer_ inputField]];
+
+ // Only credit card sections can have a suggestion input.
+ if ([self isCreditCardSection])
+ [array addObject:[suggestContainer_ inputField]];
}
#pragma mark Internal API for AutofillSectionContainer.
@@ -435,6 +442,7 @@ bool CompareInputRows(const autofill::DetailInput* input1,
// Update the icon if necessary.
if (delegate_->FieldControlsIcons(type))
[self updateFieldIcons];
+ [self updateEditability];
}
- (autofill::ServerFieldType)fieldTypeForControl:(NSControl*)control {
@@ -489,16 +497,13 @@ bool CompareInputRows(const autofill::DetailInput* input1,
NSControl<AutofillInputField>* field = [inputs_ viewWithTag:iter->type];
DCHECK(field);
- // TODO(groby): We need to account for the fact editability state can change
- // after any input in the same section is edited by the user.
- [field setEnabled:delegate_->InputIsEditable(*iter, section_)];
-
if (shouldClobber || [field isDefault]) {
[field setFieldValue:base::SysUTF16ToNSString(iter->initial_value)];
}
if (shouldClobber)
[field setValidityMessage:@""];
}
+ [self updateEditability];
[self updateFieldIcons];
[self modelChanged];
}
@@ -627,6 +632,17 @@ bool CompareInputRows(const autofill::DetailInput* input1,
}
}
+- (void)updateEditability {
+
+ base::scoped_nsobject<NSMutableArray> controls([[NSMutableArray alloc] init]);
+ [self addInputsToArray:controls];
+ for (NSControl<AutofillInputField>* control in controls.get()) {
+ autofill::ServerFieldType type = [self fieldTypeForControl:control];
+ const autofill::DetailInput* input = [self detailInputForType:type];
+ [control setEnabled:delegate_->InputIsEditable(*input, section_)];
+ }
+}
+
@end
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698