| 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_OFFLINE_PAGES_DOWNLOADS_OFFLINE_PAGE_DOWNLOAD_BRI
DGE_H_ | 5 #ifndef CHROME_BROWSER_ANDROID_OFFLINE_PAGES_DOWNLOADS_OFFLINE_PAGE_DOWNLOAD_BRI
DGE_H_ |
| 6 #define CHROME_BROWSER_ANDROID_OFFLINE_PAGES_DOWNLOADS_OFFLINE_PAGE_DOWNLOAD_BRI
DGE_H_ | 6 #define CHROME_BROWSER_ANDROID_OFFLINE_PAGES_DOWNLOADS_OFFLINE_PAGE_DOWNLOAD_BRI
DGE_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include "base/android/jni_android.h" | 10 #include "base/android/jni_android.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 namespace android { | 21 namespace android { |
| 22 | 22 |
| 23 /** | 23 /** |
| 24 * Bridge between C++ and Java for exposing native implementation of offline | 24 * Bridge between C++ and Java for exposing native implementation of offline |
| 25 * pages model in managed code. | 25 * pages model in managed code. |
| 26 */ | 26 */ |
| 27 class OfflinePageDownloadBridge : public DownloadUIAdapter::Observer { | 27 class OfflinePageDownloadBridge : public DownloadUIAdapter::Observer { |
| 28 public: | 28 public: |
| 29 OfflinePageDownloadBridge(JNIEnv* env, | 29 OfflinePageDownloadBridge(JNIEnv* env, |
| 30 const base::android::JavaParamRef<jobject>& obj, | 30 const base::android::JavaParamRef<jobject>& obj, |
| 31 DownloadUIAdapter* download_ui_adapter); | 31 DownloadUIAdapter* download_ui_adapter, |
| 32 content::BrowserContext* browser_context); |
| 32 ~OfflinePageDownloadBridge() override; | 33 ~OfflinePageDownloadBridge() override; |
| 33 | 34 |
| 34 static bool Register(JNIEnv* env); | 35 static bool Register(JNIEnv* env); |
| 35 | 36 |
| 36 void Destroy( | 37 void Destroy( |
| 37 JNIEnv* env, | 38 JNIEnv* env, |
| 38 const base::android::JavaParamRef<jobject>& obj); | 39 const base::android::JavaParamRef<jobject>& obj); |
| 39 | 40 |
| 40 void GetAllItems( | 41 void GetAllItems( |
| 41 JNIEnv* env, | 42 JNIEnv* env, |
| (...skipping 13 matching lines...) Expand all Loading... |
| 55 base::android::ScopedJavaLocalRef<jstring> GetOfflineUrlByGuid( | 56 base::android::ScopedJavaLocalRef<jstring> GetOfflineUrlByGuid( |
| 56 JNIEnv* env, | 57 JNIEnv* env, |
| 57 const base::android::JavaParamRef<jobject>& obj, | 58 const base::android::JavaParamRef<jobject>& obj, |
| 58 const base::android::JavaParamRef<jstring>& j_guid); | 59 const base::android::JavaParamRef<jstring>& j_guid); |
| 59 | 60 |
| 60 void StartDownload( | 61 void StartDownload( |
| 61 JNIEnv* env, | 62 JNIEnv* env, |
| 62 const base::android::JavaParamRef<jobject>& obj, | 63 const base::android::JavaParamRef<jobject>& obj, |
| 63 const base::android::JavaParamRef<jobject>& j_tab); | 64 const base::android::JavaParamRef<jobject>& j_tab); |
| 64 | 65 |
| 66 void CancelDownload(JNIEnv* env, |
| 67 const base::android::JavaParamRef<jobject>& obj, |
| 68 const base::android::JavaParamRef<jstring>& j_guid); |
| 69 |
| 70 void PauseDownload(JNIEnv* env, |
| 71 const base::android::JavaParamRef<jobject>& obj, |
| 72 const base::android::JavaParamRef<jstring>& j_guid); |
| 73 |
| 74 void ResumeDownload(JNIEnv* env, |
| 75 const base::android::JavaParamRef<jobject>& obj, |
| 76 const base::android::JavaParamRef<jstring>& j_guid); |
| 77 |
| 65 // DownloadUIAdapter::Observer implementation. | 78 // DownloadUIAdapter::Observer implementation. |
| 66 void ItemsLoaded() override; | 79 void ItemsLoaded() override; |
| 67 void ItemAdded(const DownloadUIItem& item) override; | 80 void ItemAdded(const DownloadUIItem& item) override; |
| 68 void ItemUpdated(const DownloadUIItem& item) override; | 81 void ItemUpdated(const DownloadUIItem& item) override; |
| 69 void ItemDeleted(const std::string& guid) override; | 82 void ItemDeleted(const std::string& guid) override; |
| 70 | 83 |
| 71 private: | 84 private: |
| 72 static void SavePageCallback(const DownloadUIItem& item, | 85 static void SavePageCallback(const DownloadUIItem& item, |
| 73 OfflinePageModel::SavePageResult result, | 86 OfflinePageModel::SavePageResult result, |
| 74 int64_t offline_id); | 87 int64_t offline_id); |
| 75 | 88 |
| 76 JavaObjectWeakGlobalRef weak_java_ref_; | 89 JavaObjectWeakGlobalRef weak_java_ref_; |
| 77 // Not owned. | 90 // Not owned. |
| 78 DownloadUIAdapter* download_ui_adapter_; | 91 DownloadUIAdapter* download_ui_adapter_; |
| 92 // Not owned. |
| 93 content::BrowserContext* browser_context_; |
| 79 | 94 |
| 80 DISALLOW_COPY_AND_ASSIGN(OfflinePageDownloadBridge); | 95 DISALLOW_COPY_AND_ASSIGN(OfflinePageDownloadBridge); |
| 81 }; | 96 }; |
| 82 | 97 |
| 83 } // namespace android | 98 } // namespace android |
| 84 } // namespace offline_pages | 99 } // namespace offline_pages |
| 85 | 100 |
| 86 #endif // CHROME_BROWSER_ANDROID_OFFLINE_PAGES_DOWNLOADS_OFFLINE_PAGE_DOWNLOAD_
BRIDGE_H_ | 101 #endif // CHROME_BROWSER_ANDROID_OFFLINE_PAGES_DOWNLOADS_OFFLINE_PAGE_DOWNLOAD_
BRIDGE_H_ |
| OLD | NEW |