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

Unified Diff: chrome/browser/engagement/site_engagement_service_android.h

Issue 2553013002: Expose the Site Engagement Service to Java. (Closed)
Patch Set: Clean up. Fix desktop compile Created 4 years 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/engagement/site_engagement_service_android.h
diff --git a/chrome/browser/engagement/site_engagement_service_android.h b/chrome/browser/engagement/site_engagement_service_android.h
new file mode 100644
index 0000000000000000000000000000000000000000..c870a4c0d39451f7bdb06d8c97b67e9eb4bf1f5f
--- /dev/null
+++ b/chrome/browser/engagement/site_engagement_service_android.h
@@ -0,0 +1,44 @@
+// Copyright 2016 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_ENGAGEMENT_SITE_ENGAGEMENT_SERVICE_ANDROID_H_
+#define CHROME_BROWSER_ENGAGEMENT_SITE_ENGAGEMENT_SERVICE_ANDROID_H_
+
+#include <jni.h>
+
+#include "base/android/scoped_java_ref.h"
+#include "chrome/browser/engagement/site_engagement_service.h"
+
+// Wrapper class to expose the Site Engagement Service to Java. This class is
+// owned by the |service_| which it wraps, and is lazily created when
gone 2016/12/07 21:50:26 when...? Intrigued minds want to know.
dominickn 2016/12/08 01:03:54 Oops.
+class SiteEngagementServiceAndroid {
+ public:
+ static bool Register(JNIEnv* env);
+
+ static SiteEngagementServiceAndroid* GetOrCreate(
+ JNIEnv* env,
+ const base::android::JavaParamRef<jobject>& obj,
+ SiteEngagementService* service);
+
+ explicit SiteEngagementServiceAndroid(
+ JNIEnv* env,
+ const base::android::JavaParamRef<jobject>& obj,
+ SiteEngagementService* service);
gone 2016/12/07 21:50:26 nit: newline here
dominickn 2016/12/08 01:03:54 Done.
+ ~SiteEngagementServiceAndroid();
+
+ double GetScore(JNIEnv* env,
+ const base::android::JavaParamRef<jobject>& obj,
+ const base::android::JavaParamRef<jstring>& jurl);
+
+ void ResetScoreForURL(JNIEnv* env,
+ const base::android::JavaParamRef<jobject>& obj,
+ const base::android::JavaParamRef<jstring>& jurl,
+ double score);
+
+ private:
+ base::android::ScopedJavaGlobalRef<jobject> obj_;
gone 2016/12/07 21:50:26 Use something more descriptive than obj?
dominickn 2016/12/08 01:03:54 Done.
+ SiteEngagementService* service_;
gone 2016/12/07 21:50:26 DISALLOW_COPY_ETC_ETC?
dominickn 2016/12/08 01:03:54 Derp.
+};
+
+#endif // CHROME_BROWSER_ENGAGEMENT_SITE_ENGAGEMENT_SERVICE_ANDROID_H_

Powered by Google App Engine
This is Rietveld 408576698