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 684 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
695 @end | 695 @end |
696 | 696 |
697 | 697 |
698 @implementation AutofillSectionContainer (ForTesting) | 698 @implementation AutofillSectionContainer (ForTesting) |
699 | 699 |
700 - (NSControl*)getField:(autofill::ServerFieldType)type { | 700 - (NSControl*)getField:(autofill::ServerFieldType)type { |
701 return [inputs_ viewWithTag:type]; | 701 return [inputs_ viewWithTag:type]; |
702 } | 702 } |
703 | 703 |
704 - (void)setFieldValue:(NSString*)text | 704 - (void)setFieldValue:(NSString*)text |
705 forInput:(const autofill::DetailInput&)input { | 705 forType:(autofill::ServerFieldType)type { |
706 if ([self detailInputForType:input.type] != &input) | 706 NSControl<AutofillInputField>* field = [inputs_ viewWithTag:type]; |
707 return; | 707 if (field) |
708 | 708 [field setFieldValue:text]; |
709 NSControl<AutofillInputField>* field = [inputs_ viewWithTag:input.type]; | |
710 [field setFieldValue:text]; | |
711 } | 709 } |
712 | 710 |
713 - (void)setSuggestionFieldValue:(NSString*)text { | 711 - (void)setSuggestionFieldValue:(NSString*)text { |
714 [[suggestContainer_ inputField] setFieldValue:text]; | 712 [[suggestContainer_ inputField] setFieldValue:text]; |
715 } | 713 } |
716 | 714 |
717 - (void)activateFieldForInput:(const autofill::DetailInput&)input { | 715 - (void)activateFieldForType:(autofill::ServerFieldType)type { |
718 if ([self detailInputForType:input.type] != &input) | 716 NSControl<AutofillInputField>* field = [inputs_ viewWithTag:type]; |
719 return; | 717 if (field) { |
720 | 718 [[field window] makeFirstResponder:field]; |
721 NSControl<AutofillInputField>* field = [inputs_ viewWithTag:input.type]; | 719 [self textfieldEditedOrActivated:field edited:NO]; |
722 [[field window] makeFirstResponder:field]; | 720 } |
723 [self textfieldEditedOrActivated:field edited:NO]; | |
724 } | 721 } |
725 | 722 |
726 @end | 723 @end |
OLD | NEW |