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

Unified Diff: components/offline_pages/core/background/offliner_stub.cc

Issue 2736843002: Fix the Download Notifications for Offline Pages to indicate bytes loaded. (Closed)
Patch Set: more fixes to more tests. Created 3 years, 9 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
Index: components/offline_pages/core/background/offliner_stub.cc
diff --git a/components/offline_pages/core/background/offliner_stub.cc b/components/offline_pages/core/background/offliner_stub.cc
index c007ae0a0aa54edb3e1e020de51101aa8ea367ee..04fe6eae1341d75923a1ecc128c7323266869d3c 100644
--- a/components/offline_pages/core/background/offliner_stub.cc
+++ b/components/offline_pages/core/background/offliner_stub.cc
@@ -19,17 +19,22 @@ OfflinerStub::OfflinerStub()
OfflinerStub::~OfflinerStub() {}
bool OfflinerStub::LoadAndSave(const SavePageRequest& request,
- const CompletionCallback& callback) {
+ const CompletionCallback& completion_callback,
+ const ProgressCallback& progress_callback) {
if (disable_loading_)
return false;
- callback_ = callback;
+ completion_callback_ = completion_callback;
+ progress_callback_ = progress_callback;
// Post the callback on the run loop.
if (enable_callback_) {
+ const int64_t arbitrary_size = 153LL;
base::ThreadTaskRunnerHandle::Get()->PostTask(
- FROM_HERE,
- base::Bind(callback, request, Offliner::RequestStatus::SAVED));
+ FROM_HERE, base::Bind(progress_callback_, request, arbitrary_size));
+ base::ThreadTaskRunnerHandle::Get()->PostTask(
+ FROM_HERE, base::Bind(completion_callback_, request,
+ Offliner::RequestStatus::SAVED));
}
return true;
}
@@ -42,8 +47,8 @@ void OfflinerStub::Cancel(const CancelCallback& callback) {
bool OfflinerStub::HandleTimeout(const SavePageRequest& request) {
if (snapshot_on_last_retry_) {
base::ThreadTaskRunnerHandle::Get()->PostTask(
- FROM_HERE,
- base::Bind(callback_, request, Offliner::RequestStatus::SAVED));
+ FROM_HERE, base::Bind(completion_callback_, request,
+ Offliner::RequestStatus::SAVED));
return true;
}
return false;

Powered by Google App Engine
This is Rietveld 408576698