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 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
250 JNIEnv* env, | 250 JNIEnv* env, |
251 jobject obj, | 251 jobject obj, |
252 jint index) { | 252 jint index) { |
253 TemplateURL* template_url = template_url_service_->GetTemplateURLs()[index]; | 253 TemplateURL* template_url = template_url_service_->GetTemplateURLs()[index]; |
254 std::string url(template_url->url_ref().ReplaceSearchTerms( | 254 std::string url(template_url->url_ref().ReplaceSearchTerms( |
255 TemplateURLRef::SearchTermsArgs( | 255 TemplateURLRef::SearchTermsArgs( |
256 base::ASCIIToUTF16("query")), SearchTermsData(), nullptr)); | 256 base::ASCIIToUTF16("query")), SearchTermsData(), nullptr)); |
257 return base::android::ConvertUTF8ToJavaString(env, url); | 257 return base::android::ConvertUTF8ToJavaString(env, url); |
258 } | 258 } |
259 | 259 |
260 static jlong Init(JNIEnv* env, jobject obj) { | 260 static jlong Init(JNIEnv* env, const JavaParamRef<jobject>& obj) { |
261 TemplateUrlServiceAndroid* template_url_service_android = | 261 TemplateUrlServiceAndroid* template_url_service_android = |
262 new TemplateUrlServiceAndroid(env, obj); | 262 new TemplateUrlServiceAndroid(env, obj); |
263 return reinterpret_cast<intptr_t>(template_url_service_android); | 263 return reinterpret_cast<intptr_t>(template_url_service_android); |
264 } | 264 } |
265 | 265 |
266 // static | 266 // static |
267 bool TemplateUrlServiceAndroid::Register(JNIEnv* env) { | 267 bool TemplateUrlServiceAndroid::Register(JNIEnv* env) { |
268 return RegisterNativesImpl(env); | 268 return RegisterNativesImpl(env); |
269 } | 269 } |
OLD | NEW |