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

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

Issue 6621076: [Mac] Remove native/Cocoa preferences. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase switch removal Created 9 years, 9 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
(Empty)
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "base/sys_string_conversions.h"
6 #import "chrome/browser/autofill/autofill_address_model_mac.h"
7 #include "chrome/browser/autofill/autofill_profile.h"
8 #include "grit/generated_resources.h"
9 #include "ui/base/l10n/l10n_util.h"
10
11 @implementation AutoFillAddressModel
12
13 @synthesize fullName = fullName_;
14 @synthesize email = email_;
15 @synthesize companyName = companyName_;
16 @synthesize addressLine1 = addressLine1_;
17 @synthesize addressLine2 = addressLine2_;
18 @synthesize addressCity = addressCity_;
19 @synthesize addressState = addressState_;
20 @synthesize addressZip = addressZip_;
21 @synthesize addressCountry = addressCountry_;
22 @synthesize phoneWholeNumber = phoneWholeNumber_;
23 @synthesize faxWholeNumber = faxWholeNumber_;
24
25 - (id)initWithProfile:(const AutoFillProfile&)profile {
26 if ((self = [super init])) {
27 [self setFullName:SysUTF16ToNSString(
28 profile.GetFieldText(AutofillType(NAME_FULL)))];
29 [self setEmail:SysUTF16ToNSString(
30 profile.GetFieldText(AutofillType(EMAIL_ADDRESS)))];
31 [self setCompanyName:SysUTF16ToNSString(
32 profile.GetFieldText(AutofillType(COMPANY_NAME)))];
33 [self setAddressLine1:SysUTF16ToNSString(
34 profile.GetFieldText(AutofillType(ADDRESS_HOME_LINE1)))];
35 [self setAddressLine2:SysUTF16ToNSString(
36 profile.GetFieldText(AutofillType(ADDRESS_HOME_LINE2)))];
37 [self setAddressCity:SysUTF16ToNSString(
38 profile.GetFieldText(AutofillType(ADDRESS_HOME_CITY)))];
39 [self setAddressState:SysUTF16ToNSString(
40 profile.GetFieldText(AutofillType(ADDRESS_HOME_STATE)))];
41 [self setAddressZip:SysUTF16ToNSString(
42 profile.GetFieldText(AutofillType(ADDRESS_HOME_ZIP)))];
43 [self setAddressCountry:SysUTF16ToNSString(
44 profile.GetFieldText(AutofillType(ADDRESS_HOME_COUNTRY)))];
45 [self setPhoneWholeNumber:SysUTF16ToNSString(
46 profile.GetFieldText(AutofillType(PHONE_HOME_WHOLE_NUMBER)))];
47 [self setFaxWholeNumber:SysUTF16ToNSString(
48 profile.GetFieldText(AutofillType(PHONE_FAX_WHOLE_NUMBER)))];
49 }
50 return self;
51 }
52
53 - (void)dealloc {
54 [fullName_ release];
55 [email_ release];
56 [companyName_ release];
57 [addressLine1_ release];
58 [addressLine2_ release];
59 [addressCity_ release];
60 [addressState_ release];
61 [addressZip_ release];
62 [addressCountry_ release];
63 [phoneWholeNumber_ release];
64 [faxWholeNumber_ release];
65 [super dealloc];
66 }
67
68 - (void)copyModelToProfile:(AutoFillProfile*)profile {
69 DCHECK(profile);
70 profile->SetInfo(AutofillType(NAME_FULL),
71 base::SysNSStringToUTF16([self fullName]));
72 profile->SetInfo(AutofillType(EMAIL_ADDRESS),
73 base::SysNSStringToUTF16([self email]));
74 profile->SetInfo(AutofillType(COMPANY_NAME),
75 base::SysNSStringToUTF16([self companyName]));
76 profile->SetInfo(AutofillType(ADDRESS_HOME_LINE1),
77 base::SysNSStringToUTF16([self addressLine1]));
78 profile->SetInfo(AutofillType(ADDRESS_HOME_LINE2),
79 base::SysNSStringToUTF16([self addressLine2]));
80 profile->SetInfo(AutofillType(ADDRESS_HOME_CITY),
81 base::SysNSStringToUTF16([self addressCity]));
82 profile->SetInfo(AutofillType(ADDRESS_HOME_STATE),
83 base::SysNSStringToUTF16([self addressState]));
84 profile->SetInfo(AutofillType(ADDRESS_HOME_ZIP),
85 base::SysNSStringToUTF16([self addressZip]));
86 profile->SetInfo(AutofillType(ADDRESS_HOME_COUNTRY),
87 base::SysNSStringToUTF16([self addressCountry]));
88 profile->SetInfo(AutofillType(PHONE_HOME_WHOLE_NUMBER),
89 base::SysNSStringToUTF16([self phoneWholeNumber]));
90 profile->SetInfo(AutofillType(PHONE_FAX_WHOLE_NUMBER),
91 base::SysNSStringToUTF16([self faxWholeNumber]));
92 }
93
94 @end
OLDNEW
« no previous file with comments | « chrome/browser/autofill/autofill_address_model_mac.h ('k') | chrome/browser/autofill/autofill_address_model_mac_unittest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698