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

Unified Diff: src/platform/update_engine/download_action.h

Issue 2037002: AU: DBus support. (Closed) Base URL: ssh://git@chromiumos-git/chromeos
Patch Set: fixes for review Created 10 years, 7 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: src/platform/update_engine/download_action.h
diff --git a/src/platform/update_engine/download_action.h b/src/platform/update_engine/download_action.h
index 0f375fa1b4f10e38ee641b60ce2fdb4000b1ed80..e1e8aeb37b17dd98da8fd5319d43e5b7a1728748 100644
--- a/src/platform/update_engine/download_action.h
+++ b/src/platform/update_engine/download_action.h
@@ -33,6 +33,15 @@
namespace chromeos_update_engine {
+class DownloadActionDelegate {
+ public:
+ // Called before any bytes are received and periodically after
+ // bytes are received.
+ // bytes_received is the number of bytes downloaded thus far.
+ // total is the number of bytes expected.
+ virtual void BytesReceived(uint64_t bytes_received, uint64_t total) = 0;
+};
+
class DownloadAction;
class NoneType;
@@ -66,11 +75,15 @@ class DownloadAction : public Action<DownloadAction>,
static std::string StaticType() { return "DownloadAction"; }
std::string Type() const { return StaticType(); }
- // Delegate methods (see http_fetcher.h)
+ // HttpFetcherDelegate methods (see http_fetcher.h)
virtual void ReceivedBytes(HttpFetcher *fetcher,
const char* bytes, int length);
virtual void TransferComplete(HttpFetcher *fetcher, bool successful);
+ void set_delegate(DownloadActionDelegate* delegate) {
+ delegate_ = delegate;
+ }
+
private:
// The InstallPlan passed in
InstallPlan install_plan_;
@@ -93,6 +106,11 @@ class DownloadAction : public Action<DownloadAction>,
// Used to find the hash of the bytes downloaded
OmahaHashCalculator omaha_hash_calculator_;
+
+ // For reporting status to outsiders
+ DownloadActionDelegate* delegate_;
+ uint64_t bytes_received_;
+
DISALLOW_COPY_AND_ASSIGN(DownloadAction);
};

Powered by Google App Engine
This is Rietveld 408576698