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

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

Issue 2762014: Mac: clang build (Closed)
Patch Set: more 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
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)object { 31 - (void)setObjectValue:(id<NSCopying>)object {
32 if (isCreditCardField_ && [object isKindOfClass:[NSString class]]) { 32 // FIXME
33 if (isCreditCardField_ &&
34 [(NSObject*)object isKindOfClass:[NSString class]]) {
33 // Obfuscate the number. 35 // Obfuscate the number.
34 NSString* string = object; 36 NSString* string = object;
35 CreditCard card; 37 CreditCard card;
36 card.SetInfo(AutoFillType(CREDIT_CARD_NUMBER), 38 card.SetInfo(AutoFillType(CREDIT_CARD_NUMBER),
37 base::SysNSStringToUTF16(string)); 39 base::SysNSStringToUTF16(string));
38 NSString* starredString = base::SysUTF16ToNSString(card.ObfuscatedNumber()); 40 NSString* starredString = base::SysUTF16ToNSString(card.ObfuscatedNumber());
39 41
40 [super setObjectValue:starredString]; 42 [super setObjectValue:starredString];
41 isObfuscated_ = YES; 43 isObfuscated_ = YES;
42 obfuscatedValue_.reset([string copy]); 44 obfuscatedValue_.reset([string copy]);
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 - (BOOL)textShouldBeginEditing:(NSText*)textObject { 76 - (BOOL)textShouldBeginEditing:(NSText*)textObject {
75 BOOL should = [super textShouldBeginEditing:textObject]; 77 BOOL should = [super textShouldBeginEditing:textObject];
76 // On editing, since everything is selected, the field is now clear. 78 // On editing, since everything is selected, the field is now clear.
77 isObfuscated_ = !should; 79 isObfuscated_ = !should;
78 if (!isObfuscated_) 80 if (!isObfuscated_)
79 obfuscatedValue_.reset(); 81 obfuscatedValue_.reset();
80 return should; 82 return should;
81 } 83 }
82 84
83 @end 85 @end
OLDNEW
« no previous file with comments | « chrome/browser/autocomplete/autocomplete_popup_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