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

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: Hooking up download ui adapter to offline page model and bridge 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" 15
16 using offline_pages::DownloadUIAdapter;
fgorski 2016/07/26 22:23:13 nit: remove this.
16 17
17 namespace content { 18 namespace content {
18 class BrowserContext; 19 class BrowserContext;
19 } 20 }
20 21
21 namespace offline_pages { 22 namespace offline_pages {
22 namespace android { 23 namespace android {
23 24
24 /** 25 /**
25 * Bridge between C++ and Java for exposing native implementation of offline 26 * Bridge between C++ and Java for exposing native implementation of offline
26 * pages model in managed code. 27 * pages model in managed code.
27 */ 28 */
28 class OfflinePageDownloadBridge { 29 class OfflinePageDownloadBridge : public DownloadUIAdapter::Observer {
29 public: 30 public:
30 OfflinePageDownloadBridge(JNIEnv* env, 31 OfflinePageDownloadBridge(JNIEnv* env,
31 const base::android::JavaParamRef<jobject>& obj, 32 const base::android::JavaParamRef<jobject>& obj,
32 content::BrowserContext* browser_context); 33 DownloadUIAdapter* download_ui_adapter);
33 ~OfflinePageDownloadBridge(); 34 ~OfflinePageDownloadBridge() override;
34 35
35 static bool Register(JNIEnv* env); 36 static bool Register(JNIEnv* env);
36 37
37 void Destroy(JNIEnv* env, const base::android::JavaParamRef<jobject>& obj); 38 void Destroy(JNIEnv* env, const base::android::JavaParamRef<jobject>& obj);
38 39
39 void GetAllItems(JNIEnv* env, 40 void GetAllItems(JNIEnv* env,
40 const base::android::JavaParamRef<jobject>& obj, 41 const base::android::JavaParamRef<jobject>& obj,
41 const base::android::JavaParamRef<jobject>& j_result_obj); 42 const base::android::JavaParamRef<jobject>& j_result_obj);
42 43
43 base::android::ScopedJavaLocalRef<jobject> GetItemByGuid( 44 base::android::ScopedJavaLocalRef<jobject> GetItemByGuid(
44 JNIEnv* env, 45 JNIEnv* env,
45 const base::android::JavaParamRef<jobject>& obj, 46 const base::android::JavaParamRef<jobject>& obj,
46 const base::android::JavaParamRef<jstring>& j_guid); 47 const base::android::JavaParamRef<jstring>& j_guid);
47 48
48 void OnOfflinePageDownloadBridgeLoaded(); 49 // DownloadUIAdapter::Observer implementation.
49 void OnOfflinePageDownloadItemAdded(const OfflinePageItem& item); 50 void ItemsLoaded() override;
50 void OnOfflinePageDownloadItemDeleted(const std::string& guid); 51 void ItemAdded(const DownloadUIItem& item) override;
51 void OnOfflinePageDownloadItemUpdated(const OfflinePageItem& item); 52 void ItemUpdated(const DownloadUIItem& item) override;
53 void ItemDeleted(const std::string& guid) override;
52 54
53 private: 55 private:
54 JavaObjectWeakGlobalRef weak_java_ref_; 56 JavaObjectWeakGlobalRef weak_java_ref_;
55 57
58 // Not owned.
59 DownloadUIAdapter* download_ui_adapter_;
60
56 DISALLOW_COPY_AND_ASSIGN(OfflinePageDownloadBridge); 61 DISALLOW_COPY_AND_ASSIGN(OfflinePageDownloadBridge);
57 }; 62 };
58 63
59 } // namespace android 64 } // namespace android
60 } // namespace offline_pages 65 } // namespace offline_pages
61 66
62 #endif // CHROME_BROWSER_ANDROID_OFFLINE_PAGES_DOWNLOADS_OFFLINE_PAGE_DOWNLOAD_ BRIDGE_H_ 67 #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