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 567 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
578 [popup addItemWithTitle: | 578 [popup addItemWithTitle: |
579 base::SysUTF16ToNSString(inputModel->GetItemAt(i))]; | 579 base::SysUTF16ToNSString(inputModel->GetItemAt(i))]; |
580 } | 580 } |
581 [popup setDefaultValue:base::SysUTF16ToNSString( | 581 [popup setDefaultValue:base::SysUTF16ToNSString( |
582 inputModel->GetItemAt(inputModel->GetDefaultIndex()))]; | 582 inputModel->GetItemAt(inputModel->GetDefaultIndex()))]; |
583 control.reset(popup.release()); | 583 control.reset(popup.release()); |
584 } else { | 584 } else { |
585 base::scoped_nsobject<AutofillTextField> field( | 585 base::scoped_nsobject<AutofillTextField> field( |
586 [[AutofillTextField alloc] init]); | 586 [[AutofillTextField alloc] init]); |
587 [[field cell] setPlaceholderString: | 587 [[field cell] setPlaceholderString: |
588 l10n_util::GetNSStringWithFixup(input.placeholder_text_rid)]; | 588 base::SysUTF16ToNSString(input.placeholder_text)]; |
589 [field setDefaultValue:@""]; | 589 [field setDefaultValue:@""]; |
590 control.reset(field.release()); | 590 control.reset(field.release()); |
591 } | 591 } |
592 [control setFieldValue:base::SysUTF16ToNSString(input.initial_value)]; | 592 [control setFieldValue:base::SysUTF16ToNSString(input.initial_value)]; |
593 [control sizeToFit]; | 593 [control sizeToFit]; |
594 [control setTag:input.type]; | 594 [control setTag:input.type]; |
595 [control setInputDelegate:self]; | 595 [control setInputDelegate:self]; |
596 // Hide away fields that cannot be edited. | 596 // Hide away fields that cannot be edited. |
597 if (kColumnSetId == -1) { | 597 if (kColumnSetId == -1) { |
598 [control setFrame:NSZeroRect]; | 598 [control setFrame:NSZeroRect]; |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
649 - (void)activateFieldForInput:(const autofill::DetailInput&)input { | 649 - (void)activateFieldForInput:(const autofill::DetailInput&)input { |
650 if ([self detailInputForType:input.type] != &input) | 650 if ([self detailInputForType:input.type] != &input) |
651 return; | 651 return; |
652 | 652 |
653 NSControl<AutofillInputField>* field = [inputs_ viewWithTag:input.type]; | 653 NSControl<AutofillInputField>* field = [inputs_ viewWithTag:input.type]; |
654 [[field window] makeFirstResponder:field]; | 654 [[field window] makeFirstResponder:field]; |
655 [self textfieldEditedOrActivated:field edited:NO]; | 655 [self textfieldEditedOrActivated:field edited:NO]; |
656 } | 656 } |
657 | 657 |
658 @end | 658 @end |
OLD | NEW |