| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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/search_engines/template_url_service_android.h" | 5 #include "chrome/browser/search_engines/template_url_service_android.h" |
| 6 | 6 |
| 7 #include "base/android/jni_string.h" | 7 #include "base/android/jni_string.h" |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/format_macros.h" | 9 #include "base/format_macros.h" |
| 10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 GURL destination_url(current_url); | 168 GURL destination_url(current_url); |
| 169 if (default_provider && !query.empty()) { | 169 if (default_provider && !query.empty()) { |
| 170 bool refined_query = default_provider->ReplaceSearchTermsInURL(current_url, | 170 bool refined_query = default_provider->ReplaceSearchTermsInURL(current_url, |
| 171 TemplateURLRef::SearchTermsArgs(query), &destination_url); | 171 TemplateURLRef::SearchTermsArgs(query), &destination_url); |
| 172 if (refined_query) | 172 if (refined_query) |
| 173 return ConvertUTF8ToJavaString(env, destination_url.spec()); | 173 return ConvertUTF8ToJavaString(env, destination_url.spec()); |
| 174 } | 174 } |
| 175 return base::android::ScopedJavaLocalRef<jstring>(env, NULL); | 175 return base::android::ScopedJavaLocalRef<jstring>(env, NULL); |
| 176 } | 176 } |
| 177 | 177 |
| 178 static jint Init(JNIEnv* env, jobject obj) { | 178 static jlong Init(JNIEnv* env, jobject obj) { |
| 179 TemplateUrlServiceAndroid* template_url_service_android = | 179 TemplateUrlServiceAndroid* template_url_service_android = |
| 180 new TemplateUrlServiceAndroid(env, obj); | 180 new TemplateUrlServiceAndroid(env, obj); |
| 181 return reinterpret_cast<jint>(template_url_service_android); | 181 return reinterpret_cast<intptr_t>(template_url_service_android); |
| 182 } | 182 } |
| 183 | 183 |
| 184 // static | 184 // static |
| 185 bool TemplateUrlServiceAndroid::Register(JNIEnv* env) { | 185 bool TemplateUrlServiceAndroid::Register(JNIEnv* env) { |
| 186 return RegisterNativesImpl(env); | 186 return RegisterNativesImpl(env); |
| 187 } | 187 } |
| OLD | NEW |