Introduce status handlers and use them in client
We introduce a StatusUpdateHandler class which can be overridden to
provide a method with which to react to status updates. This replaces
manual dbus logic in several places in update_engine_client with a
consistent interface for asynchronously handling status updates.
Change-Id: Idca4229de82074fb7a87a315b45dd0292c1b1f16
Test: Confirmed --update blocks and resumes correctly
Bug: 26233663
diff --git a/client_library/client_impl.h b/client_library/client_impl.h
index 4886692..03c8f3c 100644
--- a/client_library/client_impl.h
+++ b/client_library/client_impl.h
@@ -67,9 +67,23 @@
bool GetChannel(std::string* out_channel) override;
+ void RegisterStatusUpdateHandler(StatusUpdateHandler* handler) override;
+
private:
std::unique_ptr<org::chromium::UpdateEngineInterfaceProxy> proxy_;
+ void StatusUpdateHandlerRegistered(StatusUpdateHandler* handler,
+ const std::string& interface,
+ const std::string& signal_name,
+ bool success);
+
+ void RunStatusUpdateHandler(StatusUpdateHandler* handler,
+ int64_t last_checked_time,
+ double progress,
+ const std::string& current_operation,
+ const std::string& new_version,
+ int64_t new_size);
+
DISALLOW_COPY_AND_ASSIGN(UpdateEngineClientImpl);
}; // class UpdateEngineClientImpl