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

Side by Side Diff: chrome/browser/android/offline_pages/downloads/offline_page_download_bridge.h

Issue 2180973002: [Offline pages] Adapting OfflinePageDownloadBridge to DownloadUIAdapter (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@ui-adapter
Patch Set: Minor updates Created 4 years, 4 months 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 unified diff | Download patch
OLDNEW
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"
11 #include "base/android/jni_weak_ref.h" 11 #include "base/android/jni_weak_ref.h"
12 #include "base/macros.h" 12 #include "base/macros.h"
13 #include "base/supports_user_data.h" 13 #include "base/supports_user_data.h"
14 #include "components/offline_pages/offline_page_item.h" 14 #include "components/offline_pages/downloads/download_ui_adapter.h"
15 #include "components/offline_pages/offline_page_model.h"
16 15
17 namespace content { 16 namespace content {
18 class BrowserContext; 17 class BrowserContext;
19 } 18 }
20 19
21 namespace offline_pages { 20 namespace offline_pages {
22 namespace android { 21 namespace android {
23 22
24 /** 23 /**
25 * Bridge between C++ and Java for exposing native implementation of offline 24 * Bridge between C++ and Java for exposing native implementation of offline
26 * pages model in managed code. 25 * pages model in managed code.
27 */ 26 */
28 class OfflinePageDownloadBridge { 27 class OfflinePageDownloadBridge : public DownloadUIAdapter::Observer {
29 public: 28 public:
30 OfflinePageDownloadBridge(JNIEnv* env, 29 OfflinePageDownloadBridge(JNIEnv* env,
31 const base::android::JavaParamRef<jobject>& obj, 30 const base::android::JavaParamRef<jobject>& obj,
32 content::BrowserContext* browser_context); 31 DownloadUIAdapter* download_ui_adapter);
33 ~OfflinePageDownloadBridge(); 32 ~OfflinePageDownloadBridge() override;
34 33
35 static bool Register(JNIEnv* env); 34 static bool Register(JNIEnv* env);
36 35
37 void Destroy(JNIEnv* env, const base::android::JavaParamRef<jobject>& obj); 36 void Destroy(JNIEnv* env, const base::android::JavaParamRef<jobject>& obj);
38 37
39 void GetAllItems(JNIEnv* env, 38 void GetAllItems(JNIEnv* env,
40 const base::android::JavaParamRef<jobject>& obj, 39 const base::android::JavaParamRef<jobject>& obj,
41 const base::android::JavaParamRef<jobject>& j_result_obj); 40 const base::android::JavaParamRef<jobject>& j_result_obj);
42 41
43 base::android::ScopedJavaLocalRef<jobject> GetItemByGuid( 42 base::android::ScopedJavaLocalRef<jobject> GetItemByGuid(
44 JNIEnv* env, 43 JNIEnv* env,
45 const base::android::JavaParamRef<jobject>& obj, 44 const base::android::JavaParamRef<jobject>& obj,
46 const base::android::JavaParamRef<jstring>& j_guid); 45 const base::android::JavaParamRef<jstring>& j_guid);
47 46
48 void OnOfflinePageDownloadBridgeLoaded(); 47 // DownloadUIAdapter::Observer implementation.
49 void OnOfflinePageDownloadItemAdded(const OfflinePageItem& item); 48 void ItemsLoaded() override;
50 void OnOfflinePageDownloadItemDeleted(const std::string& guid); 49 void ItemAdded(const DownloadUIItem& item) override;
51 void OnOfflinePageDownloadItemUpdated(const OfflinePageItem& item); 50 void ItemUpdated(const DownloadUIItem& item) override;
51 void ItemDeleted(const std::string& guid) override;
52 52
53 private: 53 private:
54 JavaObjectWeakGlobalRef weak_java_ref_; 54 JavaObjectWeakGlobalRef weak_java_ref_;
55 55
56 // Not owned.
57 DownloadUIAdapter* download_ui_adapter_;
58
56 DISALLOW_COPY_AND_ASSIGN(OfflinePageDownloadBridge); 59 DISALLOW_COPY_AND_ASSIGN(OfflinePageDownloadBridge);
57 }; 60 };
58 61
59 } // namespace android 62 } // namespace android
60 } // namespace offline_pages 63 } // namespace offline_pages
61 64
62 #endif // CHROME_BROWSER_ANDROID_OFFLINE_PAGES_DOWNLOADS_OFFLINE_PAGE_DOWNLOAD_ BRIDGE_H_ 65 #endif // CHROME_BROWSER_ANDROID_OFFLINE_PAGES_DOWNLOADS_OFFLINE_PAGE_DOWNLOAD_ BRIDGE_H_
OLDNEW
« no previous file with comments | « chrome/browser/BUILD.gn ('k') | chrome/browser/android/offline_pages/downloads/offline_page_download_bridge.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698