update_engine: Move InstallOperation to the top level.

The InstallOperation message in the protobuf is a nested message
inside the DeltaArchiveManifest message, making all references to
operation types be very long names like
DeltaArchiveManifest_InstallOperation_Type_REPLACE_BZ while most other
messages are not nested in the DeltaArchiveManifest message.

To improve readability and to prepare for future update metadata
changes, this patch moves the InstallOperation message to the top level
and replaces all references to operation types with the new shorter
version like InstallOperation::REPLACE_BZ.

This change only impacts the scope of the generated classes and the
serialized format of the protobuf. This exact same question was
addressed by protobuf maintainers here:

https://groups.google.com/forum/#!topic/protobuf/azWAPa6hP4A

Finally coding style and indentation was automatically updated due to
the shorter names.

BUG=b:23179128
TEST=Unittest still pass.

Change-Id: I55add54265934cd1fd3e9cb786c5d3f784902d17
Reviewed-on: https://chromium-review.googlesource.com/293504
Trybot-Ready: Alex Deymo <deymo@chromium.org>
Tested-by: Alex Deymo <deymo@chromium.org>
Reviewed-by: Alex Deymo <deymo@chromium.org>
Commit-Queue: Alex Deymo <deymo@chromium.org>
diff --git a/payload_generator/ab_generator.cc b/payload_generator/ab_generator.cc
index 8d2736a..573c5b8 100644
--- a/payload_generator/ab_generator.cc
+++ b/payload_generator/ab_generator.cc
@@ -91,13 +91,10 @@
     BlobFileWriter* blob_file) {
   vector<AnnotatedOperation> fragmented_aops;
   for (const AnnotatedOperation& aop : *aops) {
-    if (aop.op.type() ==
-        DeltaArchiveManifest_InstallOperation_Type_SOURCE_COPY) {
+    if (aop.op.type() == InstallOperation::SOURCE_COPY) {
       TEST_AND_RETURN_FALSE(SplitSourceCopy(aop, &fragmented_aops));
-    } else if ((aop.op.type() ==
-                DeltaArchiveManifest_InstallOperation_Type_REPLACE) ||
-               (aop.op.type() ==
-                DeltaArchiveManifest_InstallOperation_Type_REPLACE_BZ)) {
+    } else if ((aop.op.type() == InstallOperation::REPLACE) ||
+               (aop.op.type() == InstallOperation::REPLACE_BZ)) {
       TEST_AND_RETURN_FALSE(SplitReplaceOrReplaceBz(aop, &fragmented_aops,
                                                     target_part_path,
                                                     blob_file));
@@ -112,16 +109,15 @@
 bool ABGenerator::SplitSourceCopy(
     const AnnotatedOperation& original_aop,
     vector<AnnotatedOperation>* result_aops) {
-  DeltaArchiveManifest_InstallOperation original_op = original_aop.op;
-  TEST_AND_RETURN_FALSE(original_op.type() ==
-                        DeltaArchiveManifest_InstallOperation_Type_SOURCE_COPY);
+  InstallOperation original_op = original_aop.op;
+  TEST_AND_RETURN_FALSE(original_op.type() == InstallOperation::SOURCE_COPY);
   // Keeps track of the index of curr_src_ext.
   int curr_src_ext_index = 0;
   Extent curr_src_ext = original_op.src_extents(curr_src_ext_index);
   for (int i = 0; i < original_op.dst_extents_size(); i++) {
     Extent dst_ext = original_op.dst_extents(i);
     // The new operation which will have only one dst extent.
-    DeltaArchiveManifest_InstallOperation new_op;
+    InstallOperation new_op;
     uint64_t blocks_left = dst_ext.num_blocks();
     while (blocks_left > 0) {
       if (curr_src_ext.num_blocks() <= blocks_left) {
@@ -146,7 +142,7 @@
       }
     }
     // Fix up our new operation and add it to the results.
-    new_op.set_type(DeltaArchiveManifest_InstallOperation_Type_SOURCE_COPY);
+    new_op.set_type(InstallOperation::SOURCE_COPY);
     *(new_op.add_dst_extents()) = dst_ext;
     new_op.set_src_length(dst_ext.num_blocks() * kBlockSize);
     new_op.set_dst_length(dst_ext.num_blocks() * kBlockSize);
@@ -168,25 +164,22 @@
     vector<AnnotatedOperation>* result_aops,
     const string& target_part_path,
     BlobFileWriter* blob_file) {
-  DeltaArchiveManifest_InstallOperation original_op = original_aop.op;
-  const bool is_replace =
-      original_op.type() == DeltaArchiveManifest_InstallOperation_Type_REPLACE;
-  TEST_AND_RETURN_FALSE(
-      is_replace ||
-      (original_op.type() ==
-       DeltaArchiveManifest_InstallOperation_Type_REPLACE_BZ));
+  InstallOperation original_op = original_aop.op;
+  const bool is_replace = original_op.type() == InstallOperation::REPLACE;
+  TEST_AND_RETURN_FALSE(is_replace ||
+                        original_op.type() == InstallOperation::REPLACE_BZ);
 
   uint32_t data_offset = original_op.data_offset();
   for (int i = 0; i < original_op.dst_extents_size(); i++) {
     Extent dst_ext = original_op.dst_extents(i);
     // Make a new operation with only one dst extent.
-    DeltaArchiveManifest_InstallOperation new_op;
+    InstallOperation new_op;
     *(new_op.add_dst_extents()) = dst_ext;
     uint32_t data_size = dst_ext.num_blocks() * kBlockSize;
     new_op.set_dst_length(data_size);
     // If this is a REPLACE, attempt to reuse portions of the existing blob.
     if (is_replace) {
-      new_op.set_type(DeltaArchiveManifest_InstallOperation_Type_REPLACE);
+      new_op.set_type(InstallOperation::REPLACE);
       new_op.set_data_length(data_size);
       new_op.set_data_offset(data_offset);
       data_offset += data_size;
@@ -228,13 +221,9 @@
     uint32_t combined_block_count =
         last_aop.op.dst_extents(last_dst_idx).num_blocks() +
         curr_aop.op.dst_extents(0).num_blocks();
-    bool good_op_type =
-        curr_aop.op.type() ==
-            DeltaArchiveManifest_InstallOperation_Type_SOURCE_COPY ||
-        curr_aop.op.type() ==
-            DeltaArchiveManifest_InstallOperation_Type_REPLACE ||
-        curr_aop.op.type() ==
-            DeltaArchiveManifest_InstallOperation_Type_REPLACE_BZ;
+    bool good_op_type = curr_aop.op.type() == InstallOperation::SOURCE_COPY ||
+                        curr_aop.op.type() == InstallOperation::REPLACE ||
+                        curr_aop.op.type() == InstallOperation::REPLACE_BZ;
     if (good_op_type &&
         last_aop.op.type() == curr_aop.op.type() &&
         last_end_block == curr_start_block &&
@@ -258,10 +247,8 @@
         last_aop.op.set_dst_length(last_aop.op.dst_length() +
                                    curr_aop.op.dst_length());
       // Set the data length to zero so we know to add the blob later.
-      if (curr_aop.op.type() ==
-          DeltaArchiveManifest_InstallOperation_Type_REPLACE ||
-          curr_aop.op.type() ==
-          DeltaArchiveManifest_InstallOperation_Type_REPLACE_BZ) {
+      if (curr_aop.op.type() == InstallOperation::REPLACE ||
+          curr_aop.op.type() == InstallOperation::REPLACE_BZ) {
         last_aop.op.set_data_length(0);
       }
     } else {
@@ -273,10 +260,8 @@
   // Set the blobs for REPLACE/REPLACE_BZ operations that have been merged.
   for (AnnotatedOperation& curr_aop : new_aops) {
     if (curr_aop.op.data_length() == 0 &&
-        (curr_aop.op.type() ==
-            DeltaArchiveManifest_InstallOperation_Type_REPLACE ||
-         curr_aop.op.type() ==
-            DeltaArchiveManifest_InstallOperation_Type_REPLACE_BZ)) {
+        (curr_aop.op.type() == InstallOperation::REPLACE ||
+         curr_aop.op.type() == InstallOperation::REPLACE_BZ)) {
       TEST_AND_RETURN_FALSE(AddDataAndSetType(&curr_aop, target_part_path,
                                               blob_file));
     }
@@ -289,9 +274,8 @@
 bool ABGenerator::AddDataAndSetType(AnnotatedOperation* aop,
                                     const string& target_part_path,
                                     BlobFileWriter* blob_file) {
-  TEST_AND_RETURN_FALSE(
-      aop->op.type() == DeltaArchiveManifest_InstallOperation_Type_REPLACE ||
-      aop->op.type() == DeltaArchiveManifest_InstallOperation_Type_REPLACE_BZ);
+  TEST_AND_RETURN_FALSE(aop->op.type() == InstallOperation::REPLACE ||
+                        aop->op.type() == InstallOperation::REPLACE_BZ);
 
   chromeos::Blob data(aop->op.dst_length());
   vector<Extent> dst_extents;
@@ -307,12 +291,12 @@
   CHECK(!data_bz.empty());
 
   chromeos::Blob* data_p = nullptr;
-  DeltaArchiveManifest_InstallOperation_Type new_op_type;
+  InstallOperation_Type new_op_type;
   if (data_bz.size() < data.size()) {
-    new_op_type = DeltaArchiveManifest_InstallOperation_Type_REPLACE_BZ;
+    new_op_type = InstallOperation::REPLACE_BZ;
     data_p = &data_bz;
   } else {
-    new_op_type = DeltaArchiveManifest_InstallOperation_Type_REPLACE;
+    new_op_type = InstallOperation::REPLACE;
     data_p = &data;
   }
 
diff --git a/payload_generator/ab_generator_unittest.cc b/payload_generator/ab_generator_unittest.cc
index c87324c..b06ba63 100644
--- a/payload_generator/ab_generator_unittest.cc
+++ b/payload_generator/ab_generator_unittest.cc
@@ -33,9 +33,8 @@
 }
 
 // Tests splitting of a REPLACE/REPLACE_BZ operation.
-void TestSplitReplaceOrReplaceBzOperation(
-    DeltaArchiveManifest_InstallOperation_Type orig_type,
-    bool compressible) {
+void TestSplitReplaceOrReplaceBzOperation(InstallOperation_Type orig_type,
+                                          bool compressible) {
   const size_t op_ex1_start_block = 2;
   const size_t op_ex1_num_blocks = 2;
   const size_t op_ex2_start_block = 6;
@@ -66,7 +65,7 @@
   const size_t op_ex1_size = op_ex1_num_blocks * kBlockSize;
   const size_t op_ex2_offset = op_ex2_start_block * kBlockSize;
   const size_t op_ex2_size = op_ex2_num_blocks * kBlockSize;
-  DeltaArchiveManifest_InstallOperation op;
+  InstallOperation op;
   op.set_type(orig_type);
   *(op.add_dst_extents()) = ExtentForRange(op_ex1_start_block,
                                            op_ex1_num_blocks);
@@ -82,7 +81,7 @@
                  part_data.begin() + op_ex2_offset,
                  part_data.begin() + op_ex2_offset + op_ex2_size);
   chromeos::Blob op_blob;
-  if (orig_type == DeltaArchiveManifest_InstallOperation_Type_REPLACE) {
+  if (orig_type == InstallOperation::REPLACE) {
     op_blob = op_data;
   } else {
     ASSERT_TRUE(BzipCompress(op_data, &op_blob));
@@ -113,15 +112,13 @@
           aop, &result_ops, part_path, &blob_file));
 
   // Check the result.
-  DeltaArchiveManifest_InstallOperation_Type expected_type =
-      compressible ?
-      DeltaArchiveManifest_InstallOperation_Type_REPLACE_BZ :
-      DeltaArchiveManifest_InstallOperation_Type_REPLACE;
+  InstallOperation_Type expected_type =
+      compressible ? InstallOperation::REPLACE_BZ : InstallOperation::REPLACE;
 
   ASSERT_EQ(2, result_ops.size());
 
   EXPECT_EQ("SplitTestOp:0", result_ops[0].name);
-  DeltaArchiveManifest_InstallOperation first_op = result_ops[0].op;
+  InstallOperation first_op = result_ops[0].op;
   EXPECT_EQ(expected_type, first_op.type());
   EXPECT_EQ(op_ex1_size, first_op.dst_length());
   EXPECT_EQ(1, first_op.dst_extents().size());
@@ -150,7 +147,7 @@
   EXPECT_EQ(first_expected_blob, first_data_blob);
 
   EXPECT_EQ("SplitTestOp:1", result_ops[1].name);
-  DeltaArchiveManifest_InstallOperation second_op = result_ops[1].op;
+  InstallOperation second_op = result_ops[1].op;
   EXPECT_EQ(expected_type, second_op.type());
   EXPECT_EQ(op_ex2_size, second_op.dst_length());
   EXPECT_EQ(1, second_op.dst_extents().size());
@@ -182,16 +179,14 @@
             second_op.data_offset());
   EXPECT_EQ(second_op.data_offset() + second_op.data_length(), data_file_size);
   // If we split a REPLACE into multiple ones, ensure reuse of preexisting blob.
-  if (!compressible &&
-      orig_type == DeltaArchiveManifest_InstallOperation_Type_REPLACE) {
+  if (!compressible && orig_type == InstallOperation::REPLACE) {
     EXPECT_EQ(0, first_op.data_offset());
   }
 }
 
 // Tests merging of REPLACE/REPLACE_BZ operations.
-void TestMergeReplaceOrReplaceBzOperations(
-    DeltaArchiveManifest_InstallOperation_Type orig_type,
-    bool compressible) {
+void TestMergeReplaceOrReplaceBzOperations(InstallOperation_Type orig_type,
+                                           bool compressible) {
   const size_t first_op_num_blocks = 1;
   const size_t second_op_num_blocks = 2;
   const size_t total_op_num_blocks = first_op_num_blocks + second_op_num_blocks;
@@ -221,7 +216,7 @@
   chromeos::Blob blob_data;
   const size_t total_op_size = total_op_num_blocks * kBlockSize;
 
-  DeltaArchiveManifest_InstallOperation first_op;
+  InstallOperation first_op;
   first_op.set_type(orig_type);
   const size_t first_op_size = first_op_num_blocks * kBlockSize;
   first_op.set_dst_length(first_op_size);
@@ -229,7 +224,7 @@
   chromeos::Blob first_op_data(part_data.begin(),
                                part_data.begin() + first_op_size);
   chromeos::Blob first_op_blob;
-  if (orig_type == DeltaArchiveManifest_InstallOperation_Type_REPLACE) {
+  if (orig_type == InstallOperation::REPLACE) {
     first_op_blob = first_op_data;
   } else {
     ASSERT_TRUE(BzipCompress(first_op_data, &first_op_blob));
@@ -242,7 +237,7 @@
   first_aop.name = "first";
   aops.push_back(first_aop);
 
-  DeltaArchiveManifest_InstallOperation second_op;
+  InstallOperation second_op;
   second_op.set_type(orig_type);
   const size_t second_op_size = second_op_num_blocks * kBlockSize;
   second_op.set_dst_length(second_op_size);
@@ -251,7 +246,7 @@
   chromeos::Blob second_op_data(part_data.begin() + first_op_size,
                                 part_data.begin() + total_op_size);
   chromeos::Blob second_op_blob;
-  if (orig_type == DeltaArchiveManifest_InstallOperation_Type_REPLACE) {
+  if (orig_type == InstallOperation::REPLACE) {
     second_op_blob = second_op_data;
   } else {
     ASSERT_TRUE(BzipCompress(second_op_data, &second_op_blob));
@@ -283,12 +278,10 @@
       &aops, 5, part_path, &blob_file));
 
   // Check the result.
-  DeltaArchiveManifest_InstallOperation_Type expected_op_type =
-      compressible ?
-      DeltaArchiveManifest_InstallOperation_Type_REPLACE_BZ :
-      DeltaArchiveManifest_InstallOperation_Type_REPLACE;
+  InstallOperation_Type expected_op_type =
+      compressible ? InstallOperation::REPLACE_BZ : InstallOperation::REPLACE;
   EXPECT_EQ(1, aops.size());
-  DeltaArchiveManifest_InstallOperation new_op = aops[0].op;
+  InstallOperation new_op = aops[0].op;
   EXPECT_EQ(expected_op_type, new_op.type());
   EXPECT_FALSE(new_op.has_src_length());
   EXPECT_EQ(total_op_num_blocks * kBlockSize, new_op.dst_length());
@@ -323,8 +316,8 @@
 class ABGeneratorTest : public ::testing::Test {};
 
 TEST_F(ABGeneratorTest, SplitSourceCopyTest) {
-  DeltaArchiveManifest_InstallOperation op;
-  op.set_type(DeltaArchiveManifest_InstallOperation_Type_SOURCE_COPY);
+  InstallOperation op;
+  op.set_type(InstallOperation::SOURCE_COPY);
   *(op.add_src_extents()) = ExtentForRange(2, 3);
   *(op.add_src_extents()) = ExtentForRange(6, 1);
   *(op.add_src_extents()) = ExtentForRange(8, 4);
@@ -340,9 +333,8 @@
   EXPECT_EQ(result_ops.size(), 3);
 
   EXPECT_EQ("SplitSourceCopyTestOp:0", result_ops[0].name);
-  DeltaArchiveManifest_InstallOperation first_op = result_ops[0].op;
-  EXPECT_EQ(DeltaArchiveManifest_InstallOperation_Type_SOURCE_COPY,
-            first_op.type());
+  InstallOperation first_op = result_ops[0].op;
+  EXPECT_EQ(InstallOperation::SOURCE_COPY, first_op.type());
   EXPECT_EQ(kBlockSize * 2, first_op.src_length());
   EXPECT_EQ(1, first_op.src_extents().size());
   EXPECT_EQ(2, first_op.src_extents(0).start_block());
@@ -353,9 +345,8 @@
   EXPECT_EQ(2, first_op.dst_extents(0).num_blocks());
 
   EXPECT_EQ("SplitSourceCopyTestOp:1", result_ops[1].name);
-  DeltaArchiveManifest_InstallOperation second_op = result_ops[1].op;
-  EXPECT_EQ(DeltaArchiveManifest_InstallOperation_Type_SOURCE_COPY,
-            second_op.type());
+  InstallOperation second_op = result_ops[1].op;
+  EXPECT_EQ(InstallOperation::SOURCE_COPY, second_op.type());
   EXPECT_EQ(kBlockSize * 3, second_op.src_length());
   EXPECT_EQ(3, second_op.src_extents().size());
   EXPECT_EQ(4, second_op.src_extents(0).start_block());
@@ -370,9 +361,8 @@
   EXPECT_EQ(3, second_op.dst_extents(0).num_blocks());
 
   EXPECT_EQ("SplitSourceCopyTestOp:2", result_ops[2].name);
-  DeltaArchiveManifest_InstallOperation third_op = result_ops[2].op;
-  EXPECT_EQ(DeltaArchiveManifest_InstallOperation_Type_SOURCE_COPY,
-            third_op.type());
+  InstallOperation third_op = result_ops[2].op;
+  EXPECT_EQ(InstallOperation::SOURCE_COPY, third_op.type());
   EXPECT_EQ(kBlockSize * 3, third_op.src_length());
   EXPECT_EQ(1, third_op.src_extents().size());
   EXPECT_EQ(9, third_op.src_extents(0).start_block());
@@ -384,29 +374,25 @@
 }
 
 TEST_F(ABGeneratorTest, SplitReplaceTest) {
-  TestSplitReplaceOrReplaceBzOperation(
-      DeltaArchiveManifest_InstallOperation_Type_REPLACE, false);
+  TestSplitReplaceOrReplaceBzOperation(InstallOperation::REPLACE, false);
 }
 
 TEST_F(ABGeneratorTest, SplitReplaceIntoReplaceBzTest) {
-  TestSplitReplaceOrReplaceBzOperation(
-      DeltaArchiveManifest_InstallOperation_Type_REPLACE, true);
+  TestSplitReplaceOrReplaceBzOperation(InstallOperation::REPLACE, true);
 }
 
 TEST_F(ABGeneratorTest, SplitReplaceBzTest) {
-  TestSplitReplaceOrReplaceBzOperation(
-      DeltaArchiveManifest_InstallOperation_Type_REPLACE_BZ, true);
+  TestSplitReplaceOrReplaceBzOperation(InstallOperation::REPLACE_BZ, true);
 }
 
 TEST_F(ABGeneratorTest, SplitReplaceBzIntoReplaceTest) {
-  TestSplitReplaceOrReplaceBzOperation(
-      DeltaArchiveManifest_InstallOperation_Type_REPLACE_BZ, false);
+  TestSplitReplaceOrReplaceBzOperation(InstallOperation::REPLACE_BZ, false);
 }
 
 TEST_F(ABGeneratorTest, SortOperationsByDestinationTest) {
   vector<AnnotatedOperation> aops;
   // One operation with multiple destination extents.
-  DeltaArchiveManifest_InstallOperation first_op;
+  InstallOperation first_op;
   *(first_op.add_dst_extents()) = ExtentForRange(6, 1);
   *(first_op.add_dst_extents()) = ExtentForRange(10, 2);
   AnnotatedOperation first_aop;
@@ -415,14 +401,14 @@
   aops.push_back(first_aop);
 
   // One with no destination extent. Should end up at the end of the vector.
-  DeltaArchiveManifest_InstallOperation second_op;
+  InstallOperation second_op;
   AnnotatedOperation second_aop;
   second_aop.op = second_op;
   second_aop.name = "second";
   aops.push_back(second_aop);
 
   // One with one destination extent.
-  DeltaArchiveManifest_InstallOperation third_op;
+  InstallOperation third_op;
   *(third_op.add_dst_extents()) = ExtentForRange(3, 2);
   AnnotatedOperation third_aop;
   third_aop.op = third_op;
@@ -438,8 +424,8 @@
 
 TEST_F(ABGeneratorTest, MergeSourceCopyOperationsTest) {
   vector<AnnotatedOperation> aops;
-  DeltaArchiveManifest_InstallOperation first_op;
-  first_op.set_type(DeltaArchiveManifest_InstallOperation_Type_SOURCE_COPY);
+  InstallOperation first_op;
+  first_op.set_type(InstallOperation::SOURCE_COPY);
   first_op.set_src_length(kBlockSize);
   first_op.set_dst_length(kBlockSize);
   *(first_op.add_src_extents()) = ExtentForRange(1, 1);
@@ -449,8 +435,8 @@
   first_aop.name = "1";
   aops.push_back(first_aop);
 
-  DeltaArchiveManifest_InstallOperation second_op;
-  second_op.set_type(DeltaArchiveManifest_InstallOperation_Type_SOURCE_COPY);
+  InstallOperation second_op;
+  second_op.set_type(InstallOperation::SOURCE_COPY);
   second_op.set_src_length(3 * kBlockSize);
   second_op.set_dst_length(3 * kBlockSize);
   *(second_op.add_src_extents()) = ExtentForRange(2, 2);
@@ -462,8 +448,8 @@
   second_aop.name = "2";
   aops.push_back(second_aop);
 
-  DeltaArchiveManifest_InstallOperation third_op;
-  third_op.set_type(DeltaArchiveManifest_InstallOperation_Type_SOURCE_COPY);
+  InstallOperation third_op;
+  third_op.set_type(InstallOperation::SOURCE_COPY);
   third_op.set_src_length(kBlockSize);
   third_op.set_dst_length(kBlockSize);
   *(third_op.add_src_extents()) = ExtentForRange(11, 1);
@@ -477,9 +463,8 @@
   EXPECT_TRUE(ABGenerator::MergeOperations(&aops, 5, "", &blob_file));
 
   EXPECT_EQ(aops.size(), 1);
-  DeltaArchiveManifest_InstallOperation first_result_op = aops[0].op;
-  EXPECT_EQ(DeltaArchiveManifest_InstallOperation_Type_SOURCE_COPY,
-            first_result_op.type());
+  InstallOperation first_result_op = aops[0].op;
+  EXPECT_EQ(InstallOperation::SOURCE_COPY, first_result_op.type());
   EXPECT_EQ(kBlockSize * 5, first_result_op.src_length());
   EXPECT_EQ(3, first_result_op.src_extents().size());
   EXPECT_TRUE(ExtentEquals(first_result_op.src_extents(0), 1, 3));
@@ -493,30 +478,26 @@
 }
 
 TEST_F(ABGeneratorTest, MergeReplaceOperationsTest) {
-  TestMergeReplaceOrReplaceBzOperations(
-      DeltaArchiveManifest_InstallOperation_Type_REPLACE, false);
+  TestMergeReplaceOrReplaceBzOperations(InstallOperation::REPLACE, false);
 }
 
 TEST_F(ABGeneratorTest, MergeReplaceOperationsToReplaceBzTest) {
-  TestMergeReplaceOrReplaceBzOperations(
-      DeltaArchiveManifest_InstallOperation_Type_REPLACE, true);
+  TestMergeReplaceOrReplaceBzOperations(InstallOperation::REPLACE, true);
 }
 
 TEST_F(ABGeneratorTest, MergeReplaceBzOperationsTest) {
-  TestMergeReplaceOrReplaceBzOperations(
-      DeltaArchiveManifest_InstallOperation_Type_REPLACE_BZ, true);
+  TestMergeReplaceOrReplaceBzOperations(InstallOperation::REPLACE_BZ, true);
 }
 
 TEST_F(ABGeneratorTest, MergeReplaceBzOperationsToReplaceTest) {
-  TestMergeReplaceOrReplaceBzOperations(
-      DeltaArchiveManifest_InstallOperation_Type_REPLACE_BZ, false);
+  TestMergeReplaceOrReplaceBzOperations(InstallOperation::REPLACE_BZ, false);
 }
 
 TEST_F(ABGeneratorTest, NoMergeOperationsTest) {
   // Test to make sure we don't merge operations that shouldn't be merged.
   vector<AnnotatedOperation> aops;
-  DeltaArchiveManifest_InstallOperation first_op;
-  first_op.set_type(DeltaArchiveManifest_InstallOperation_Type_REPLACE_BZ);
+  InstallOperation first_op;
+  first_op.set_type(InstallOperation::REPLACE_BZ);
   *(first_op.add_dst_extents()) = ExtentForRange(0, 1);
   first_op.set_data_length(kBlockSize);
   AnnotatedOperation first_aop;
@@ -524,8 +505,8 @@
   aops.push_back(first_aop);
 
   // Should merge with first, except op types don't match...
-  DeltaArchiveManifest_InstallOperation second_op;
-  second_op.set_type(DeltaArchiveManifest_InstallOperation_Type_REPLACE);
+  InstallOperation second_op;
+  second_op.set_type(InstallOperation::REPLACE);
   *(second_op.add_dst_extents()) = ExtentForRange(1, 2);
   second_op.set_data_length(2 * kBlockSize);
   AnnotatedOperation second_aop;
@@ -533,8 +514,8 @@
   aops.push_back(second_aop);
 
   // Should merge with second, except it would exceed chunk size...
-  DeltaArchiveManifest_InstallOperation third_op;
-  third_op.set_type(DeltaArchiveManifest_InstallOperation_Type_REPLACE);
+  InstallOperation third_op;
+  third_op.set_type(InstallOperation::REPLACE);
   *(third_op.add_dst_extents()) = ExtentForRange(3, 3);
   third_op.set_data_length(3 * kBlockSize);
   AnnotatedOperation third_aop;
@@ -542,8 +523,8 @@
   aops.push_back(third_aop);
 
   // Should merge with third, except they aren't contiguous...
-  DeltaArchiveManifest_InstallOperation fourth_op;
-  fourth_op.set_type(DeltaArchiveManifest_InstallOperation_Type_REPLACE);
+  InstallOperation fourth_op;
+  fourth_op.set_type(InstallOperation::REPLACE);
   *(fourth_op.add_dst_extents()) = ExtentForRange(7, 2);
   fourth_op.set_data_length(2 * kBlockSize);
   AnnotatedOperation fourth_aop;
diff --git a/payload_generator/annotated_operation.cc b/payload_generator/annotated_operation.cc
index 2a0a0de..d723004 100644
--- a/payload_generator/annotated_operation.cc
+++ b/payload_generator/annotated_operation.cc
@@ -35,20 +35,19 @@
   return true;
 }
 
-string InstallOperationTypeName(
-    DeltaArchiveManifest_InstallOperation_Type op_type) {
+string InstallOperationTypeName(InstallOperation_Type op_type) {
   switch (op_type) {
-    case DeltaArchiveManifest_InstallOperation_Type_BSDIFF:
+    case InstallOperation::BSDIFF:
       return "BSDIFF";
-    case DeltaArchiveManifest_InstallOperation_Type_MOVE:
+    case InstallOperation::MOVE:
       return "MOVE";
-    case DeltaArchiveManifest_InstallOperation_Type_REPLACE:
+    case InstallOperation::REPLACE:
       return "REPLACE";
-    case DeltaArchiveManifest_InstallOperation_Type_REPLACE_BZ:
+    case InstallOperation::REPLACE_BZ:
       return "REPLACE_BZ";
-    case DeltaArchiveManifest_InstallOperation_Type_SOURCE_COPY:
+    case InstallOperation::SOURCE_COPY:
       return "SOURCE_COPY";
-    case DeltaArchiveManifest_InstallOperation_Type_SOURCE_BSDIFF:
+    case InstallOperation::SOURCE_BSDIFF:
       return "SOURCE_BSDIFF";
   }
   return "UNK";
diff --git a/payload_generator/annotated_operation.h b/payload_generator/annotated_operation.h
index 2a88bef..e28c0e8 100644
--- a/payload_generator/annotated_operation.h
+++ b/payload_generator/annotated_operation.h
@@ -21,7 +21,7 @@
   std::string name;
 
   // The InstallOperation, as defined by the protobuf.
-  DeltaArchiveManifest_InstallOperation op;
+  InstallOperation op;
 
   // Writes |blob| to the end of |data_fd|, and updates |data_file_size| to
   // match the new size of |data_fd|. It sets the data_offset and data_length
@@ -32,8 +32,7 @@
 // For logging purposes.
 std::ostream& operator<<(std::ostream& os, const AnnotatedOperation& aop);
 
-std::string InstallOperationTypeName(
-    DeltaArchiveManifest_InstallOperation_Type op_type);
+std::string InstallOperationTypeName(InstallOperation_Type op_type);
 
 }  // namespace chromeos_update_engine
 
diff --git a/payload_generator/cycle_breaker.cc b/payload_generator/cycle_breaker.cc
index 9c20813..9c92161 100644
--- a/payload_generator/cycle_breaker.cc
+++ b/payload_generator/cycle_breaker.cc
@@ -43,9 +43,9 @@
   skipped_ops_ = 0;
 
   for (Graph::size_type i = 0; i < subgraph_.size(); i++) {
-    DeltaArchiveManifest_InstallOperation_Type op_type = graph[i].aop.op.type();
-    if (op_type == DeltaArchiveManifest_InstallOperation_Type_REPLACE ||
-        op_type == DeltaArchiveManifest_InstallOperation_Type_REPLACE_BZ) {
+    InstallOperation_Type op_type = graph[i].aop.op.type();
+    if (op_type == InstallOperation::REPLACE ||
+        op_type == InstallOperation::REPLACE_BZ) {
       skipped_ops_++;
       continue;
     }
diff --git a/payload_generator/cycle_breaker_unittest.cc b/payload_generator/cycle_breaker_unittest.cc
index 66a13a5..69443ed 100644
--- a/payload_generator/cycle_breaker_unittest.cc
+++ b/payload_generator/cycle_breaker_unittest.cc
@@ -26,7 +26,7 @@
 namespace {
 void SetOpForNodes(Graph* graph) {
   for (Vertex& vertex : *graph) {
-    vertex.aop.op.set_type(DeltaArchiveManifest_InstallOperation_Type_MOVE);
+    vertex.aop.op.set_type(InstallOperation::MOVE);
   }
 }
 }  // namespace
@@ -249,10 +249,8 @@
 
   Graph graph(kNodeCount);
   SetOpForNodes(&graph);
-  graph[n_a].aop.op.set_type(
-      DeltaArchiveManifest_InstallOperation_Type_REPLACE_BZ);
-  graph[n_c].aop.op.set_type(
-      DeltaArchiveManifest_InstallOperation_Type_REPLACE);
+  graph[n_a].aop.op.set_type(InstallOperation::REPLACE_BZ);
+  graph[n_c].aop.op.set_type(InstallOperation::REPLACE);
 
   graph[n_a].out_edges.insert(EdgeWithWeight(n_b, 1));
   graph[n_c].out_edges.insert(EdgeWithWeight(n_b, 1));
diff --git a/payload_generator/delta_diff_utils.cc b/payload_generator/delta_diff_utils.cc
index 68462ae..4b39806 100644
--- a/payload_generator/delta_diff_utils.cc
+++ b/payload_generator/delta_diff_utils.cc
@@ -364,9 +364,8 @@
       aops->emplace_back();
       AnnotatedOperation* aop = &aops->back();
       aop->name = "<identical-blocks>";
-      aop->op.set_type(src_ops_allowed ?
-                       DeltaArchiveManifest_InstallOperation_Type_SOURCE_COPY :
-                       DeltaArchiveManifest_InstallOperation_Type_MOVE);
+      aop->op.set_type(src_ops_allowed ? InstallOperation::SOURCE_COPY
+                                       : InstallOperation::MOVE);
 
       uint64_t chunk_num_blocks =
         std::min(extent.num_blocks() - op_block_offset,
@@ -407,7 +406,7 @@
     BlobFileWriter* blob_file,
     bool src_ops_allowed) {
   chromeos::Blob data;
-  DeltaArchiveManifest_InstallOperation operation;
+  InstallOperation operation;
 
   uint64_t total_blocks = BlocksInExtents(new_extents);
   if (chunk_blocks == -1)
@@ -451,7 +450,7 @@
 
     // Check if the operation writes nothing.
     if (operation.dst_extents_size() == 0) {
-      if (operation.type() == DeltaArchiveManifest_InstallOperation_Type_MOVE) {
+      if (operation.type() == InstallOperation::MOVE) {
         LOG(INFO) << "Empty MOVE operation ("
                   << name << "), skipping";
         continue;
@@ -471,9 +470,8 @@
     aop.op = operation;
 
     // Write the data
-    if (operation.type() != DeltaArchiveManifest_InstallOperation_Type_MOVE &&
-        operation.type() !=
-            DeltaArchiveManifest_InstallOperation_Type_SOURCE_COPY) {
+    if (operation.type() != InstallOperation::MOVE &&
+        operation.type() != InstallOperation::SOURCE_COPY) {
       TEST_AND_RETURN_FALSE(aop.SetOperationBlob(&data, blob_file));
     } else {
       TEST_AND_RETURN_FALSE(blob_file->StoreBlob(data) != -1);
@@ -489,9 +487,9 @@
                        const vector<Extent>& new_extents,
                        bool bsdiff_allowed,
                        chromeos::Blob* out_data,
-                       DeltaArchiveManifest_InstallOperation* out_op,
+                       InstallOperation* out_op,
                        bool src_ops_allowed) {
-  DeltaArchiveManifest_InstallOperation operation;
+  InstallOperation operation;
   // Data blob that will be written to delta file.
   const chromeos::Blob* data_blob = nullptr;
 
@@ -514,7 +512,7 @@
 
 
   // Using a REPLACE is always an option.
-  operation.set_type(DeltaArchiveManifest_InstallOperation_Type_REPLACE);
+  operation.set_type(InstallOperation::REPLACE);
   data_blob = &new_data;
 
   // Try compressing it with bzip2.
@@ -523,7 +521,7 @@
   CHECK(!new_data_bz.empty());
   if (new_data_bz.size() < data_blob->size()) {
     // A REPLACE_BZ is better.
-    operation.set_type(DeltaArchiveManifest_InstallOperation_Type_REPLACE_BZ);
+    operation.set_type(InstallOperation::REPLACE_BZ);
     data_blob = &new_data_bz;
   }
 
@@ -538,10 +536,9 @@
     if (old_data == new_data) {
       // No change in data.
       if (src_ops_allowed) {
-        operation.set_type(
-            DeltaArchiveManifest_InstallOperation_Type_SOURCE_COPY);
+        operation.set_type(InstallOperation::SOURCE_COPY);
       } else {
-        operation.set_type(DeltaArchiveManifest_InstallOperation_Type_MOVE);
+        operation.set_type(InstallOperation::MOVE);
       }
       data_blob = &empty_blob;
     } else if (bsdiff_allowed) {
@@ -565,10 +562,9 @@
       CHECK_GT(bsdiff_delta.size(), static_cast<chromeos::Blob::size_type>(0));
       if (bsdiff_delta.size() < data_blob->size()) {
         if (src_ops_allowed) {
-          operation.set_type(
-              DeltaArchiveManifest_InstallOperation_Type_SOURCE_BSDIFF);
+          operation.set_type(InstallOperation::SOURCE_BSDIFF);
         } else {
-          operation.set_type(DeltaArchiveManifest_InstallOperation_Type_BSDIFF);
+          operation.set_type(InstallOperation::BSDIFF);
         }
         data_blob = &bsdiff_delta;
       }
@@ -577,7 +573,7 @@
 
   size_t removed_bytes = 0;
   // Remove identical src/dst block ranges in MOVE operations.
-  if (operation.type() == DeltaArchiveManifest_InstallOperation_Type_MOVE) {
+  if (operation.type() == InstallOperation::MOVE) {
     removed_bytes = RemoveIdenticalBlockRanges(
         &src_extents, &dst_extents, new_data.size());
   }
@@ -590,9 +586,8 @@
   StoreExtents(dst_extents, operation.mutable_dst_extents());
 
   // Replace operations should not have source extents.
-  if (operation.type() == DeltaArchiveManifest_InstallOperation_Type_REPLACE ||
-      operation.type() ==
-          DeltaArchiveManifest_InstallOperation_Type_REPLACE_BZ) {
+  if (operation.type() == InstallOperation::REPLACE ||
+      operation.type() == InstallOperation::REPLACE_BZ) {
     operation.clear_src_extents();
     operation.clear_src_length();
   }
@@ -631,8 +626,8 @@
 
 // Returns true if |op| is a no-op operation that doesn't do any useful work
 // (e.g., a move operation that copies blocks onto themselves).
-bool IsNoopOperation(const DeltaArchiveManifest_InstallOperation& op) {
-  return (op.type() == DeltaArchiveManifest_InstallOperation_Type_MOVE &&
+bool IsNoopOperation(const InstallOperation& op) {
+  return (op.type() == InstallOperation::MOVE &&
           ExpandExtents(op.src_extents()) == ExpandExtents(op.dst_extents()));
 }
 
diff --git a/payload_generator/delta_diff_utils.h b/payload_generator/delta_diff_utils.h
index e3acdf4..ece8115 100644
--- a/payload_generator/delta_diff_utils.h
+++ b/payload_generator/delta_diff_utils.h
@@ -93,7 +93,7 @@
                        const std::vector<Extent>& new_extents,
                        bool bsdiff_allowed,
                        chromeos::Blob* out_data,
-                       DeltaArchiveManifest_InstallOperation* out_op,
+                       InstallOperation* out_op,
                        bool src_ops_allowed);
 
 // Runs the bsdiff tool on two files and returns the resulting delta in
@@ -104,7 +104,7 @@
 
 // Returns true if |op| is a no-op operation that doesn't do any useful work
 // (e.g., a move operation that copies blocks onto themselves).
-bool IsNoopOperation(const DeltaArchiveManifest_InstallOperation& op);
+bool IsNoopOperation(const InstallOperation& op);
 
 // Filters all the operations that are no-op, maintaining the relative order
 // of the rest of the operations.
diff --git a/payload_generator/delta_diff_utils_unittest.cc b/payload_generator/delta_diff_utils_unittest.cc
index d7243c0..0425785 100644
--- a/payload_generator/delta_diff_utils_unittest.cc
+++ b/payload_generator/delta_diff_utils_unittest.cc
@@ -159,7 +159,7 @@
   EXPECT_TRUE(WriteExtents(new_part_.path, new_extents, kBlockSize, data_blob));
 
   chromeos::Blob data;
-  DeltaArchiveManifest_InstallOperation op;
+  InstallOperation op;
   EXPECT_TRUE(diff_utils::ReadExtentsToDiff(
       old_part_.path,
       new_part_.path,
@@ -172,7 +172,7 @@
   EXPECT_TRUE(data.empty());
 
   EXPECT_TRUE(op.has_type());
-  EXPECT_EQ(DeltaArchiveManifest_InstallOperation_Type_MOVE, op.type());
+  EXPECT_EQ(InstallOperation::MOVE, op.type());
   EXPECT_FALSE(op.has_data_offset());
   EXPECT_FALSE(op.has_data_length());
   EXPECT_EQ(1, op.src_extents_size());
@@ -219,7 +219,7 @@
   EXPECT_TRUE(WriteExtents(new_part_.path, new_extents, kBlockSize, file_data));
 
   chromeos::Blob data;
-  DeltaArchiveManifest_InstallOperation op;
+  InstallOperation op;
   EXPECT_TRUE(diff_utils::ReadExtentsToDiff(
       old_part_.path,
       new_part_.path,
@@ -233,7 +233,7 @@
   EXPECT_TRUE(data.empty());
 
   EXPECT_TRUE(op.has_type());
-  EXPECT_EQ(DeltaArchiveManifest_InstallOperation_Type_MOVE, op.type());
+  EXPECT_EQ(InstallOperation::MOVE, op.type());
   EXPECT_FALSE(op.has_data_offset());
   EXPECT_FALSE(op.has_data_length());
 
@@ -283,7 +283,7 @@
   EXPECT_TRUE(WriteExtents(new_part_.path, new_extents, kBlockSize, data_blob));
 
   chromeos::Blob data;
-  DeltaArchiveManifest_InstallOperation op;
+  InstallOperation op;
   EXPECT_TRUE(diff_utils::ReadExtentsToDiff(
       old_part_.path,
       new_part_.path,
@@ -297,7 +297,7 @@
   EXPECT_FALSE(data.empty());
 
   EXPECT_TRUE(op.has_type());
-  EXPECT_EQ(DeltaArchiveManifest_InstallOperation_Type_BSDIFF, op.type());
+  EXPECT_EQ(InstallOperation::BSDIFF, op.type());
   EXPECT_FALSE(op.has_data_offset());
   EXPECT_FALSE(op.has_data_length());
   EXPECT_EQ(1, op.src_extents_size());
@@ -325,7 +325,7 @@
   EXPECT_TRUE(WriteExtents(new_part_.path, new_extents, kBlockSize, data_blob));
 
   chromeos::Blob data;
-  DeltaArchiveManifest_InstallOperation op;
+  InstallOperation op;
   EXPECT_TRUE(diff_utils::ReadExtentsToDiff(
       old_part_.path,
       new_part_.path,
@@ -341,7 +341,7 @@
   // The point of this test is that we don't use BSDIFF the way the above
   // did. The rest of the details are to be caught in other tests.
   EXPECT_TRUE(op.has_type());
-  EXPECT_NE(DeltaArchiveManifest_InstallOperation_Type_BSDIFF, op.type());
+  EXPECT_NE(InstallOperation::BSDIFF, op.type());
 }
 
 TEST_F(DeltaDiffUtilsTest, BsdiffNotAllowedMoveTest) {
@@ -356,7 +356,7 @@
   EXPECT_TRUE(WriteExtents(new_part_.path, new_extents, kBlockSize, data_blob));
 
   chromeos::Blob data;
-  DeltaArchiveManifest_InstallOperation op;
+  InstallOperation op;
   EXPECT_TRUE(diff_utils::ReadExtentsToDiff(
       old_part_.path,
       new_part_.path,
@@ -372,7 +372,7 @@
   // The point of this test is that we can still use a MOVE for a file
   // that is blacklisted.
   EXPECT_TRUE(op.has_type());
-  EXPECT_EQ(DeltaArchiveManifest_InstallOperation_Type_MOVE, op.type());
+  EXPECT_EQ(InstallOperation::MOVE, op.type());
 }
 
 TEST_F(DeltaDiffUtilsTest, ReplaceSmallTest) {
@@ -398,7 +398,7 @@
                              data_to_test));
 
     chromeos::Blob data;
-    DeltaArchiveManifest_InstallOperation op;
+    InstallOperation op;
     EXPECT_TRUE(diff_utils::ReadExtentsToDiff(
         old_part_.path,
         new_part_.path,
@@ -411,9 +411,8 @@
     EXPECT_FALSE(data.empty());
 
     EXPECT_TRUE(op.has_type());
-    const DeltaArchiveManifest_InstallOperation_Type expected_type =
-        (i == 0 ? DeltaArchiveManifest_InstallOperation_Type_REPLACE :
-         DeltaArchiveManifest_InstallOperation_Type_REPLACE_BZ);
+    const InstallOperation_Type expected_type =
+        (i == 0 ? InstallOperation::REPLACE : InstallOperation::REPLACE_BZ);
     EXPECT_EQ(expected_type, op.type());
     EXPECT_FALSE(op.has_data_offset());
     EXPECT_FALSE(op.has_data_length());
@@ -440,7 +439,7 @@
   EXPECT_TRUE(WriteExtents(new_part_.path, new_extents, kBlockSize, data_blob));
 
   chromeos::Blob data;
-  DeltaArchiveManifest_InstallOperation op;
+  InstallOperation op;
   EXPECT_TRUE(diff_utils::ReadExtentsToDiff(
       old_part_.path,
       new_part_.path,
@@ -453,7 +452,7 @@
   EXPECT_TRUE(data.empty());
 
   EXPECT_TRUE(op.has_type());
-  EXPECT_EQ(DeltaArchiveManifest_InstallOperation_Type_SOURCE_COPY, op.type());
+  EXPECT_EQ(InstallOperation::SOURCE_COPY, op.type());
 }
 
 TEST_F(DeltaDiffUtilsTest, SourceBsdiffTest) {
@@ -473,7 +472,7 @@
   EXPECT_TRUE(WriteExtents(new_part_.path, new_extents, kBlockSize, data_blob));
 
   chromeos::Blob data;
-  DeltaArchiveManifest_InstallOperation op;
+  InstallOperation op;
   EXPECT_TRUE(diff_utils::ReadExtentsToDiff(
       old_part_.path,
       new_part_.path,
@@ -486,15 +485,14 @@
 
   EXPECT_FALSE(data.empty());
   EXPECT_TRUE(op.has_type());
-  EXPECT_EQ(DeltaArchiveManifest_InstallOperation_Type_SOURCE_BSDIFF,
-            op.type());
+  EXPECT_EQ(InstallOperation::SOURCE_BSDIFF, op.type());
 }
 
 TEST_F(DeltaDiffUtilsTest, IsNoopOperationTest) {
-  DeltaArchiveManifest_InstallOperation op;
-  op.set_type(DeltaArchiveManifest_InstallOperation_Type_REPLACE_BZ);
+  InstallOperation op;
+  op.set_type(InstallOperation::REPLACE_BZ);
   EXPECT_FALSE(diff_utils::IsNoopOperation(op));
-  op.set_type(DeltaArchiveManifest_InstallOperation_Type_MOVE);
+  op.set_type(InstallOperation::MOVE);
   EXPECT_TRUE(diff_utils::IsNoopOperation(op));
   *(op.add_src_extents()) = ExtentForRange(3, 2);
   *(op.add_dst_extents()) = ExtentForRange(3, 2);
@@ -513,7 +511,7 @@
 
 TEST_F(DeltaDiffUtilsTest, FilterNoopOperations) {
   AnnotatedOperation aop1;
-  aop1.op.set_type(DeltaArchiveManifest_InstallOperation_Type_REPLACE_BZ);
+  aop1.op.set_type(InstallOperation::REPLACE_BZ);
   *(aop1.op.add_dst_extents()) = ExtentForRange(3, 2);
   aop1.name = "aop1";
 
@@ -521,7 +519,7 @@
   aop2.name = "aop2";
 
   AnnotatedOperation noop;
-  noop.op.set_type(DeltaArchiveManifest_InstallOperation_Type_MOVE);
+  noop.op.set_type(InstallOperation::MOVE);
   *(noop.op.add_src_extents()) = ExtentForRange(3, 2);
   *(noop.op.add_dst_extents()) = ExtentForRange(3, 2);
   noop.name = "noop";
@@ -618,8 +616,7 @@
   for (size_t i = 0; i < aops_.size() && i < expected_op_extents.size(); ++i) {
     SCOPED_TRACE(base::StringPrintf("Failed on operation number %" PRIuS, i));
     const AnnotatedOperation& aop = aops_[i];
-    EXPECT_EQ(DeltaArchiveManifest_InstallOperation_Type_SOURCE_COPY,
-              aop.op.type());
+    EXPECT_EQ(InstallOperation::SOURCE_COPY, aop.op.type());
     EXPECT_EQ(1, aop.op.src_extents_size());
     EXPECT_EQ(expected_op_extents[i], aop.op.src_extents(0));
     EXPECT_EQ(1, aop.op.dst_extents_size());
@@ -655,8 +652,7 @@
   // rest of the partition.
   EXPECT_EQ(1, aops_.size());
   const AnnotatedOperation& aop = aops_[0];
-  EXPECT_EQ(DeltaArchiveManifest_InstallOperation_Type_SOURCE_COPY,
-            aop.op.type());
+  EXPECT_EQ(InstallOperation::SOURCE_COPY, aop.op.type());
   EXPECT_EQ(5, aop.op.src_extents_size());
   for (int i = 0; i < aop.op.src_extents_size(); ++i) {
     EXPECT_EQ(ExtentForRange(0, 10), aop.op.src_extents(i));
@@ -717,8 +713,7 @@
   for (size_t i = 0; i < aops_.size() && i < expected_op_extents.size(); ++i) {
     SCOPED_TRACE(base::StringPrintf("Failed on operation number %" PRIuS, i));
     const AnnotatedOperation& aop = aops_[i];
-    EXPECT_EQ(DeltaArchiveManifest_InstallOperation_Type_REPLACE_BZ,
-              aop.op.type());
+    EXPECT_EQ(InstallOperation::REPLACE_BZ, aop.op.type());
     EXPECT_EQ(0, aop.op.src_extents_size());
     EXPECT_EQ(1, aop.op.dst_extents_size());
     EXPECT_EQ(expected_op_extents[i], aop.op.dst_extents(0));
@@ -754,8 +749,7 @@
   // There should be only one SOURCE_COPY, with a complicate list of extents.
   EXPECT_EQ(1, aops_.size());
   const AnnotatedOperation& aop = aops_[0];
-  EXPECT_EQ(DeltaArchiveManifest_InstallOperation_Type_SOURCE_COPY,
-            aop.op.type());
+  EXPECT_EQ(InstallOperation::SOURCE_COPY, aop.op.type());
   vector<Extent> aop_src_extents;
   ExtentsToVector(aop.op.src_extents(), &aop_src_extents);
   EXPECT_EQ(perm_extents, aop_src_extents);
diff --git a/payload_generator/extent_utils_unittest.cc b/payload_generator/extent_utils_unittest.cc
index 188164d..3f66d3e 100644
--- a/payload_generator/extent_utils_unittest.cc
+++ b/payload_generator/extent_utils_unittest.cc
@@ -63,11 +63,11 @@
 }
 
 TEST(ExtentUtilsTest, ExtendExtentsTest) {
-  DeltaArchiveManifest_InstallOperation first_op;
+  InstallOperation first_op;
   *(first_op.add_src_extents()) = ExtentForRange(1, 1);
   *(first_op.add_src_extents()) = ExtentForRange(3, 1);
 
-  DeltaArchiveManifest_InstallOperation second_op;
+  InstallOperation second_op;
   *(second_op.add_src_extents()) = ExtentForRange(4, 2);
   *(second_op.add_src_extents()) = ExtentForRange(8, 2);
 
diff --git a/payload_generator/full_update_generator.cc b/payload_generator/full_update_generator.cc
index 9cf3cc1..00d7300 100644
--- a/payload_generator/full_update_generator.cc
+++ b/payload_generator/full_update_generator.cc
@@ -92,13 +92,12 @@
   TEST_AND_RETURN_FALSE(bytes_read == static_cast<ssize_t>(size_));
   TEST_AND_RETURN_FALSE(BzipCompress(buffer_in_, &op_blob));
 
-  DeltaArchiveManifest_InstallOperation_Type op_type =
-      DeltaArchiveManifest_InstallOperation_Type_REPLACE_BZ;
+  InstallOperation_Type op_type = InstallOperation::REPLACE_BZ;
 
   if (op_blob.size() >= buffer_in_.size()) {
     // A REPLACE is cheaper than a REPLACE_BZ in this case.
     op_blob = std::move(buffer_in_);
-    op_type = DeltaArchiveManifest_InstallOperation_Type_REPLACE;
+    op_type = InstallOperation::REPLACE;
   }
 
   off_t op_offset = blob_file_->StoreBlob(op_blob);
diff --git a/payload_generator/full_update_generator_unittest.cc b/payload_generator/full_update_generator_unittest.cc
index 28cbe36..8c47ef6 100644
--- a/payload_generator/full_update_generator_unittest.cc
+++ b/payload_generator/full_update_generator_unittest.cc
@@ -95,10 +95,8 @@
               rootfs_ops[i].op.dst_extents(0).start_block()) << "i = " << i;
     EXPECT_EQ(config_.hard_chunk_size / config_.block_size,
               rootfs_ops[i].op.dst_extents(0).num_blocks());
-    if (rootfs_ops[i].op.type() !=
-        DeltaArchiveManifest_InstallOperation_Type_REPLACE) {
-      EXPECT_EQ(DeltaArchiveManifest_InstallOperation_Type_REPLACE_BZ,
-                rootfs_ops[i].op.type());
+    if (rootfs_ops[i].op.type() != InstallOperation::REPLACE) {
+      EXPECT_EQ(InstallOperation::REPLACE_BZ, rootfs_ops[i].op.type());
     }
   }
 }
diff --git a/payload_generator/inplace_generator.cc b/payload_generator/inplace_generator.cc
index 47bb1a7..f2d8a11 100644
--- a/payload_generator/inplace_generator.cc
+++ b/payload_generator/inplace_generator.cc
@@ -156,8 +156,7 @@
                                                     cut_edge_properties));
 
     // Set src/dst extents and other proto variables for copy operation
-    graph->back().aop.op.set_type(
-        DeltaArchiveManifest_InstallOperation_Type_MOVE);
+    graph->back().aop.op.set_type(InstallOperation::MOVE);
     StoreExtents(cut_edge_properties.extents,
                  graph->back().aop.op.mutable_src_extents());
     StoreExtents(cuts.back().tmp_extents,
@@ -263,10 +262,9 @@
   vector<Vertex::Index> full_ops;
   ret.reserve(op_indexes->size());
   for (auto op_index : *op_indexes) {
-    DeltaArchiveManifest_InstallOperation_Type type =
-        (*graph)[op_index].aop.op.type();
-    if (type == DeltaArchiveManifest_InstallOperation_Type_REPLACE ||
-        type == DeltaArchiveManifest_InstallOperation_Type_REPLACE_BZ) {
+    InstallOperation_Type type = (*graph)[op_index].aop.op.type();
+    if (type == InstallOperation::REPLACE ||
+        type == InstallOperation::REPLACE_BZ) {
       full_ops.push_back(op_index);
     } else {
       ret.push_back(op_index);
@@ -451,8 +449,7 @@
     // Fix the new node w/ the real blocks. Since the new node is just a
     // copy operation, we can replace all the dest extents w/ the real
     // blocks.
-    DeltaArchiveManifest_InstallOperation *op =
-        &(*graph)[cut.new_vertex].aop.op;
+    InstallOperation* op = &(*graph)[cut.new_vertex].aop.op;
     op->clear_dst_extents();
     StoreExtents(real_extents, op->mutable_dst_extents());
   }
@@ -515,7 +512,7 @@
        ++it, ++idx) {
     if (!it->valid)
       continue;
-    const DeltaArchiveManifest_InstallOperation& op = it->aop.op;
+    const InstallOperation& op = it->aop.op;
     if (TempBlocksExistInExtents(op.dst_extents()) ||
         TempBlocksExistInExtents(op.src_extents())) {
       LOG(INFO) << "bad extents in node " << idx;
@@ -543,10 +540,8 @@
   // Drop all incoming edges, keep all outgoing edges
 
   // Keep all outgoing edges
-  if ((*graph)[cut.old_dst].aop.op.type() !=
-      DeltaArchiveManifest_InstallOperation_Type_REPLACE_BZ &&
-      (*graph)[cut.old_dst].aop.op.type() !=
-      DeltaArchiveManifest_InstallOperation_Type_REPLACE) {
+  if ((*graph)[cut.old_dst].aop.op.type() != InstallOperation::REPLACE_BZ &&
+      (*graph)[cut.old_dst].aop.op.type() != InstallOperation::REPLACE) {
     Vertex::EdgeMap out_edges = (*graph)[cut.old_dst].out_edges;
     graph_utils::DropWriteBeforeDeps(&out_edges);
 
@@ -648,8 +643,7 @@
                                          uint64_t num_blocks,
                                          Vertex* vertex) {
   vertex->aop.name = "<scratch>";
-  vertex->aop.op.set_type(
-      DeltaArchiveManifest_InstallOperation_Type_REPLACE_BZ);
+  vertex->aop.op.set_type(InstallOperation::REPLACE_BZ);
   vertex->aop.op.set_data_offset(0);
   vertex->aop.op.set_data_length(0);
   Extent* extent = vertex->aop.op.add_dst_extents();
@@ -658,7 +652,7 @@
 }
 
 bool InplaceGenerator::AddInstallOpToBlocksVector(
-    const DeltaArchiveManifest_InstallOperation& operation,
+    const InstallOperation& operation,
     const Graph& graph,
     Vertex::Index vertex,
     vector<Block>* blocks) {
@@ -695,12 +689,11 @@
   return true;
 }
 
-bool InplaceGenerator::AddInstallOpToGraph(
-    Graph* graph,
-    Vertex::Index existing_vertex,
-    vector<Block>* blocks,
-    const DeltaArchiveManifest_InstallOperation operation,
-    const string& op_name) {
+bool InplaceGenerator::AddInstallOpToGraph(Graph* graph,
+                                           Vertex::Index existing_vertex,
+                                           vector<Block>* blocks,
+                                           const InstallOperation operation,
+                                           const string& op_name) {
   Vertex::Index vertex = existing_vertex;
   if (vertex == Vertex::kInvalidIndex) {
     graph->emplace_back();
diff --git a/payload_generator/inplace_generator.h b/payload_generator/inplace_generator.h
index 591f042..70e868c 100644
--- a/payload_generator/inplace_generator.h
+++ b/payload_generator/inplace_generator.h
@@ -168,23 +168,21 @@
   // in |blocks| and set the reader/writer field to the vertex passed.
   // |graph| is not strictly necessary, but useful for printing out
   // error messages.
-  static bool AddInstallOpToBlocksVector(
-      const DeltaArchiveManifest_InstallOperation& operation,
-      const Graph& graph,
-      Vertex::Index vertex,
-      std::vector<Block>* blocks);
+  static bool AddInstallOpToBlocksVector(const InstallOperation& operation,
+                                         const Graph& graph,
+                                         Vertex::Index vertex,
+                                         std::vector<Block>* blocks);
 
   // Add a vertex (if |existing_vertex| is kInvalidVertex) or update an
   // |existing_vertex| with the passed |operation|.
   // This method will also register the vertex as the reader or writer of the
   // blocks involved in the operation updating the |blocks| vector. The
   // |op_name| associated with the Vertex is used for logging purposes.
-  static bool AddInstallOpToGraph(
-      Graph* graph,
-      Vertex::Index existing_vertex,
-      std::vector<Block>* blocks,
-      const DeltaArchiveManifest_InstallOperation operation,
-      const std::string& op_name);
+  static bool AddInstallOpToGraph(Graph* graph,
+                                  Vertex::Index existing_vertex,
+                                  std::vector<Block>* blocks,
+                                  const InstallOperation operation,
+                                  const std::string& op_name);
 
   // Apply the transformation stored in |the_map| to the |collection| vector
   // replacing the map keys found in |collection| with its associated value in
diff --git a/payload_generator/inplace_generator_unittest.cc b/payload_generator/inplace_generator_unittest.cc
index 59e2f77..d938d0d 100644
--- a/payload_generator/inplace_generator_unittest.cc
+++ b/payload_generator/inplace_generator_unittest.cc
@@ -37,16 +37,11 @@
 
 namespace {
 
-#define OP_BSDIFF DeltaArchiveManifest_InstallOperation_Type_BSDIFF
-#define OP_MOVE DeltaArchiveManifest_InstallOperation_Type_MOVE
-#define OP_REPLACE DeltaArchiveManifest_InstallOperation_Type_REPLACE
-#define OP_REPLACE_BZ DeltaArchiveManifest_InstallOperation_Type_REPLACE_BZ
-
 void GenVertex(Vertex* out,
                const vector<Extent>& src_extents,
                const vector<Extent>& dst_extents,
                const string& path,
-               DeltaArchiveManifest_InstallOperation_Type type) {
+               InstallOperation_Type type) {
   out->aop.op.set_type(type);
   out->aop.name = path;
   StoreExtents(src_extents, out->aop.op.mutable_src_extents());
@@ -85,9 +80,7 @@
   vect->back().set_num_blocks(length);
 }
 
-void OpAppendExtent(DeltaArchiveManifest_InstallOperation* op,
-                    uint64_t start,
-                    uint64_t length) {
+void OpAppendExtent(InstallOperation* op, uint64_t start, uint64_t length) {
   Extent* extent = op->add_src_extents();
   extent->set_start_block(start);
   extent->set_num_blocks(length);
@@ -139,7 +132,7 @@
   AppendExtent(&replace_blocks, 10, 2);
   AppendExtent(&replace_blocks, 13, 2);
   Vertex vertex;
-  DeltaArchiveManifest_InstallOperation& op = vertex.aop.op;
+  InstallOperation& op = vertex.aop.op;
   OpAppendExtent(&op, 4, 3);
   OpAppendExtent(&op, kSparseHole, 4);  // Sparse hole in file
   OpAppendExtent(&op, 3, 1);
@@ -171,7 +164,7 @@
   // Create nodes in graph
   {
     graph.resize(graph.size() + 1);
-    graph.back().aop.op.set_type(OP_MOVE);
+    graph.back().aop.op.set_type(InstallOperation::MOVE);
     // Reads from blocks 3, 5, 7
     vector<Extent> extents;
     AppendBlockToExtents(&extents, 3);
@@ -194,7 +187,7 @@
   }
   {
     graph.resize(graph.size() + 1);
-    graph.back().aop.op.set_type(OP_MOVE);
+    graph.back().aop.op.set_type(InstallOperation::MOVE);
     // Reads from blocks 1, 2, 4
     vector<Extent> extents;
     AppendBlockToExtents(&extents, 1);
@@ -234,7 +227,7 @@
   EXPECT_EQ(3, graph.size());
 
   // Check new node in graph:
-  EXPECT_EQ(OP_MOVE, graph.back().aop.op.type());
+  EXPECT_EQ(InstallOperation::MOVE, graph.back().aop.op.type());
   EXPECT_EQ(2, graph.back().aop.op.src_extents_size());
   EXPECT_EQ(1, graph.back().aop.op.dst_extents_size());
   EXPECT_EQ(kTempBlockStart, graph.back().aop.op.dst_extents(0).start_block());
@@ -290,9 +283,18 @@
   cuts.resize(3);
 
   // Simple broken loop:
-  GenVertex(&graph[0], VectOfExt(0, 1), VectOfExt(1, 1), "", OP_MOVE);
-  GenVertex(&graph[1], VectOfExt(tmp, 1), VectOfExt(0, 1), "", OP_MOVE);
-  GenVertex(&graph[2], VectOfExt(1, 1), VectOfExt(tmp, 1), "", OP_MOVE);
+  GenVertex(
+      &graph[0], VectOfExt(0, 1), VectOfExt(1, 1), "", InstallOperation::MOVE);
+  GenVertex(&graph[1],
+            VectOfExt(tmp, 1),
+            VectOfExt(0, 1),
+            "",
+            InstallOperation::MOVE);
+  GenVertex(&graph[2],
+            VectOfExt(1, 1),
+            VectOfExt(tmp, 1),
+            "",
+            InstallOperation::MOVE);
   // Corresponding edges:
   graph[0].out_edges[2] = EdgeWithReadDep(VectOfExt(1, 1));
   graph[1].out_edges[2] = EdgeWithWriteDep(VectOfExt(tmp, 1));
@@ -305,11 +307,25 @@
   tmp++;
 
   // Slightly more complex pair of loops:
-  GenVertex(&graph[3], VectOfExt(4, 2), VectOfExt(2, 2), "", OP_MOVE);
-  GenVertex(&graph[4], VectOfExt(6, 1), VectOfExt(7, 1), "", OP_MOVE);
-  GenVertex(&graph[5], VectOfExt(tmp, 3), VectOfExt(4, 3), kFilename, OP_MOVE);
-  GenVertex(&graph[6], VectOfExt(2, 2), VectOfExt(tmp, 2), "", OP_MOVE);
-  GenVertex(&graph[7], VectOfExt(7, 1), VectOfExt(tmp + 2, 1), "", OP_MOVE);
+  GenVertex(
+      &graph[3], VectOfExt(4, 2), VectOfExt(2, 2), "", InstallOperation::MOVE);
+  GenVertex(
+      &graph[4], VectOfExt(6, 1), VectOfExt(7, 1), "", InstallOperation::MOVE);
+  GenVertex(&graph[5],
+            VectOfExt(tmp, 3),
+            VectOfExt(4, 3),
+            kFilename,
+            InstallOperation::MOVE);
+  GenVertex(&graph[6],
+            VectOfExt(2, 2),
+            VectOfExt(tmp, 2),
+            "",
+            InstallOperation::MOVE);
+  GenVertex(&graph[7],
+            VectOfExt(7, 1),
+            VectOfExt(tmp + 2, 1),
+            "",
+            InstallOperation::MOVE);
   // Corresponding edges:
   graph[3].out_edges[6] = EdgeWithReadDep(VectOfExt(2, 2));
   graph[4].out_edges[7] = EdgeWithReadDep(VectOfExt(7, 1));
@@ -328,7 +344,7 @@
   cuts[2].tmp_extents = VectOfExt(tmp + 2, 1);
 
   // Supplier of temp block:
-  GenVertex(&graph[8], empt, VectOfExt(8, 1), "", OP_REPLACE);
+  GenVertex(&graph[8], empt, VectOfExt(8, 1), "", InstallOperation::REPLACE);
 
   // Specify the final order:
   vector<Vertex::Index> op_indexes;
@@ -358,19 +374,19 @@
   EXPECT_EQ(1, graph[1].aop.op.src_extents_size());
   EXPECT_EQ(2, graph[1].aop.op.src_extents(0).start_block());
   EXPECT_EQ(1, graph[1].aop.op.src_extents(0).num_blocks());
-  EXPECT_EQ(OP_REPLACE_BZ, graph[5].aop.op.type());
+  EXPECT_EQ(InstallOperation::REPLACE_BZ, graph[5].aop.op.type());
 }
 
 TEST_F(InplaceGeneratorTest, MoveAndSortFullOpsToBackTest) {
   Graph graph(4);
   graph[0].aop.name = "A";
-  graph[0].aop.op.set_type(OP_REPLACE);
+  graph[0].aop.op.set_type(InstallOperation::REPLACE);
   graph[1].aop.name = "B";
-  graph[1].aop.op.set_type(OP_BSDIFF);
+  graph[1].aop.op.set_type(InstallOperation::BSDIFF);
   graph[2].aop.name = "C";
-  graph[2].aop.op.set_type(OP_REPLACE_BZ);
+  graph[2].aop.op.set_type(InstallOperation::REPLACE_BZ);
   graph[3].aop.name = "D";
-  graph[3].aop.op.set_type(OP_MOVE);
+  graph[3].aop.op.set_type(InstallOperation::MOVE);
 
   vector<Vertex::Index> vect(graph.size());
 
@@ -391,20 +407,36 @@
   const string kFilename = "/foo";
 
   // Some scratch space:
-  GenVertex(&graph[0], empt, VectOfExt(200, 1), "", OP_REPLACE);
-  GenVertex(&graph[1], empt, VectOfExt(210, 10), "", OP_REPLACE);
-  GenVertex(&graph[2], empt, VectOfExt(220, 1), "", OP_REPLACE);
+  GenVertex(&graph[0], empt, VectOfExt(200, 1), "", InstallOperation::REPLACE);
+  GenVertex(&graph[1], empt, VectOfExt(210, 10), "", InstallOperation::REPLACE);
+  GenVertex(&graph[2], empt, VectOfExt(220, 1), "", InstallOperation::REPLACE);
 
   // A cycle that requires 10 blocks to break:
-  GenVertex(&graph[3], VectOfExt(10, 11), VectOfExt(0, 9), "", OP_BSDIFF);
+  GenVertex(&graph[3],
+            VectOfExt(10, 11),
+            VectOfExt(0, 9),
+            "",
+            InstallOperation::BSDIFF);
   graph[3].out_edges[4] = EdgeWithReadDep(VectOfExt(0, 9));
-  GenVertex(&graph[4], VectOfExt(0, 9), VectOfExt(10, 11), "", OP_BSDIFF);
+  GenVertex(&graph[4],
+            VectOfExt(0, 9),
+            VectOfExt(10, 11),
+            "",
+            InstallOperation::BSDIFF);
   graph[4].out_edges[3] = EdgeWithReadDep(VectOfExt(10, 11));
 
   // A cycle that requires 9 blocks to break:
-  GenVertex(&graph[5], VectOfExt(40, 11), VectOfExt(30, 10), "", OP_BSDIFF);
+  GenVertex(&graph[5],
+            VectOfExt(40, 11),
+            VectOfExt(30, 10),
+            "",
+            InstallOperation::BSDIFF);
   graph[5].out_edges[6] = EdgeWithReadDep(VectOfExt(30, 10));
-  GenVertex(&graph[6], VectOfExt(30, 10), VectOfExt(40, 11), "", OP_BSDIFF);
+  GenVertex(&graph[6],
+            VectOfExt(30, 10),
+            VectOfExt(40, 11),
+            "",
+            InstallOperation::BSDIFF);
   graph[6].out_edges[5] = EdgeWithReadDep(VectOfExt(40, 11));
 
   // A cycle that requires 40 blocks to break (which is too many):
@@ -412,13 +444,13 @@
             VectOfExt(120, 50),
             VectOfExt(60, 40),
             "",
-            OP_BSDIFF);
+            InstallOperation::BSDIFF);
   graph[7].out_edges[8] = EdgeWithReadDep(VectOfExt(60, 40));
   GenVertex(&graph[8],
             VectOfExt(60, 40),
             VectOfExt(120, 50),
             kFilename,
-            OP_BSDIFF);
+            InstallOperation::BSDIFF);
   graph[8].out_edges[7] = EdgeWithReadDep(VectOfExt(120, 50));
 
   graph_utils::DumpGraph(graph);
@@ -433,34 +465,46 @@
                                                   Vertex::kInvalidIndex));
 
   Graph expected_graph(12);
-  GenVertex(&expected_graph[0], empt, VectOfExt(200, 1), "", OP_REPLACE);
-  GenVertex(&expected_graph[1], empt, VectOfExt(210, 10), "", OP_REPLACE);
-  GenVertex(&expected_graph[2], empt, VectOfExt(220, 1), "", OP_REPLACE);
+  GenVertex(&expected_graph[0],
+            empt,
+            VectOfExt(200, 1),
+            "",
+            InstallOperation::REPLACE);
+  GenVertex(&expected_graph[1],
+            empt,
+            VectOfExt(210, 10),
+            "",
+            InstallOperation::REPLACE);
+  GenVertex(&expected_graph[2],
+            empt,
+            VectOfExt(220, 1),
+            "",
+            InstallOperation::REPLACE);
   GenVertex(&expected_graph[3],
             VectOfExt(10, 11),
             VectOfExt(0, 9),
             "",
-            OP_BSDIFF);
+            InstallOperation::BSDIFF);
   expected_graph[3].out_edges[9] = EdgeWithReadDep(VectOfExt(0, 9));
   GenVertex(&expected_graph[4],
             VectOfExt(60, 9),
             VectOfExt(10, 11),
             "",
-            OP_BSDIFF);
+            InstallOperation::BSDIFF);
   expected_graph[4].out_edges[3] = EdgeWithReadDep(VectOfExt(10, 11));
   expected_graph[4].out_edges[9] = EdgeWithWriteDep(VectOfExt(60, 9));
   GenVertex(&expected_graph[5],
             VectOfExt(40, 11),
             VectOfExt(30, 10),
             "",
-            OP_BSDIFF);
+            InstallOperation::BSDIFF);
   expected_graph[5].out_edges[10] = EdgeWithReadDep(VectOfExt(30, 10));
 
   GenVertex(&expected_graph[6],
             VectOfExt(60, 10),
             VectOfExt(40, 11),
             "",
-            OP_BSDIFF);
+            InstallOperation::BSDIFF);
   expected_graph[6].out_edges[5] = EdgeWithReadDep(VectOfExt(40, 11));
   expected_graph[6].out_edges[10] = EdgeWithWriteDep(VectOfExt(60, 10));
 
@@ -468,23 +512,27 @@
             VectOfExt(120, 50),
             VectOfExt(60, 40),
             "",
-            OP_BSDIFF);
+            InstallOperation::BSDIFF);
   expected_graph[7].out_edges[6] = EdgeWithReadDep(VectOfExt(60, 10));
 
-  GenVertex(&expected_graph[8], empt, VectOfExt(0, 50), "/foo", OP_REPLACE_BZ);
+  GenVertex(&expected_graph[8],
+            empt,
+            VectOfExt(0, 50),
+            "/foo",
+            InstallOperation::REPLACE_BZ);
   expected_graph[8].out_edges[7] = EdgeWithReadDep(VectOfExt(120, 50));
 
   GenVertex(&expected_graph[9],
             VectOfExt(0, 9),
             VectOfExt(60, 9),
             "",
-            OP_MOVE);
+            InstallOperation::MOVE);
 
   GenVertex(&expected_graph[10],
             VectOfExt(30, 10),
             VectOfExt(60, 10),
             "",
-            OP_MOVE);
+            InstallOperation::MOVE);
   expected_graph[10].out_edges[4] = EdgeWithReadDep(VectOfExt(60, 9));
 
   EXPECT_EQ(12, graph.size());
@@ -502,7 +550,7 @@
 TEST_F(InplaceGeneratorTest, CreateScratchNodeTest) {
   Vertex vertex;
   InplaceGenerator::CreateScratchNode(12, 34, &vertex);
-  EXPECT_EQ(OP_REPLACE_BZ, vertex.aop.op.type());
+  EXPECT_EQ(InstallOperation::REPLACE_BZ, vertex.aop.op.type());
   EXPECT_EQ(0, vertex.aop.op.data_offset());
   EXPECT_EQ(0, vertex.aop.op.data_length());
   EXPECT_EQ(1, vertex.aop.op.dst_extents_size());
@@ -535,14 +583,13 @@
   // the only available block is 0.
   aops.emplace_back();
   aops.back().name = base::StringPrintf("<bz-block-0>");
-  aops.back().op.set_type(
-      OP_REPLACE_BZ);
+  aops.back().op.set_type(InstallOperation::REPLACE_BZ);
   StoreExtents({ExtentForRange(0, 1)}, aops.back().op.mutable_dst_extents());
 
   for (size_t i = 1; i < num_blocks; i++) {
     AnnotatedOperation aop;
     aop.name = base::StringPrintf("<op-%" PRIuS ">", i);
-    aop.op.set_type(OP_BSDIFF);
+    aop.op.set_type(InstallOperation::BSDIFF);
     StoreExtents({ExtentForRange(1 + i % (num_blocks - 1), 1)},
                  aop.op.mutable_src_extents());
     StoreExtents({ExtentForRange(i, 1)}, aop.op.mutable_dst_extents());
@@ -568,10 +615,12 @@
 
     size_t full_ops = 0;
     for (const auto& aop : result_aops) {
-      if (aop.op.type() == OP_REPLACE || aop.op.type() == OP_REPLACE_BZ)
+      if (aop.op.type() == InstallOperation::REPLACE ||
+          aop.op.type() == InstallOperation::REPLACE_BZ) {
         full_ops++;
+      }
 
-      if (aop.op.type() != OP_MOVE)
+      if (aop.op.type() != InstallOperation::MOVE)
         continue;
       for (const Extent& extent : aop.op.src_extents()) {
         EXPECT_NE(0, extent.start_block()) << "On src extents for aop: " << aop;
diff --git a/payload_generator/payload_file.cc b/payload_generator/payload_file.cc
index fe453a2..92fe724 100644
--- a/payload_generator/payload_file.cc
+++ b/payload_generator/payload_file.cc
@@ -128,11 +128,10 @@
   {
     for (int i = 0; i < (manifest_.install_operations_size() +
                          manifest_.kernel_install_operations_size()); i++) {
-      DeltaArchiveManifest_InstallOperation* op =
-          i < manifest_.install_operations_size() ?
-          manifest_.mutable_install_operations(i) :
-          manifest_.mutable_kernel_install_operations(
-              i - manifest_.install_operations_size());
+      InstallOperation* op = i < manifest_.install_operations_size()
+                                 ? manifest_.mutable_install_operations(i)
+                                 : manifest_.mutable_kernel_install_operations(
+                                       i - manifest_.install_operations_size());
       if (op->has_data_offset()) {
         if (op->data_offset() != next_blob_offset) {
           LOG(FATAL) << "bad blob offset! " << op->data_offset() << " != "
@@ -249,9 +248,8 @@
   return true;
 }
 
-bool PayloadFile::AddOperationHash(
-    DeltaArchiveManifest_InstallOperation* op,
-    const chromeos::Blob& buf) {
+bool PayloadFile::AddOperationHash(InstallOperation* op,
+                                   const chromeos::Blob& buf) {
   OmahaHashCalculator hasher;
   TEST_AND_RETURN_FALSE(hasher.Update(buf.data(), buf.size()));
   TEST_AND_RETURN_FALSE(hasher.Finalize());
@@ -302,9 +300,8 @@
   manifest->set_signatures_offset(signature_blob_offset);
   LOG(INFO) << "set? " << manifest->has_signatures_offset();
   // Add a dummy op at the end to appease older clients
-  DeltaArchiveManifest_InstallOperation* dummy_op =
-      manifest->add_kernel_install_operations();
-  dummy_op->set_type(DeltaArchiveManifest_InstallOperation_Type_REPLACE);
+  InstallOperation* dummy_op = manifest->add_kernel_install_operations();
+  dummy_op->set_type(InstallOperation::REPLACE);
   dummy_op->set_data_offset(signature_blob_offset);
   manifest->set_signatures_offset(signature_blob_offset);
   dummy_op->set_data_length(signature_blob_length);
diff --git a/payload_generator/payload_file.h b/payload_generator/payload_file.h
index 150b0b0..a8f815b 100644
--- a/payload_generator/payload_file.h
+++ b/payload_generator/payload_file.h
@@ -50,8 +50,7 @@
   // dummy operation for signature blob because the contents of the signature
   // blob will not be available at payload creation time. So, update_engine will
   // gracefully ignore the dummy signature operation.
-  static bool AddOperationHash(DeltaArchiveManifest_InstallOperation* op,
-                               const chromeos::Blob& buf);
+  static bool AddOperationHash(InstallOperation* op, const chromeos::Blob& buf);
 
   // Install operations in the manifest may reference data blobs, which
   // are in data_blobs_path. This function creates a new data blobs file