Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(104)

Side by Side Diff: chrome/browser/search_engines/template_url_service_android.h

Issue 12255042: [Android] Introduce a Java wrapper for TemplateUrlService. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: bulach again Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
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.
4
5 #ifndef CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_SERVICE_ANDROID_H_
6 #define CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_SERVICE_ANDROID_H_
7
8 #include "base/android/jni_helper.h"
9 #include "base/android/scoped_java_ref.h"
10 #include "content/public/browser/notification_observer.h"
11 #include "content/public/browser/notification_registrar.h"
12
13 class TemplateURL;
14 class TemplateURLService;
15
16
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 content::NotificationObserver {
21 public:
22 TemplateUrlServiceAndroid(JNIEnv* env, jobject obj);
23
24 void Load(JNIEnv* env, jobject obj);
25 void SetDefaultSearchProvider(JNIEnv* env, jobject obj, jint selected_index);
26 jint GetDefaultSearchProvider(JNIEnv* env, jobject obj);
27 jint GetTemplateUrlCount(JNIEnv* env, jobject obj);
28 jboolean IsLoaded(JNIEnv* env, jobject obj);
29 base::android::ScopedJavaLocalRef<jobject>
30 GetPrepopulatedTemplateUrlAt(JNIEnv* env, jobject obj, jint index);
31
32 // NotificationObserver:
33 virtual void Observe(int type,
34 const content::NotificationSource& source,
35 const content::NotificationDetails& details) OVERRIDE;
36
37 static bool Register(JNIEnv* env);
38
39 private:
40 virtual ~TemplateUrlServiceAndroid();
41
42 bool IsPrepopulatedTemplate(TemplateURL* url);
43
44 JavaObjectWeakGlobalRef weak_java_obj_;
45 content::NotificationRegistrar registrar_;
46
47 // Pointer to the TemplateUrlService for the main profile.
48 TemplateURLService* template_url_service_;
49
50 DISALLOW_COPY_AND_ASSIGN(TemplateUrlServiceAndroid);
51 };
52
53 #endif // CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_SERVICE_ANDROID_H_
OLDNEW
« no previous file with comments | « chrome/browser/android/chrome_jni_registrar.cc ('k') | chrome/browser/search_engines/template_url_service_android.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698