OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 #import "chrome/browser/ui/cocoa/autofill/autofill_section_container.h" | 5 #import "chrome/browser/ui/cocoa/autofill/autofill_section_container.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/mac/foundation_util.h" | 9 #include "base/mac/foundation_util.h" |
10 #include "base/strings/sys_string_conversions.h" | 10 #include "base/strings/sys_string_conversions.h" |
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
338 [view_ setClickTarget:suggestButton_]; | 338 [view_ setClickTarget:suggestButton_]; |
339 else | 339 else |
340 [view_ setClickTarget:nil]; | 340 [view_ setClickTarget:nil]; |
341 [view_ setHidden:!delegate_->SectionIsActive(section_)]; | 341 [view_ setHidden:!delegate_->SectionIsActive(section_)]; |
342 } | 342 } |
343 | 343 |
344 - (void)update { | 344 - (void)update { |
345 [self updateAndClobber:YES]; | 345 [self updateAndClobber:YES]; |
346 } | 346 } |
347 | 347 |
348 - (void)fillForInput:(const autofill::DetailInput&)input { | 348 - (void)fillForType:(const autofill::ServerFieldType)type { |
349 // Make sure to overwrite the originating input if it is a text field. | 349 // Make sure to overwrite the originating input if it is a text field. |
350 AutofillTextField* field = | 350 AutofillTextField* field = |
351 base::mac::ObjCCast<AutofillTextField>([inputs_ viewWithTag:input.type]); | 351 base::mac::ObjCCast<AutofillTextField>([inputs_ viewWithTag:type]); |
352 [field setFieldValue:@""]; | 352 [field setFieldValue:@""]; |
353 | 353 |
354 if (ShouldOverwriteComboboxes(section_, input.type)) { | 354 if (ShouldOverwriteComboboxes(section_, type)) { |
355 for (NSControl* control in [inputs_ subviews]) { | 355 for (NSControl* control in [inputs_ subviews]) { |
356 AutofillPopUpButton* popup = | 356 AutofillPopUpButton* popup = |
357 base::mac::ObjCCast<AutofillPopUpButton>(control); | 357 base::mac::ObjCCast<AutofillPopUpButton>(control); |
358 if (popup) { | 358 if (popup) { |
359 autofill::ServerFieldType fieldType = | 359 autofill::ServerFieldType fieldType = |
360 [self fieldTypeForControl:popup]; | 360 [self fieldTypeForControl:popup]; |
361 if (autofill::AutofillType(fieldType).group() == | 361 if (autofill::AutofillType(fieldType).group() == |
362 autofill::CREDIT_CARD) { | 362 autofill::CREDIT_CARD) { |
363 ui::ComboboxModel* model = | 363 ui::ComboboxModel* model = |
364 delegate_->ComboboxModelForAutofillType(fieldType); | 364 delegate_->ComboboxModelForAutofillType(fieldType); |
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
717 - (void)activateFieldForInput:(const autofill::DetailInput&)input { | 717 - (void)activateFieldForInput:(const autofill::DetailInput&)input { |
718 if ([self detailInputForType:input.type] != &input) | 718 if ([self detailInputForType:input.type] != &input) |
719 return; | 719 return; |
720 | 720 |
721 NSControl<AutofillInputField>* field = [inputs_ viewWithTag:input.type]; | 721 NSControl<AutofillInputField>* field = [inputs_ viewWithTag:input.type]; |
722 [[field window] makeFirstResponder:field]; | 722 [[field window] makeFirstResponder:field]; |
723 [self textfieldEditedOrActivated:field edited:NO]; | 723 [self textfieldEditedOrActivated:field edited:NO]; |
724 } | 724 } |
725 | 725 |
726 @end | 726 @end |
OLD | NEW |