p2p: Add HttpPeer to DownloadSource enumeration

This way the Installer.DownloadSourcesUsed metric conveys how often
p2p is used and new metrics Installer.SuccessfulMBsDownloadedFromHttpPeer
and Installer.TotalMBsDownloadedFromHttpPeer gives additional detail.

BUG=chromium:284714
TEST=modify unit tests to cover this case + unit tests pass

Change-Id: Ia4dff090091a282e1a184c2b18f8290749f5fdeb
Reviewed-on: https://chromium-review.googlesource.com/167913
Reviewed-by: Alex Deymo <deymo@chromium.org>
Commit-Queue: David Zeuthen <zeuthen@chromium.org>
Tested-by: David Zeuthen <zeuthen@chromium.org>
diff --git a/payload_state_interface.h b/payload_state_interface.h
index 83fe3f5..5c67ba6 100644
--- a/payload_state_interface.h
+++ b/payload_state_interface.h
@@ -74,6 +74,11 @@
   virtual void ExpectRebootInNewVersion(
       const std::string& target_version_uid) = 0;
 
+  // Sets whether p2p is being used to download the update payload. This
+  // is used to keep track download sources being used and should be called
+  // before the transfer begins.
+  virtual void SetUsingP2PForDownloading(bool value) = 0;
+
   // Returns true if we should backoff the current download attempt.
   // False otherwise.
   virtual bool ShouldBackoffDownload() = 0;
@@ -155,6 +160,9 @@
   // and examining how many attempts have been done already as well
   // as when the first attempt was.
   virtual bool P2PAttemptAllowed() = 0;
+
+  // Gets the value previously set with SetUsingP2PForDownloading().
+  virtual bool GetUsingP2PForDownloading() = 0;
 };
 
 }  // namespace chromeos_update_engine