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

Side by Side Diff: chrome/browser/autofill/android/personal_data_manager_android.cc

Issue 13697002: Make autofill's Address store country using the country code so that app locale isn't needed for th… (Closed) Base URL: svn://chrome-svn/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 #include "chrome/browser/autofill/android/personal_data_manager_android.h" 5 #include "chrome/browser/autofill/android/personal_data_manager_android.h"
6 6
7 #include "base/android/jni_string.h" 7 #include "base/android/jni_string.h"
8 #include "base/format_macros.h" 8 #include "base/format_macros.h"
9 #include "base/stringprintf.h" 9 #include "base/stringprintf.h"
10 #include "base/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 env, 44 env,
45 profile.GetRawInfo(ADDRESS_HOME_CITY)).obj(), 45 profile.GetRawInfo(ADDRESS_HOME_CITY)).obj(),
46 ConvertUTF16ToJavaString( 46 ConvertUTF16ToJavaString(
47 env, 47 env,
48 profile.GetRawInfo(ADDRESS_HOME_STATE)).obj(), 48 profile.GetRawInfo(ADDRESS_HOME_STATE)).obj(),
49 ConvertUTF16ToJavaString( 49 ConvertUTF16ToJavaString(
50 env, 50 env,
51 profile.GetRawInfo(ADDRESS_HOME_ZIP)).obj(), 51 profile.GetRawInfo(ADDRESS_HOME_ZIP)).obj(),
52 ConvertUTF16ToJavaString( 52 ConvertUTF16ToJavaString(
53 env, 53 env,
54 profile.GetRawInfo(ADDRESS_HOME_COUNTRY)).obj(), 54 profile.GetRawInfo(ADDRESS_HOME_COUNTRY)).obj(),
Ilya Sherman 2013/04/05 05:18:01 I think this might need to be updated to be GetInf
jam 2013/04/05 06:45:54 I had traced through the java code to http://devel
55 ConvertUTF16ToJavaString( 55 ConvertUTF16ToJavaString(
56 env, 56 env,
57 profile.GetRawInfo(PHONE_HOME_WHOLE_NUMBER)).obj(), 57 profile.GetRawInfo(PHONE_HOME_WHOLE_NUMBER)).obj(),
58 ConvertUTF16ToJavaString(env, profile.GetRawInfo(EMAIL_ADDRESS)).obj()); 58 ConvertUTF16ToJavaString(env, profile.GetRawInfo(EMAIL_ADDRESS)).obj());
59 } 59 }
60 60
61 void PopulateNativeProfileFromJava( 61 void PopulateNativeProfileFromJava(
62 const jobject& jprofile, 62 const jobject& jprofile,
63 JNIEnv* env, 63 JNIEnv* env,
64 AutofillProfile* profile) { 64 AutofillProfile* profile) {
(...skipping 18 matching lines...) Expand all
83 ConvertJavaStringToUTF16( 83 ConvertJavaStringToUTF16(
84 Java_AutofillProfile_getCity(env, jprofile))); 84 Java_AutofillProfile_getCity(env, jprofile)));
85 profile->SetRawInfo( 85 profile->SetRawInfo(
86 ADDRESS_HOME_STATE, 86 ADDRESS_HOME_STATE,
87 ConvertJavaStringToUTF16( 87 ConvertJavaStringToUTF16(
88 Java_AutofillProfile_getState(env, jprofile))); 88 Java_AutofillProfile_getState(env, jprofile)));
89 profile->SetRawInfo( 89 profile->SetRawInfo(
90 ADDRESS_HOME_ZIP, 90 ADDRESS_HOME_ZIP,
91 ConvertJavaStringToUTF16( 91 ConvertJavaStringToUTF16(
92 Java_AutofillProfile_getZip(env, jprofile))); 92 Java_AutofillProfile_getZip(env, jprofile)));
93 profile->SetRawInfo( 93 string16 country_name_or_code = ConvertJavaStringToUTF16(
94 ADDRESS_HOME_COUNTRY, 94 Java_AutofillProfile_getCountry(env, jprofile))
95 ConvertJavaStringToUTF16( 95 std::string country_code = AutofillCountry::GetCountryCode(
96 Java_AutofillProfile_getCountry(env, jprofile))); 96 country_name_or_code, g_browser_process->GetApplicationLocale());
97 profile->SetRawInfo(ADDRESS_HOME_COUNTRY, ASCIIToUTF16(country_code));
Ilya Sherman 2013/04/05 05:18:01 Please use SetInfo() rather than SetRawInfo() for
jam 2013/04/05 06:45:54 Done.
97 profile->SetRawInfo( 98 profile->SetRawInfo(
98 PHONE_HOME_WHOLE_NUMBER, 99 PHONE_HOME_WHOLE_NUMBER,
99 ConvertJavaStringToUTF16( 100 ConvertJavaStringToUTF16(
100 Java_AutofillProfile_getPhoneNumber(env, jprofile))); 101 Java_AutofillProfile_getPhoneNumber(env, jprofile)));
101 profile->SetRawInfo( 102 profile->SetRawInfo(
102 EMAIL_ADDRESS, 103 EMAIL_ADDRESS,
103 ConvertJavaStringToUTF16( 104 ConvertJavaStringToUTF16(
104 Java_AutofillProfile_getEmailAddress(env, jprofile))); 105 Java_AutofillProfile_getEmailAddress(env, jprofile)));
105 } 106 }
106 107
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
270 // static 271 // static
271 bool PersonalDataManagerAndroid::Register(JNIEnv* env) { 272 bool PersonalDataManagerAndroid::Register(JNIEnv* env) {
272 return RegisterNativesImpl(env); 273 return RegisterNativesImpl(env);
273 } 274 }
274 275
275 static jint Init(JNIEnv* env, jobject obj) { 276 static jint Init(JNIEnv* env, jobject obj) {
276 PersonalDataManagerAndroid* personal_data_manager_android = 277 PersonalDataManagerAndroid* personal_data_manager_android =
277 new PersonalDataManagerAndroid(env, obj); 278 new PersonalDataManagerAndroid(env, obj);
278 return reinterpret_cast<jint>(personal_data_manager_android); 279 return reinterpret_cast<jint>(personal_data_manager_android);
279 } 280 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/autofill/autofill_browsertest.cc » ('j') | chrome/browser/autofill/autofill_browsertest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698