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

Side by Side Diff: components/autofill/browser/android/auxiliary_profiles_android.cc

Issue 13973004: Convert string16 -> base::string16 in components/ (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 8 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 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 // Populates default autofill profile from user's own Android contact. 5 // Populates default autofill profile from user's own Android contact.
6 #include "components/autofill/browser/android/auxiliary_profiles_android.h" 6 #include "components/autofill/browser/android/auxiliary_profiles_android.h"
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/guid.h" 10 #include "base/guid.h"
(...skipping 15 matching lines...) Expand all
26 // any existing addresses. 26 // any existing addresses.
27 27
28 // Randomly generated guid. The Autofillprofile class requires a consistent 28 // Randomly generated guid. The Autofillprofile class requires a consistent
29 // unique guid or else things break. 29 // unique guid or else things break.
30 const char kAndroidMeContactA[] = "9A9E1C06-7A3B-48FA-AA4F-135CA6FC25D9"; 30 const char kAndroidMeContactA[] = "9A9E1C06-7A3B-48FA-AA4F-135CA6FC25D9";
31 31
32 namespace { 32 namespace {
33 33
34 // Takes misc. address information strings from Android API and collapses 34 // Takes misc. address information strings from Android API and collapses
35 // into single string for "address line 2" 35 // into single string for "address line 2"
36 string16 CollapseAddress(const string16& post_office_box, 36 base::string16 CollapseAddress(const base::string16& post_office_box,
37 const string16& neighborhood) { 37 const base::string16& neighborhood) {
38 std::vector<string16> accumulator; 38 std::vector<base::string16> accumulator;
39 if (!post_office_box.empty()) 39 if (!post_office_box.empty())
40 accumulator.push_back(post_office_box); 40 accumulator.push_back(post_office_box);
41 if (!neighborhood.empty()) 41 if (!neighborhood.empty())
42 accumulator.push_back(neighborhood); 42 accumulator.push_back(neighborhood);
43 43
44 return JoinString(accumulator, ASCIIToUTF16(", ")); 44 return JoinString(accumulator, ASCIIToUTF16(", "));
45 } 45 }
46 46
47 } // namespace 47 } // namespace
48 48
(...skipping 18 matching lines...) Expand all
67 // into constituent parts. Instead we just get a long string blob. 67 // into constituent parts. Instead we just get a long string blob.
68 // Disable address population until we implement a way to parse the 68 // Disable address population until we implement a way to parse the
69 // data. 69 // data.
70 // http://crbug.com/178838 70 // http://crbug.com/178838
71 // LoadAddress(profile.get()); 71 // LoadAddress(profile.get());
72 72
73 return profile.Pass(); 73 return profile.Pass();
74 } 74 }
75 75
76 void AuxiliaryProfilesAndroid::LoadAddress(AutofillProfile* profile) { 76 void AuxiliaryProfilesAndroid::LoadAddress(AutofillProfile* profile) {
77 string16 street = profile_loader_.GetStreet(); 77 base::string16 street = profile_loader_.GetStreet();
78 string16 post_office_box = profile_loader_.GetPostOfficeBox(); 78 base::string16 post_office_box = profile_loader_.GetPostOfficeBox();
79 string16 neighborhood = profile_loader_.GetNeighborhood(); 79 base::string16 neighborhood = profile_loader_.GetNeighborhood();
80 string16 city = profile_loader_.GetCity(); 80 base::string16 city = profile_loader_.GetCity();
81 string16 postal_code = profile_loader_.GetPostalCode(); 81 base::string16 postal_code = profile_loader_.GetPostalCode();
82 string16 region = profile_loader_.GetRegion(); 82 base::string16 region = profile_loader_.GetRegion();
83 string16 country = profile_loader_.GetCountry(); 83 base::string16 country = profile_loader_.GetCountry();
84 84
85 string16 street2 = CollapseAddress(post_office_box, neighborhood); 85 base::string16 street2 = CollapseAddress(post_office_box, neighborhood);
86 86
87 profile->SetRawInfo(ADDRESS_HOME_LINE1, street); 87 profile->SetRawInfo(ADDRESS_HOME_LINE1, street);
88 profile->SetRawInfo(ADDRESS_HOME_LINE2, street2); 88 profile->SetRawInfo(ADDRESS_HOME_LINE2, street2);
89 profile->SetRawInfo(ADDRESS_HOME_CITY, city); 89 profile->SetRawInfo(ADDRESS_HOME_CITY, city);
90 profile->SetRawInfo(ADDRESS_HOME_STATE, region); 90 profile->SetRawInfo(ADDRESS_HOME_STATE, region);
91 profile->SetRawInfo(ADDRESS_HOME_ZIP, postal_code); 91 profile->SetRawInfo(ADDRESS_HOME_ZIP, postal_code);
92 profile->SetInfo(ADDRESS_HOME_COUNTRY, country, app_locale_); 92 profile->SetInfo(ADDRESS_HOME_COUNTRY, country, app_locale_);
93 } 93 }
94 94
95 void AuxiliaryProfilesAndroid::LoadName(AutofillProfile* profile) { 95 void AuxiliaryProfilesAndroid::LoadName(AutofillProfile* profile) {
96 string16 first_name = profile_loader_.GetFirstName(); 96 base::string16 first_name = profile_loader_.GetFirstName();
97 string16 middle_name = profile_loader_.GetMiddleName(); 97 base::string16 middle_name = profile_loader_.GetMiddleName();
98 string16 last_name = profile_loader_.GetLastName(); 98 base::string16 last_name = profile_loader_.GetLastName();
99 99
100 profile->SetRawInfo(NAME_FIRST, first_name); 100 profile->SetRawInfo(NAME_FIRST, first_name);
101 profile->SetRawInfo(NAME_MIDDLE, middle_name); 101 profile->SetRawInfo(NAME_MIDDLE, middle_name);
102 profile->SetRawInfo(NAME_LAST, last_name); 102 profile->SetRawInfo(NAME_LAST, last_name);
103 } 103 }
104 104
105 void AuxiliaryProfilesAndroid::LoadEmailAddress(AutofillProfile* profile) { 105 void AuxiliaryProfilesAndroid::LoadEmailAddress(AutofillProfile* profile) {
106 std::vector<string16> emails; 106 std::vector<base::string16> emails;
107 profile_loader_.GetEmailAddresses(&emails); 107 profile_loader_.GetEmailAddresses(&emails);
108 profile->SetRawMultiInfo(EMAIL_ADDRESS, emails); 108 profile->SetRawMultiInfo(EMAIL_ADDRESS, emails);
109 } 109 }
110 110
111 void AuxiliaryProfilesAndroid::LoadPhoneNumbers(AutofillProfile* profile) { 111 void AuxiliaryProfilesAndroid::LoadPhoneNumbers(AutofillProfile* profile) {
112 std::vector<string16> phone_numbers; 112 std::vector<base::string16> phone_numbers;
113 profile_loader_.GetPhoneNumbers(&phone_numbers); 113 profile_loader_.GetPhoneNumbers(&phone_numbers);
114 profile->SetRawMultiInfo(PHONE_HOME_WHOLE_NUMBER, phone_numbers); 114 profile->SetRawMultiInfo(PHONE_HOME_WHOLE_NUMBER, phone_numbers);
115 } 115 }
116 116
117 } // namespace autofill 117 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698