Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2016 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_ANDROID_NTP_SNIPPETS_BRIDGE_H_ | |
| 6 #define CHROME_BROWSER_ANDROID_NTP_SNIPPETS_BRIDGE_H_ | |
| 7 | |
| 8 #include <jni.h> | |
| 9 | |
| 10 #include "base/android/scoped_java_ref.h" | |
| 11 #include "base/scoped_observer.h" | |
| 12 #include "components/ntp_snippets/ntp_snippets_service.h" | |
| 13 | |
| 14 using ntp_snippets::NTPSnippetsService; | |
|
Marc Treib
2016/02/10 10:44:43
No "using" in headers
May
2016/02/10 18:16:46
Done.
| |
| 15 using ntp_snippets::NTPSnippetsServiceObserver; | |
| 16 | |
| 17 // The C++ counterpart to NTPSnippetsBridge.java. Enables Java code to access | |
| 18 // the list of snippets to show on the NTP | |
| 19 class NTPSnippetsBridge : public NTPSnippetsServiceObserver { | |
| 20 public: | |
| 21 explicit NTPSnippetsBridge(jobject j_profile); | |
| 22 void Destroy(JNIEnv* env, const base::android::JavaParamRef<jobject>& obj); | |
| 23 void SetSnippetsObserver( | |
| 24 JNIEnv* env, | |
| 25 const base::android::JavaParamRef<jobject>& obj, | |
| 26 const base::android::JavaParamRef<jobject>& j_observer); | |
| 27 | |
| 28 static bool RegisterNTPSnippetsBridge(JNIEnv* env); | |
|
Marc Treib
2016/02/10 10:44:43
This could just be "Register", since it'll be call
Bernhard Bauer
2016/02/10 10:48:44
Nit: I would even just call it Register() for brev
May
2016/02/10 18:16:47
Done.
May
2016/02/10 18:16:47
Done.
| |
| 29 | |
| 30 private: | |
| 31 ~NTPSnippetsBridge(); | |
| 32 | |
| 33 // NTPSnippetsServiceObserver overrides | |
| 34 void NTPSnippetsServiceLoaded(NTPSnippetsService* service) override; | |
| 35 void NTPSnippetsServiceShutdown(NTPSnippetsService* service) override; | |
| 36 | |
| 37 NTPSnippetsService* ntp_snippets_service_; | |
| 38 | |
| 39 base::android::ScopedJavaGlobalRef<jobject> observer_; | |
| 40 ScopedObserver<NTPSnippetsService, NTPSnippetsServiceObserver> | |
| 41 snippet_service_observer_; | |
| 42 | |
| 43 DISALLOW_COPY_AND_ASSIGN(NTPSnippetsBridge); | |
| 44 }; | |
| 45 | |
| 46 #endif // CHROME_BROWSER_ANDROID_NTP_SNIPPETS_BRIDGE_H_ | |
| OLD | NEW |