AU: Detect and report public key verify failures, but continue updating.

Make a new OmahaEvent (Type: 14 (kTypeUpdateDownloadFinished), Result:
0 (kResultError), ErrorCode: 18
(kActionCodeDownloadPayloadPubKeyVerificationError)). This event is
sent if we have a successful download that fails public key
verification. Currently this is a non-fatal failure, but we plan to
make it fatal in future clients.

BUG=chromium-os:13341
TEST=unittests; 3 on device tests: w/o public key on device, w/ pub
key and matching download, w/ pub key and non-matching download

Change-Id: Ib6589c78449c2dfcbffa4c85ab679f7fe844584b

Review URL: http://codereview.chromium.org/6792065
diff --git a/download_action.h b/download_action.h
index 6106740..3a7dfe8 100644
--- a/download_action.h
+++ b/download_action.h
@@ -13,6 +13,7 @@
 
 #include <base/scoped_ptr.h>
 #include <curl/curl.h>
+#include <google/protobuf/stubs/common.h>
 
 #include "update_engine/action.h"
 #include "update_engine/decompressing_file_writer.h"
@@ -97,6 +98,10 @@
 
   HttpFetcher* http_fetcher() { return http_fetcher_.get(); }
 
+  void set_skip_reporting_signature_fail(google::protobuf::Closure* callback) {
+    skip_reporting_signature_fail_.reset(callback);
+  }
+
  private:
   // The InstallPlan passed in
   InstallPlan install_plan_;
@@ -133,6 +138,9 @@
   DownloadActionDelegate* delegate_;
   uint64_t bytes_received_;
 
+  // Called if the download fails OR (download success AND signature verifies)
+  scoped_ptr<google::protobuf::Closure> skip_reporting_signature_fail_;
+
   DISALLOW_COPY_AND_ASSIGN(DownloadAction);
 };