update_engine: UM: UpdateCheckAllowed now considers interactive update requests.

This is necessary so we can delegate handling of all update checks to
the UpdateManager, allowing us to share logic between the two cases and
eliminate multiple entry point to UpdateAttempter::Update() and handling
of interference between these two processes. Instead, these are all
handled naturally by the UpdateManager.

BUG=chromium:394389
TEST=Unit tests.

Change-Id: I32a1ab917e5aeb5c2da1953d8b0ffa8c9d8d62f9
Reviewed-on: https://chromium-review.googlesource.com/209100
Reviewed-by: Gilad Arnold <garnold@chromium.org>
Tested-by: Gilad Arnold <garnold@chromium.org>
Commit-Queue: Gilad Arnold <garnold@chromium.org>
diff --git a/update_attempter.h b/update_attempter.h
index 037fc24..8ea348a 100644
--- a/update_attempter.h
+++ b/update_attempter.h
@@ -12,6 +12,7 @@
 #include <vector>
 #include <utility>
 
+#include <base/bind.h>
 #include <base/time/time.h>
 #include <glib.h>
 #include <gtest/gtest_prod.h>  // for FRIEND_TEST
@@ -205,6 +206,16 @@
     return server_dictated_poll_interval_;
   }
 
+  // Sets a callback to be used when either an interactive update request is
+  // received (true) or cleared by an update attempt (false). Takes ownership of
+  // the callback object. A null value disables callback on these events. Note
+  // that only one callback can be set, so effectively at most one client can be
+  // notified.
+  virtual void set_interactive_update_pending_callback(
+      base::Callback<void(bool)>* callback) {  // NOLINT(readability/function)
+    interactive_update_pending_callback_.reset(callback);
+  }
+
  private:
   // Update server URL for automated lab test.
   static const char* const kTestUpdateUrl;
@@ -467,6 +478,11 @@
   // otherwise. This is needed for calculating the update check interval.
   unsigned int server_dictated_poll_interval_ = 0;
 
+  // A callback to use when either an interactive update request is received
+  // (true) or cleared by an update attempt (false).
+  scoped_ptr<base::Callback<void(bool)>>  // NOLINT(readability/function)
+      interactive_update_pending_callback_;
+
   DISALLOW_COPY_AND_ASSIGN(UpdateAttempter);
 };