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

Unified 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: comments 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/search_engines/template_url_service_android.h
diff --git a/chrome/browser/search_engines/template_url_service_android.h b/chrome/browser/search_engines/template_url_service_android.h
new file mode 100644
index 0000000000000000000000000000000000000000..0bb7c71556c338700b40668679d313ba3c91f0b5
--- /dev/null
+++ b/chrome/browser/search_engines/template_url_service_android.h
@@ -0,0 +1,51 @@
+// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_SERVICE_ANDROID_H_
+#define CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_SERVICE_ANDROID_H_
+
+#include "base/android/jni_helper.h"
+#include "base/android/scoped_java_ref.h"
+#include "content/public/browser/notification_observer.h"
+#include "content/public/browser/notification_registrar.h"
+
+class TemplateURLService;
+
+
+// Android wrapper of the TemplateUrlService which provides access from the Java
+// layer. Note that on Android, there's only a single profile, and therefore
+// a single instance of this wrapper.
+class TemplateUrlServiceAndroid : public content::NotificationObserver {
+ public:
+ TemplateUrlServiceAndroid(JNIEnv* env, jobject obj);
+
+ void Load(JNIEnv* env, jobject obj);
+
Peter Kasting 2013/02/20 05:31:07 Nit: Why all these blank lines between each functi
Yaron 2013/02/21 21:39:15 Done.
+ void SetSearchEngine(JNIEnv* env, jobject obj, jint selected_index);
+
+ jint GetSearchEngine(JNIEnv* env, jobject obj);
+
+ jboolean IsLoaded(JNIEnv* env, jobject obj);
+
+ base::android::ScopedJavaLocalRef<jobjectArray>
+ GetLocalizedSearchEngines(JNIEnv* env, jobject obj);
Peter Kasting 2013/02/20 05:31:07 Nit: Indent 4
Yaron 2013/02/21 21:39:15 Done.
+
+ // NotificationObserver:
+ virtual void Observe(int type,
+ const content::NotificationSource& source,
+ const content::NotificationDetails& details) OVERRIDE;
+
+ static bool Register(JNIEnv* env);
+
+ private:
+ virtual ~TemplateUrlServiceAndroid();
+ JavaObjectWeakGlobalRef weak_java_obj_;
Peter Kasting 2013/02/20 05:31:07 Nit: Add blank line above here
Yaron 2013/02/21 21:39:15 Done.
+ content::NotificationRegistrar registrar_;
+
+ // Pointer to the TemplateUrlService for the main profile.
+ TemplateURLService* template_url_service_;
+ DISALLOW_COPY_AND_ASSIGN(TemplateUrlServiceAndroid);
Peter Kasting 2013/02/20 05:31:07 Nit: And here
Yaron 2013/02/21 21:39:15 Done.
+};
+
+#endif // CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_SERVICE_ANDROID_H_

Powered by Google App Engine
This is Rietveld 408576698