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

Unified Diff: chrome/browser/android/omnibox/autocomplete_controller_android.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/omnibox/autocomplete_controller_android.cc
diff --git a/chrome/browser/android/omnibox/autocomplete_controller_android.cc b/chrome/browser/android/omnibox/autocomplete_controller_android.cc
index 60b66837652aeb62650594a5c265733f1cec8562..3c82c97160592adf50367185411b5ade3370cec0 100644
--- a/chrome/browser/android/omnibox/autocomplete_controller_android.cc
+++ b/chrome/browser/android/omnibox/autocomplete_controller_android.cc
@@ -521,11 +521,12 @@ static jlong Init(JNIEnv* env, jobject obj, jobject jprofile) {
return reinterpret_cast<intptr_t>(native_bridge);
}
-static jstring QualifyPartialURLQuery(
- JNIEnv* env, jclass clazz, jstring jquery) {
+static ScopedJavaLocalRef<jstring> QualifyPartialURLQuery(JNIEnv* env,
+ jclass clazz,
+ jstring jquery) {
Profile* profile = ProfileManager::GetActiveUserProfile();
if (!profile)
- return NULL;
+ return ScopedJavaLocalRef<jstring>();
AutocompleteMatch match;
base::string16 query_string(ConvertJavaStringToUTF16(env, jquery));
AutocompleteClassifierFactory::GetForProfile(profile)->Classify(
@@ -536,16 +537,16 @@ static jstring QualifyPartialURLQuery(
&match,
NULL);
if (!match.destination_url.is_valid())
- return NULL;
+ return ScopedJavaLocalRef<jstring>();
// Only return a URL if the match is a URL type.
if (match.type != AutocompleteMatchType::URL_WHAT_YOU_TYPED &&
match.type != AutocompleteMatchType::HISTORY_URL &&
match.type != AutocompleteMatchType::NAVSUGGEST)
- return NULL;
+ return ScopedJavaLocalRef<jstring>();
// As we are returning to Java, it is fine to call Release().
- return ConvertUTF8ToJavaString(env, match.destination_url.spec()).Release();
+ return ConvertUTF8ToJavaString(env, match.destination_url.spec());
}
static void PrefetchZeroSuggestResults(JNIEnv* env, jclass clazz) {

Powered by Google App Engine
This is Rietveld 408576698