| 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 "content/public/browser/notification_observer.h" | 10 #include "content/public/browser/notification_observer.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 void Load(JNIEnv* env, jobject obj); | 24 void Load(JNIEnv* env, jobject obj); |
| 25 void SetDefaultSearchProvider(JNIEnv* env, jobject obj, jint selected_index); | 25 void SetDefaultSearchProvider(JNIEnv* env, jobject obj, jint selected_index); |
| 26 jint GetDefaultSearchProvider(JNIEnv* env, jobject obj); | 26 jint GetDefaultSearchProvider(JNIEnv* env, jobject obj); |
| 27 jint GetTemplateUrlCount(JNIEnv* env, jobject obj); | 27 jint GetTemplateUrlCount(JNIEnv* env, jobject obj); |
| 28 jboolean IsLoaded(JNIEnv* env, jobject obj); | 28 jboolean IsLoaded(JNIEnv* env, jobject obj); |
| 29 base::android::ScopedJavaLocalRef<jobject> | 29 base::android::ScopedJavaLocalRef<jobject> |
| 30 GetPrepopulatedTemplateUrlAt(JNIEnv* env, jobject obj, jint index); | 30 GetPrepopulatedTemplateUrlAt(JNIEnv* env, jobject obj, jint index); |
| 31 jboolean IsSearchProviderManaged(JNIEnv* env, jobject obj); | 31 jboolean IsSearchProviderManaged(JNIEnv* env, jobject obj); |
| 32 jboolean IsSearchByImageAvailable(JNIEnv* env, jobject obj); | 32 jboolean IsSearchByImageAvailable(JNIEnv* env, jobject obj); |
| 33 jboolean IsDefaultSearchEngineGoogle(JNIEnv* env, jobject obj); | 33 jboolean IsDefaultSearchEngineGoogle(JNIEnv* env, jobject obj); |
| 34 base::android::ScopedJavaLocalRef<jstring> GetUrlForSearchQuery( |
| 35 JNIEnv* env, |
| 36 jobject obj, |
| 37 jstring jquery); |
| 38 base::android::ScopedJavaLocalRef<jstring> ReplaceSearchTermsInUrl( |
| 39 JNIEnv* env, |
| 40 jobject obj, |
| 41 jstring jquery, |
| 42 jstring jcurrent_url); |
| 34 | 43 |
| 35 // NotificationObserver: | 44 // NotificationObserver: |
| 36 virtual void Observe(int type, | 45 virtual void Observe(int type, |
| 37 const content::NotificationSource& source, | 46 const content::NotificationSource& source, |
| 38 const content::NotificationDetails& details) OVERRIDE; | 47 const content::NotificationDetails& details) OVERRIDE; |
| 39 | 48 |
| 40 static bool Register(JNIEnv* env); | 49 static bool Register(JNIEnv* env); |
| 41 | 50 |
| 42 private: | 51 private: |
| 43 virtual ~TemplateUrlServiceAndroid(); | 52 virtual ~TemplateUrlServiceAndroid(); |
| 44 | 53 |
| 45 bool IsPrepopulatedTemplate(TemplateURL* url); | 54 bool IsPrepopulatedTemplate(TemplateURL* url); |
| 46 | 55 |
| 47 JavaObjectWeakGlobalRef weak_java_obj_; | 56 JavaObjectWeakGlobalRef weak_java_obj_; |
| 48 content::NotificationRegistrar registrar_; | 57 content::NotificationRegistrar registrar_; |
| 49 | 58 |
| 50 // Pointer to the TemplateUrlService for the main profile. | 59 // Pointer to the TemplateUrlService for the main profile. |
| 51 TemplateURLService* template_url_service_; | 60 TemplateURLService* template_url_service_; |
| 52 | 61 |
| 53 DISALLOW_COPY_AND_ASSIGN(TemplateUrlServiceAndroid); | 62 DISALLOW_COPY_AND_ASSIGN(TemplateUrlServiceAndroid); |
| 54 }; | 63 }; |
| 55 | 64 |
| 56 #endif // CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_SERVICE_ANDROID_H_ | 65 #endif // CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_SERVICE_ANDROID_H_ |
| OLD | NEW |