AU: Remove support for old-style updates.

This code is basically untested, unused and a security risk. So, remove...

BUG=chromium-os:12542
TEST=unit tests, tested VM update

Change-Id: Ibed0582b09497acef9debdf88658cddc2b5cecce
Reviewed-on: http://gerrit.chromium.org/gerrit/8728
Tested-by: Darin Petkov <petkov@chromium.org>
Reviewed-by: Andrew de los Reyes <adlr@chromium.org>
Commit-Ready: Darin Petkov <petkov@chromium.org>
diff --git a/download_action.cc b/download_action.cc
index 9da925c..989625d 100644
--- a/download_action.cc
+++ b/download_action.cc
@@ -44,31 +44,10 @@
   if (writer_) {
     LOG(INFO) << "Using writer for test.";
   } else {
-    if (install_plan_.is_full_update) {
-      kernel_file_writer_.reset(new DirectFileWriter);
-      rootfs_file_writer_.reset(new DirectFileWriter);
-      kernel_buffered_file_writer_.reset(
-          new BufferedFileWriter(kernel_file_writer_.get(),
-                                 kFileWriterBufferSize));
-      rootfs_buffered_file_writer_.reset(
-          new BufferedFileWriter(rootfs_file_writer_.get(),
-                                 kFileWriterBufferSize));
-      split_file_writer_.reset(
-          new SplitFileWriter(kernel_buffered_file_writer_.get(),
-                              rootfs_buffered_file_writer_.get()));
-      split_file_writer_->SetFirstOpenArgs(
-          install_plan_.kernel_install_path.c_str(),
-          O_WRONLY | O_CREAT | O_TRUNC | O_LARGEFILE,
-          0644);
-      decompressing_file_writer_.reset(
-          new GzipDecompressingFileWriter(split_file_writer_.get()));
-      writer_ = decompressing_file_writer_.get();
-    } else {
-      delta_performer_.reset(new DeltaPerformer(prefs_));
-      delta_performer_->set_current_kernel_hash(install_plan_.kernel_hash);
-      delta_performer_->set_current_rootfs_hash(install_plan_.rootfs_hash);
-      writer_ = delta_performer_.get();
-    }
+    delta_performer_.reset(new DeltaPerformer(prefs_));
+    delta_performer_->set_current_kernel_hash(install_plan_.kernel_hash);
+    delta_performer_->set_current_rootfs_hash(install_plan_.rootfs_hash);
+    writer_ = delta_performer_.get();
   }
   int rc = writer_->Open(install_plan_.install_path.c_str(),
                          O_TRUNC | O_WRONLY | O_CREAT | O_LARGEFILE,
@@ -79,15 +58,14 @@
     processor_->ActionComplete(this, kActionCodeInstallDeviceOpenError);
     return;
   }
-  if (!install_plan_.is_full_update) {
-    if (!delta_performer_->OpenKernel(
-            install_plan_.kernel_install_path.c_str())) {
-      LOG(ERROR) << "Unable to open kernel file "
-                 << install_plan_.kernel_install_path.c_str();
-      writer_->Close();
-      processor_->ActionComplete(this, kActionCodeKernelDeviceOpenError);
-      return;
-    }
+  if (delta_performer_.get() &&
+      !delta_performer_->OpenKernel(
+          install_plan_.kernel_install_path.c_str())) {
+    LOG(ERROR) << "Unable to open kernel file "
+               << install_plan_.kernel_install_path.c_str();
+    writer_->Close();
+    processor_->ActionComplete(this, kActionCodeKernelDeviceOpenError);
+    return;
   }
   if (delegate_) {
     delegate_->SetDownloadStatus(true);  // Set to active.
@@ -127,10 +105,6 @@
     TerminateProcessing();
     return;
   }
-  // DeltaPerformer checks the hashes for delta updates.
-  if (install_plan_.is_full_update) {
-    omaha_hash_calculator_.Update(bytes, length);
-  }
 }
 
 namespace {
@@ -159,36 +133,20 @@
   }
   ActionExitCode code =
       successful ? kActionCodeSuccess : kActionCodeDownloadTransferError;
-  if (code == kActionCodeSuccess) {
-    if (!install_plan_.is_full_update) {
-      code = delta_performer_->VerifyPayload("",
-                                             install_plan_.download_hash,
-                                             install_plan_.size);
-      if (code != kActionCodeSuccess) {
-        LOG(ERROR) << "Download of " << install_plan_.download_url
-                   << " failed due to payload verification error.";
-      } else if (!delta_performer_->GetNewPartitionInfo(
-          &install_plan_.kernel_size,
-          &install_plan_.kernel_hash,
-          &install_plan_.rootfs_size,
-          &install_plan_.rootfs_hash)) {
-        LOG(ERROR) << "Unable to get new partition hash info.";
-        code = kActionCodeDownloadNewPartitionInfoError;
-      }
-    } else {
-      // Makes sure the hash and size are correct for an old-style full update.
-      omaha_hash_calculator_.Finalize();
-      if (omaha_hash_calculator_.hash() != install_plan_.download_hash) {
-        LOG(ERROR) << "Download of " << install_plan_.download_url
-                   << " failed. Expected hash " << install_plan_.download_hash
-                   << " but got hash " << omaha_hash_calculator_.hash();
-        code = kActionCodeDownloadHashMismatchError;
-      } else if (bytes_received_ != install_plan_.size) {
-        LOG(ERROR) << "Download of " << install_plan_.download_url
-                   << " failed. Expected size " << install_plan_.size
-                   << " but got size " << bytes_received_;
-        code = kActionCodeDownloadSizeMismatchError;
-      }
+  if (code == kActionCodeSuccess && delta_performer_.get()) {
+    code = delta_performer_->VerifyPayload("",
+                                           install_plan_.download_hash,
+                                           install_plan_.size);
+    if (code != kActionCodeSuccess) {
+      LOG(ERROR) << "Download of " << install_plan_.download_url
+                 << " failed due to payload verification error.";
+    } else if (!delta_performer_->GetNewPartitionInfo(
+        &install_plan_.kernel_size,
+        &install_plan_.kernel_hash,
+        &install_plan_.rootfs_size,
+        &install_plan_.rootfs_hash)) {
+      LOG(ERROR) << "Unable to get new partition hash info.";
+      code = kActionCodeDownloadNewPartitionInfoError;
     }
   }