AU: propagate a deadline form the update check response to Chrome.
Currently, this is done through the file system.
BUG=3284
TEST=unit tests
Change-Id: I0e579ef6ccd7832ca22a248e71f2689c27159056
TBR=resubmitting due to git issues
diff --git a/omaha_response_handler_action.cc b/omaha_response_handler_action.cc
index 5159733..fdbd80a 100644
--- a/omaha_response_handler_action.cc
+++ b/omaha_response_handler_action.cc
@@ -16,6 +16,9 @@
namespace chromeos_update_engine {
+const char OmahaResponseHandlerAction::kDeadlineFile[] =
+ "/tmp/update-check-response-deadline";
+
void OmahaResponseHandlerAction::PerformAction() {
CHECK(HasInputObject());
ScopedActionCompleter completer(processor_, this);
@@ -53,6 +56,18 @@
LOG(INFO) << "Using this install plan:";
install_plan_.Dump();
+ // Send the deadline data (if any) to Chrome through a file. This is a pretty
+ // hacky solution but should be OK for now.
+ //
+ // TODO(petkov): Rearchitect this to avoid communication through a
+ // file. Ideallly, we would include this information in D-Bus's GetStatus
+ // method and UpdateStatus signal. A potential issue is that update_engine may
+ // be unresponsive during an update download.
+ utils::WriteFile(kDeadlineFile,
+ response.deadline.data(),
+ response.deadline.size());
+ chmod(kDeadlineFile, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
+
completer.set_code(kActionCodeSuccess);
}