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

Unified Diff: components/offline_pages/core/downloads/download_ui_adapter.cc

Issue 2716013003: Fixes to enable indication of bytes downloaded for Offline Pages in Download Home. (Closed)
Patch Set: fix build break Created 3 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/offline_pages/core/downloads/download_ui_adapter.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/offline_pages/core/downloads/download_ui_adapter.cc
diff --git a/components/offline_pages/core/downloads/download_ui_adapter.cc b/components/offline_pages/core/downloads/download_ui_adapter.cc
index d73ed686aa5e8b2a72f52bde5354e0da75e98e80..cf92370cf1091e35d770e6068f4292b4113e0db6 100644
--- a/components/offline_pages/core/downloads/download_ui_adapter.cc
+++ b/components/offline_pages/core/downloads/download_ui_adapter.cc
@@ -16,8 +16,29 @@
#include "components/offline_pages/core/downloads/download_ui_item.h"
#include "components/offline_pages/core/offline_page_model.h"
+namespace {
+// Value of this constant doesn't matter, only its address is used.
+const char kDownloadUIAdapterKey[] = "";
+}
+
namespace offline_pages {
+// static
+DownloadUIAdapter* DownloadUIAdapter::FromOfflinePageModel(
+ OfflinePageModel* model) {
+ DCHECK(model);
+ return static_cast<DownloadUIAdapter*>(
+ model->GetUserData(kDownloadUIAdapterKey));
+}
+
+// static
+void DownloadUIAdapter::AttachToOfflinePageModel(DownloadUIAdapter* adapter,
+ OfflinePageModel* model) {
+ DCHECK(adapter);
+ DCHECK(model);
+ model->SetUserData(kDownloadUIAdapterKey, adapter);
+}
+
DownloadUIAdapter::ItemInfo::ItemInfo(const OfflinePageItem& page)
: ui_item(base::MakeUnique<DownloadUIItem>(page)),
is_request(false),
« no previous file with comments | « components/offline_pages/core/downloads/download_ui_adapter.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698