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 603 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
614 [popup addItemWithTitle: | 614 [popup addItemWithTitle: |
615 base::SysUTF16ToNSString(inputModel->GetItemAt(i))]; | 615 base::SysUTF16ToNSString(inputModel->GetItemAt(i))]; |
616 } | 616 } |
617 [popup setDefaultValue:base::SysUTF16ToNSString( | 617 [popup setDefaultValue:base::SysUTF16ToNSString( |
618 inputModel->GetItemAt(inputModel->GetDefaultIndex()))]; | 618 inputModel->GetItemAt(inputModel->GetDefaultIndex()))]; |
619 control.reset(popup.release()); | 619 control.reset(popup.release()); |
620 } else { | 620 } else { |
621 base::scoped_nsobject<AutofillTextField> field( | 621 base::scoped_nsobject<AutofillTextField> field( |
622 [[AutofillTextField alloc] init]); | 622 [[AutofillTextField alloc] init]); |
623 [[field cell] setPlaceholderString: | 623 [[field cell] setPlaceholderString: |
624 l10n_util::GetNSStringWithFixup(input.placeholder_text_rid)]; | 624 l10n_util::FixUpWindowsStyleLabel(input.placeholder_text)]; |
625 NSString* tooltipText = | 625 NSString* tooltipText = |
626 base::SysUTF16ToNSString(delegate_->TooltipForField(input.type)); | 626 base::SysUTF16ToNSString(delegate_->TooltipForField(input.type)); |
627 if ([tooltipText length] > 0) { | 627 if ([tooltipText length] > 0) { |
628 DCHECK(!tooltipController_); | 628 DCHECK(!tooltipController_); |
629 DCHECK(!tooltipField_); | 629 DCHECK(!tooltipField_); |
630 tooltipController_.reset( | 630 tooltipController_.reset( |
631 [[AutofillTooltipController alloc] | 631 [[AutofillTooltipController alloc] |
632 initWithArrowLocation:info_bubble::kTopRight]); | 632 initWithArrowLocation:info_bubble::kTopRight]); |
633 tooltipField_ = field.get(); | 633 tooltipField_ = field.get(); |
634 NSImage* icon = | 634 NSImage* icon = |
(...skipping 10 matching lines...) Expand all Loading... |
645 [control sizeToFit]; | 645 [control sizeToFit]; |
646 [control setTag:input.type]; | 646 [control setTag:input.type]; |
647 [control setInputDelegate:self]; | 647 [control setInputDelegate:self]; |
648 // Hide away fields that cannot be edited. | 648 // Hide away fields that cannot be edited. |
649 if (kColumnSetId == -1) { | 649 if (kColumnSetId == -1) { |
650 [control setFrame:NSZeroRect]; | 650 [control setFrame:NSZeroRect]; |
651 [control setHidden:YES]; | 651 [control setHidden:YES]; |
652 } | 652 } |
653 layout->AddView(control); | 653 layout->AddView(control); |
654 | 654 |
655 if (input.length == autofill::DetailInput::LONG) | 655 if (input.length == autofill::DetailInput::LONG || |
| 656 input.length == autofill::DetailInput::SHORT_EOL) { |
656 ++column_set_id; | 657 ++column_set_id; |
| 658 } |
657 } | 659 } |
658 | 660 |
659 [self updateFieldIcons]; | 661 [self updateFieldIcons]; |
660 return view.autorelease(); | 662 return view.autorelease(); |
661 } | 663 } |
662 | 664 |
663 - (void)updateFieldIcons { | 665 - (void)updateFieldIcons { |
664 autofill::FieldValueMap fieldValues; | 666 autofill::FieldValueMap fieldValues; |
665 for (NSControl<AutofillInputField>* input in [inputs_ subviews]) { | 667 for (NSControl<AutofillInputField>* input in [inputs_ subviews]) { |
666 DCHECK([input isKindOfClass:[NSControl class]]); | 668 DCHECK([input isKindOfClass:[NSControl class]]); |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
715 - (void)activateFieldForInput:(const autofill::DetailInput&)input { | 717 - (void)activateFieldForInput:(const autofill::DetailInput&)input { |
716 if ([self detailInputForType:input.type] != &input) | 718 if ([self detailInputForType:input.type] != &input) |
717 return; | 719 return; |
718 | 720 |
719 NSControl<AutofillInputField>* field = [inputs_ viewWithTag:input.type]; | 721 NSControl<AutofillInputField>* field = [inputs_ viewWithTag:input.type]; |
720 [[field window] makeFirstResponder:field]; | 722 [[field window] makeFirstResponder:field]; |
721 [self textfieldEditedOrActivated:field edited:NO]; | 723 [self textfieldEditedOrActivated:field edited:NO]; |
722 } | 724 } |
723 | 725 |
724 @end | 726 @end |
OLD | NEW |