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

Side by Side Diff: chrome/browser/autofill/autofill_text_field_mac.mm

Issue 2835007: Revert 49984 - patch from issue 2762014 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 10 years, 6 months 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/autofill/autofill_text_field_mac.h" 5 #import "chrome/browser/autofill/autofill_text_field_mac.h"
6 6
7 #include "base/sys_string_conversions.h" 7 #include "base/sys_string_conversions.h"
8 #include "chrome/browser/autofill/credit_card.h" 8 #include "chrome/browser/autofill/credit_card.h"
9 9
10 @implementation AutoFillTextField 10 @implementation AutoFillTextField
(...skipping 10 matching lines...) Expand all
21 // Vertical inset is negative to indicate "outset". Provides some visual 21 // Vertical inset is negative to indicate "outset". Provides some visual
22 // space above and below when tabbing between fields. 22 // space above and below when tabbing between fields.
23 const CGFloat kVerticalInset = -40.0; 23 const CGFloat kVerticalInset = -40.0;
24 BOOL becoming = [super becomeFirstResponder]; 24 BOOL becoming = [super becomeFirstResponder];
25 if (becoming) { 25 if (becoming) {
26 [self scrollRectToVisible:NSInsetRect([self bounds], 0.0, kVerticalInset)]; 26 [self scrollRectToVisible:NSInsetRect([self bounds], 0.0, kVerticalInset)];
27 } 27 }
28 return becoming; 28 return becoming;
29 } 29 }
30 30
31 - (void)setObjectValue:(id<NSCopying>)object { 31 - (void)setObjectValue:(id)object {
32 // FIXME 32 if (isCreditCardField_ && [object isKindOfClass:[NSString class]]) {
33 if (isCreditCardField_ &&
34 [(NSObject*)object isKindOfClass:[NSString class]]) {
35 // Obfuscate the number. 33 // Obfuscate the number.
36 NSString* string = (NSString*)object; // FIXME: NSMutableCopying 34 NSString* string = object;
37 CreditCard card; 35 CreditCard card;
38 card.SetInfo(AutoFillType(CREDIT_CARD_NUMBER), 36 card.SetInfo(AutoFillType(CREDIT_CARD_NUMBER),
39 base::SysNSStringToUTF16(string)); 37 base::SysNSStringToUTF16(string));
40 NSString* starredString = base::SysUTF16ToNSString(card.ObfuscatedNumber()); 38 NSString* starredString = base::SysUTF16ToNSString(card.ObfuscatedNumber());
41 39
42 [super setObjectValue:starredString]; 40 [super setObjectValue:starredString];
43 isObfuscated_ = YES; 41 isObfuscated_ = YES;
44 obfuscatedValue_.reset([string copy]); 42 obfuscatedValue_.reset([string copy]);
45 } else { 43 } else {
46 [super setObjectValue:object]; 44 [super setObjectValue:object];
(...skipping 29 matching lines...) Expand all
76 - (BOOL)textShouldBeginEditing:(NSText*)textObject { 74 - (BOOL)textShouldBeginEditing:(NSText*)textObject {
77 BOOL should = [super textShouldBeginEditing:textObject]; 75 BOOL should = [super textShouldBeginEditing:textObject];
78 // On editing, since everything is selected, the field is now clear. 76 // On editing, since everything is selected, the field is now clear.
79 isObfuscated_ = !should; 77 isObfuscated_ = !should;
80 if (!isObfuscated_) 78 if (!isObfuscated_)
81 obfuscatedValue_.reset(); 79 obfuscatedValue_.reset();
82 return should; 80 return should;
83 } 81 }
84 82
85 @end 83 @end
OLDNEW
« no previous file with comments | « chrome/browser/autocomplete/autocomplete_edit_view_mac.mm ('k') | chrome/browser/chrome_browser_application_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698