Index: chrome/browser/android/ntp_snippets_bridge.h |
diff --git a/chrome/browser/android/ntp_snippets_bridge.h b/chrome/browser/android/ntp_snippets_bridge.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..f8e1e9b01776e42e691af6fe4867ff25fea014b7 |
--- /dev/null |
+++ b/chrome/browser/android/ntp_snippets_bridge.h |
@@ -0,0 +1,46 @@ |
+// 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_ANDROID_NTP_SNIPPETS_BRIDGE_H_ |
+#define CHROME_BROWSER_ANDROID_NTP_SNIPPETS_BRIDGE_H_ |
+ |
+#include <jni.h> |
+ |
+#include "base/android/scoped_java_ref.h" |
+#include "components/ntp_snippets/ntp_snippets_service.h" |
+ |
+namespace ntp_snippets { |
Bernhard Bauer
2016/02/08 18:19:26
Why the namespace? (For things in //chrome, you do
May
2016/02/09 17:38:53
Done.
|
+ |
+class NTPSnippetsService; |
Bernhard Bauer
2016/02/08 18:19:26
This isn't necessary if you include the header fil
May
2016/02/09 17:38:53
Done.
|
+ |
+// The C++ counterpart to NTPSnippetsBridge.java. Enables Java code to access |
+// the list of snippets to show on the NTP |
+class NTPSnippetsBridge : public NTPSnippetsServiceObserver { |
+ public: |
+ explicit NTPSnippetsBridge(jobject j_profile); |
+ void Destroy(JNIEnv* env, const base::android::JavaParamRef<jobject>& obj); |
+ void SetSnippetsObserver( |
+ JNIEnv* env, |
+ const base::android::JavaParamRef<jobject>& obj, |
+ const base::android::JavaParamRef<jobject>& j_observer); |
+ |
+ // NTPSnippetsServiceObserver overrides |
+ void NTPSnippetsServiceLoaded(NTPSnippetsService* service) override; |
+ void NTPSnippetsServiceShutdown(NTPSnippetsService* service) override; |
Marc Treib
2016/02/09 09:17:54
I think these can be private
May
2016/02/09 17:38:53
Done.
|
+ |
+ private: |
+ ~NTPSnippetsBridge(); |
+ |
+ NTPSnippetsService* ntp_snippets_service_; |
+ |
+ base::android::ScopedJavaGlobalRef<jobject> observer_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(NTPSnippetsBridge); |
+}; |
+ |
+bool RegisterNTPSnippetsBridge(JNIEnv* env); |
Bernhard Bauer
2016/02/08 18:19:26
Make this a static class method?
May
2016/02/09 17:38:53
Done.
|
+ |
+} // namespace ntp_snippets |
+ |
+#endif // CHROME_BROWSER_ANDROID_NTP_SNIPPETS_BRIDGE_H_ |