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

Unified Diff: chrome/browser/android/preferences/autofill/autofill_profile_bridge.cc

Issue 1288183004: jni_generator: Make all object-returning natives return ScopedJavaLocalRef. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add some newlines for readability Created 5 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/android/preferences/autofill/autofill_profile_bridge.cc
diff --git a/chrome/browser/android/preferences/autofill/autofill_profile_bridge.cc b/chrome/browser/android/preferences/autofill/autofill_profile_bridge.cc
index 42903337cb004536fe7b811b3d9c51380e1eeeb0..dcf2a135595f7d4f54be83ed9894a0cdacd17780 100644
--- a/chrome/browser/android/preferences/autofill/autofill_profile_bridge.cc
+++ b/chrome/browser/android/preferences/autofill/autofill_profile_bridge.cc
@@ -46,12 +46,12 @@ enum AddressField {
} // namespace
-static jstring GetDefaultCountryCode(JNIEnv* env,
- jclass clazz) {
+static ScopedJavaLocalRef<jstring> GetDefaultCountryCode(JNIEnv* env,
+ jclass clazz) {
std::string default_country_code =
autofill::AutofillCountry::CountryCodeForLocale(
g_browser_process->GetApplicationLocale());
- return ConvertUTF8ToJavaString(env, default_country_code).Release();
+ return ConvertUTF8ToJavaString(env, default_country_code);
}
static void GetSupportedCountries(JNIEnv* env,
@@ -81,12 +81,13 @@ static void GetSupportedCountries(JNIEnv* env,
j_country_name_list);
}
-static jstring GetAddressUiComponents(JNIEnv* env,
- jclass clazz,
- jstring j_country_code,
- jstring j_language_code,
- jobject j_id_list,
- jobject j_name_list) {
+static ScopedJavaLocalRef<jstring> GetAddressUiComponents(
+ JNIEnv* env,
+ jclass clazz,
+ jstring j_country_code,
+ jstring j_language_code,
+ jobject j_id_list,
+ jobject j_name_list) {
std::string best_language_tag;
std::vector<int> component_ids;
std::vector<std::string> component_labels;
@@ -151,7 +152,7 @@ static jstring GetAddressUiComponents(JNIEnv* env,
env, component_labels).obj(),
j_name_list);
- return ConvertUTF8ToJavaString(env, best_language_tag).Release();
+ return ConvertUTF8ToJavaString(env, best_language_tag);
}
// static

Powered by Google App Engine
This is Rietveld 408576698