| 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 #ifndef CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_SERVICE_ANDROID_H_ | 5 #ifndef CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_SERVICE_ANDROID_H_ |
| 6 #define CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_SERVICE_ANDROID_H_ | 6 #define CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_SERVICE_ANDROID_H_ |
| 7 | 7 |
| 8 #include "base/android/jni_helper.h" | 8 #include "base/android/jni_helper.h" |
| 9 #include "base/android/scoped_java_ref.h" | 9 #include "base/android/scoped_java_ref.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| 11 #include "chrome/browser/search_engines/template_url_service.h" | 11 #include "chrome/browser/search_engines/template_url_service.h" |
| 12 | 12 |
| 13 class TemplateURL; | 13 class TemplateURL; |
| 14 | 14 |
| 15 | 15 |
| 16 // Android wrapper of the TemplateUrlService which provides access from the Java | 16 // Android wrapper of the TemplateUrlService which provides access from the Java |
| 17 // layer. Note that on Android, there's only a single profile, and therefore | 17 // layer. Note that on Android, there's only a single profile, and therefore |
| 18 // a single instance of this wrapper. | 18 // a single instance of this wrapper. |
| 19 class TemplateUrlServiceAndroid { | 19 class TemplateUrlServiceAndroid { |
| 20 public: | 20 public: |
| 21 TemplateUrlServiceAndroid(JNIEnv* env, jobject obj); | 21 TemplateUrlServiceAndroid(JNIEnv* env, jobject obj); |
| 22 | 22 |
| 23 void Load(JNIEnv* env, jobject obj); | 23 void Load(JNIEnv* env, jobject obj); |
| 24 void SetDefaultSearchProvider(JNIEnv* env, jobject obj, jint selected_index); | 24 void SetUserSelectedDefaultSearchProvider(JNIEnv* env, |
| 25 jobject obj, |
| 26 jint selected_index); |
| 25 jint GetDefaultSearchProvider(JNIEnv* env, jobject obj); | 27 jint GetDefaultSearchProvider(JNIEnv* env, jobject obj); |
| 26 jint GetTemplateUrlCount(JNIEnv* env, jobject obj); | 28 jint GetTemplateUrlCount(JNIEnv* env, jobject obj); |
| 27 jboolean IsLoaded(JNIEnv* env, jobject obj); | 29 jboolean IsLoaded(JNIEnv* env, jobject obj); |
| 28 base::android::ScopedJavaLocalRef<jobject> | 30 base::android::ScopedJavaLocalRef<jobject> |
| 29 GetPrepopulatedTemplateUrlAt(JNIEnv* env, jobject obj, jint index); | 31 GetPrepopulatedTemplateUrlAt(JNIEnv* env, jobject obj, jint index); |
| 30 jboolean IsSearchProviderManaged(JNIEnv* env, jobject obj); | 32 jboolean IsSearchProviderManaged(JNIEnv* env, jobject obj); |
| 31 jboolean IsSearchByImageAvailable(JNIEnv* env, jobject obj); | 33 jboolean IsSearchByImageAvailable(JNIEnv* env, jobject obj); |
| 32 jboolean IsDefaultSearchEngineGoogle(JNIEnv* env, jobject obj); | 34 jboolean IsDefaultSearchEngineGoogle(JNIEnv* env, jobject obj); |
| 33 base::android::ScopedJavaLocalRef<jstring> GetUrlForSearchQuery( | 35 base::android::ScopedJavaLocalRef<jstring> GetUrlForSearchQuery( |
| 34 JNIEnv* env, | 36 JNIEnv* env, |
| (...skipping 22 matching lines...) Expand all Loading... |
| 57 | 59 |
| 58 // Pointer to the TemplateUrlService for the main profile. | 60 // Pointer to the TemplateUrlService for the main profile. |
| 59 TemplateURLService* template_url_service_; | 61 TemplateURLService* template_url_service_; |
| 60 | 62 |
| 61 scoped_ptr<TemplateURLService::Subscription> template_url_subscription_; | 63 scoped_ptr<TemplateURLService::Subscription> template_url_subscription_; |
| 62 | 64 |
| 63 DISALLOW_COPY_AND_ASSIGN(TemplateUrlServiceAndroid); | 65 DISALLOW_COPY_AND_ASSIGN(TemplateUrlServiceAndroid); |
| 64 }; | 66 }; |
| 65 | 67 |
| 66 #endif // CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_SERVICE_ANDROID_H_ | 68 #endif // CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_SERVICE_ANDROID_H_ |
| OLD | NEW |