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

Unified Diff: components/offline_pages/core/background/offliner.h

Issue 2742833004: Fix the Download Notifications for Offline Pages to indicate bytes loaded. (Closed)
Patch Set: 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.h
diff --git a/components/offline_pages/core/background/offliner.h b/components/offline_pages/core/background/offliner.h
index 2c36452a9ac8ec7ce040ec01e910241355d32820..bd03ff81ecb4028e190018a0fd80c632729686d4 100644
--- a/components/offline_pages/core/background/offliner.h
+++ b/components/offline_pages/core/background/offliner.h
@@ -59,6 +59,9 @@ class Offliner {
STATUS_COUNT
};
+ // Reports the load progress of a request.
+ typedef base::Callback<void(const SavePageRequest&, int64_t received_bytes)>
+ ProgressCallback;
// Reports the completion status of a request.
// TODO(dougarnett): consider passing back a request id instead of request.
typedef base::Callback<void(const SavePageRequest&, RequestStatus)>
@@ -68,10 +71,13 @@ class Offliner {
virtual ~Offliner() {}
// Processes |request| to load and save an offline page.
- // Returns whether the request was accepted or not. |callback| is guaranteed
- // to be called if the request was accepted and |Cancel()| is not called.
+ // Returns whether the request was accepted or not. |completion_callback| is
+ // guaranteed to be called if the request was accepted and |Cancel()| is not
+ // called on it. |progress_callback| is invoked periodically to report the
+ // number of bytes received from the network (for UI purposes).
virtual bool LoadAndSave(const SavePageRequest& request,
- const CompletionCallback& callback) = 0;
+ const CompletionCallback& completion_callback,
+ const ProgressCallback& progress_callback) = 0;
// Clears the currently processing request, if any, and skips running its
// CompletionCallback.

Powered by Google App Engine
This is Rietveld 408576698