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

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: no more map 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 TemplateURLService;
14
15
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
18 // a single instance of this wrapper.
19 class TemplateUrlServiceAndroid : public content::NotificationObserver {
20 public:
21 TemplateUrlServiceAndroid(JNIEnv* env, jobject obj);
22
23 void Load(JNIEnv* env, jobject obj);
24 void SetDefaultSearchProvider(JNIEnv* env, jobject obj, jint selected_index);
25 jint GetDefaultSearchProvider(JNIEnv* env, jobject obj);
26 jint GetPrepopulatedTemplateUrlCount(JNIEnv* env, jobject obj);
27 jboolean IsLoaded(JNIEnv* env, jobject obj);
28 base::android::ScopedJavaLocalRef<jobject>
29 GetPrepopulatedTemplateUrlAt(JNIEnv* env, jobject obj, jint index);
30
31 // NotificationObserver:
32 virtual void Observe(int type,
33 const content::NotificationSource& source,
34 const content::NotificationDetails& details) OVERRIDE;
35
36 static bool Register(JNIEnv* env);
37
38 private:
39 virtual ~TemplateUrlServiceAndroid();
40
41 JavaObjectWeakGlobalRef weak_java_obj_;
42 content::NotificationRegistrar registrar_;
43
44 // Pointer to the TemplateUrlService for the main profile.
45 TemplateURLService* template_url_service_;
46
47 DISALLOW_COPY_AND_ASSIGN(TemplateUrlServiceAndroid);
48 };
49
50 #endif // CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_SERVICE_ANDROID_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698