| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_ANDROID_NTP_NTP_SNIPPETS_BRIDGE_H_ | 5 #ifndef CHROME_BROWSER_ANDROID_NTP_NTP_SNIPPETS_BRIDGE_H_ |
| 6 #define CHROME_BROWSER_ANDROID_NTP_NTP_SNIPPETS_BRIDGE_H_ | 6 #define CHROME_BROWSER_ANDROID_NTP_NTP_SNIPPETS_BRIDGE_H_ |
| 7 | 7 |
| 8 #include <jni.h> | 8 #include <jni.h> |
| 9 | 9 |
| 10 #include "base/android/scoped_java_ref.h" | 10 #include "base/android/scoped_java_ref.h" |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 const base::android::JavaParamRef<jstring>& jurl); | 45 const base::android::JavaParamRef<jstring>& jurl); |
| 46 | 46 |
| 47 static bool Register(JNIEnv* env); | 47 static bool Register(JNIEnv* env); |
| 48 | 48 |
| 49 private: | 49 private: |
| 50 ~NTPSnippetsBridge() override; | 50 ~NTPSnippetsBridge() override; |
| 51 | 51 |
| 52 // NTPSnippetsServiceObserver overrides | 52 // NTPSnippetsServiceObserver overrides |
| 53 void NTPSnippetsServiceLoaded() override; | 53 void NTPSnippetsServiceLoaded() override; |
| 54 void NTPSnippetsServiceShutdown() override; | 54 void NTPSnippetsServiceShutdown() override; |
| 55 void NTPSnippetsServiceCleared() override; |
| 55 | 56 |
| 56 void OnImageFetched(base::android::ScopedJavaGlobalRef<jobject> callback, | 57 void OnImageFetched(base::android::ScopedJavaGlobalRef<jobject> callback, |
| 57 const std::string& snippet_id, | 58 const std::string& snippet_id, |
| 58 const SkBitmap* bitmap); | 59 const SkBitmap* bitmap); |
| 59 | 60 |
| 60 ntp_snippets::NTPSnippetsService* ntp_snippets_service_; | 61 ntp_snippets::NTPSnippetsService* ntp_snippets_service_; |
| 61 history::HistoryService* history_service_; | 62 history::HistoryService* history_service_; |
| 62 base::CancelableTaskTracker tracker_; | 63 base::CancelableTaskTracker tracker_; |
| 63 | 64 |
| 64 // Used to notify the Java side when new snippets have been fetched. | 65 // Used to notify the Java side when new snippets have been fetched. |
| 65 base::android::ScopedJavaGlobalRef<jobject> observer_; | 66 base::android::ScopedJavaGlobalRef<jobject> observer_; |
| 66 ScopedObserver<ntp_snippets::NTPSnippetsService, | 67 ScopedObserver<ntp_snippets::NTPSnippetsService, |
| 67 ntp_snippets::NTPSnippetsServiceObserver> | 68 ntp_snippets::NTPSnippetsServiceObserver> |
| 68 snippet_service_observer_; | 69 snippet_service_observer_; |
| 69 | 70 |
| 70 base::WeakPtrFactory<NTPSnippetsBridge> weak_ptr_factory_; | 71 base::WeakPtrFactory<NTPSnippetsBridge> weak_ptr_factory_; |
| 71 | 72 |
| 72 DISALLOW_COPY_AND_ASSIGN(NTPSnippetsBridge); | 73 DISALLOW_COPY_AND_ASSIGN(NTPSnippetsBridge); |
| 73 }; | 74 }; |
| 74 | 75 |
| 75 #endif // CHROME_BROWSER_ANDROID_NTP_NTP_SNIPPETS_BRIDGE_H_ | 76 #endif // CHROME_BROWSER_ANDROID_NTP_NTP_SNIPPETS_BRIDGE_H_ |
| OLD | NEW |