Remove aura enum from DesktopMediaID to fix desktop mirroring audio (CrOS).
[chromium-blink-merge.git] / chrome / browser / search_engines / template_url_service_android.h
blob091ccd9d8fdffc3c31a6620ab48023f1162f4305
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
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_SERVICE_ANDROID_H_
6 #define CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_SERVICE_ANDROID_H_
8 #include "base/android/jni_weak_ref.h"
9 #include "base/android/scoped_java_ref.h"
10 #include "base/memory/scoped_ptr.h"
11 #include "components/search_engines/template_url_service.h"
12 #include "components/search_engines/template_url_service_observer.h"
14 class TemplateURL;
17 // Android wrapper of the TemplateUrlService which provides access from the Java
18 // layer. Note that on Android, there's only a single profile, and therefore
19 // a single instance of this wrapper.
20 class TemplateUrlServiceAndroid : public TemplateURLServiceObserver {
21 public:
22 TemplateUrlServiceAndroid(JNIEnv* env, jobject obj);
24 void Load(JNIEnv* env, jobject obj);
25 void SetUserSelectedDefaultSearchProvider(JNIEnv* env,
26 jobject obj,
27 jint selected_index);
28 jint GetDefaultSearchProvider(JNIEnv* env, jobject obj);
29 jint GetTemplateUrlCount(JNIEnv* env, jobject obj);
30 jboolean IsLoaded(JNIEnv* env, jobject obj);
31 base::android::ScopedJavaLocalRef<jobject>
32 GetPrepopulatedTemplateUrlAt(JNIEnv* env, jobject obj, jint index);
33 jboolean IsSearchProviderManaged(JNIEnv* env, jobject obj);
34 jboolean IsSearchByImageAvailable(JNIEnv* env, jobject obj);
35 jboolean IsDefaultSearchEngineGoogle(JNIEnv* env, jobject obj);
36 base::android::ScopedJavaLocalRef<jstring> GetUrlForSearchQuery(
37 JNIEnv* env,
38 jobject obj,
39 jstring jquery);
40 base::android::ScopedJavaLocalRef<jstring> GetUrlForVoiceSearchQuery(
41 JNIEnv* env,
42 jobject obj,
43 jstring jquery);
44 base::android::ScopedJavaLocalRef<jstring> ReplaceSearchTermsInUrl(
45 JNIEnv* env,
46 jobject obj,
47 jstring jquery,
48 jstring jcurrent_url);
49 base::android::ScopedJavaLocalRef<jstring> GetUrlForContextualSearchQuery(
50 JNIEnv* env,
51 jobject obj,
52 jstring jquery,
53 jstring jalternate_term,
54 jboolean jshould_prefetch);
55 base::android::ScopedJavaLocalRef<jstring> GetSearchEngineUrlFromTemplateUrl(
56 JNIEnv* env,
57 jobject obj,
58 jint index);
60 static bool Register(JNIEnv* env);
62 private:
63 ~TemplateUrlServiceAndroid() override;
65 bool IsPrepopulatedTemplate(TemplateURL* url);
67 void OnTemplateURLServiceLoaded();
69 // TemplateUrlServiceObserver:
70 void OnTemplateURLServiceChanged() override;
72 JavaObjectWeakGlobalRef weak_java_obj_;
74 // Pointer to the TemplateUrlService for the main profile.
75 TemplateURLService* template_url_service_;
77 scoped_ptr<TemplateURLService::Subscription> template_url_subscription_;
79 DISALLOW_COPY_AND_ASSIGN(TemplateUrlServiceAndroid);
82 #endif // CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_SERVICE_ANDROID_H_