update_engine: update to libbase 242728

Made update_engine link with libchrome-242728 and fixed compile
issues due to changes in namespaces and include file layout.

Also removed some of suppressed compiler warnings and fixed the
issues masked by them (e.g. mismatched printf-like specifiers).

Added -Wextra compiler option to enable additional useful warnings
to ensure more strict checking... Had to disable "unused-parameter"
though since we have a lot of functions (mainly in fakes) that do
not use all of their parameters.

BUG=chromium:351593
TEST=Unit tests passed.
CQ-DEPEND=CL:191721

Change-Id: I1aa63a48d5f1f4ea75ba6b00aec7aa5f3bad15c4
Reviewed-on: https://chromium-review.googlesource.com/191510
Reviewed-by: Alex Vakulenko <avakulenko@chromium.org>
Commit-Queue: Alex Vakulenko <avakulenko@chromium.org>
Tested-by: Alex Vakulenko <avakulenko@chromium.org>
diff --git a/SConstruct b/SConstruct
index 621c6a5..7c0b2a8 100644
--- a/SConstruct
+++ b/SConstruct
@@ -138,23 +138,17 @@
                              -fno-strict-aliasing
                              -std=gnu++11
                              -Wall
-                             -Wclobbered
-                             -Wempty-body
+                             -Wextra
                              -Werror
-                             -Wignored-qualifiers
-                             -Wmissing-field-initializers
+                             -Wno-unused-parameter
                              -Wno-deprecated-register
-                             -Wno-format
-                             -Wsign-compare
-                             -Wtype-limits
-                             -Wuninitialized
                              -D__STDC_FORMAT_MACROS=1
                              -D_FILE_OFFSET_BITS=64
                              -D_POSIX_C_SOURCE=199309L
                              -I/usr/include/libxml2""".split());
 env['CCFLAGS'] += (' ' + ' '.join(env['CFLAGS']))
 
-BASE_VER = os.environ.get('BASE_VER', '180609')
+BASE_VER = os.environ.get('BASE_VER', '242728')
 env['LIBS'] = Split("""bz2
                        crypto
                        curl
diff --git a/certificate_checker.cc b/certificate_checker.cc
index 75bd6be..4992fda 100644
--- a/certificate_checker.cc
+++ b/certificate_checker.cc
@@ -6,9 +6,9 @@
 
 #include <string>
 
-#include <base/string_number_conversions.h>
-#include <base/string_util.h>
-#include <base/stringprintf.h>
+#include <base/strings/string_number_conversions.h>
+#include <base/strings/string_util.h>
+#include <base/strings/stringprintf.h>
 #include <base/logging.h>
 #include <curl/curl.h>
 #include <metrics/metrics_library.h>
@@ -134,10 +134,10 @@
   // prefs.
   string digest_string = base::HexEncode(digest, digest_length);
 
-  string storage_key = StringPrintf("%s-%d-%d",
-                                    kPrefsUpdateServerCertificate,
-                                    server_to_check,
-                                    depth);
+  string storage_key = base::StringPrintf("%s-%d-%d",
+                                          kPrefsUpdateServerCertificate,
+                                          server_to_check,
+                                          depth);
   string stored_digest;
   // If there's no stored certificate, we just store the current one and return.
   if (!system_state_->prefs()->GetString(storage_key, &stored_digest)) {
diff --git a/certificate_checker_unittest.cc b/certificate_checker_unittest.cc
index eb7067f..f41bc93 100644
--- a/certificate_checker_unittest.cc
+++ b/certificate_checker_unittest.cc
@@ -4,8 +4,8 @@
 
 #include <string>
 
-#include <base/string_util.h>
-#include <base/stringprintf.h>
+#include <base/strings/string_util.h>
+#include <base/strings/stringprintf.h>
 #include <gmock/gmock.h>
 #include <gtest/gtest.h>
 #include <metrics/metrics_library_mock.h>
@@ -41,10 +41,10 @@
     diff_digest_hex_ = "1234ABCD";
     cert_key_prefix_ = kPrefsUpdateServerCertificate;
     server_to_check_ = CertificateChecker::kUpdate;
-    cert_key_ = StringPrintf("%s-%d-%d",
-                             cert_key_prefix_.c_str(),
-                             server_to_check_,
-                             depth_);
+    cert_key_ = base::StringPrintf("%s-%d-%d",
+                                   cert_key_prefix_.c_str(),
+                                   server_to_check_,
+                                   depth_);
     kCertChanged = "Updater.ServerCertificateChanged";
     kCertFailed = "Updater.ServerCertificateFailed";
     CertificateChecker::set_system_state(&mock_system_state_);
diff --git a/chrome_browser_proxy_resolver.cc b/chrome_browser_proxy_resolver.cc
index e5e2fff..e0ab0df 100644
--- a/chrome_browser_proxy_resolver.cc
+++ b/chrome_browser_proxy_resolver.cc
@@ -7,7 +7,7 @@
 #include <map>
 #include <string>
 
-#include <base/string_util.h>
+#include <base/strings/string_util.h>
 #include <base/strings/string_tokenizer.h>
 #include <dbus/dbus-glib.h>
 #include <dbus/dbus-glib-lowlevel.h>
diff --git a/clock_interface.h b/clock_interface.h
index cd714b1..5ee8161 100644
--- a/clock_interface.h
+++ b/clock_interface.h
@@ -7,7 +7,7 @@
 
 #include <string>
 
-#include <base/time.h>
+#include <base/time/time.h>
 
 namespace chromeos_update_engine {
 
diff --git a/connection_manager.cc b/connection_manager.cc
index 8ac1079..88cbe57 100644
--- a/connection_manager.cc
+++ b/connection_manager.cc
@@ -7,7 +7,7 @@
 #include <string>
 
 #include <base/stl_util.h>
-#include <base/string_util.h>
+#include <base/strings/string_util.h>
 #include <chromeos/dbus/service_constants.h>
 #include <dbus/dbus-glib.h>
 #include <glib.h>
diff --git a/cycle_breaker.cc b/cycle_breaker.cc
index f1a2728..54fa51c 100644
--- a/cycle_breaker.cc
+++ b/cycle_breaker.cc
@@ -6,8 +6,8 @@
 #include <inttypes.h>
 #include <set>
 #include <utility>
-#include "base/string_util.h"
-#include <base/stringprintf.h>
+#include <base/strings/string_util.h>
+#include <base/strings/stringprintf.h>
 #include "update_engine/graph_utils.h"
 #include "update_engine/tarjan.h"
 #include "update_engine/utils.h"
@@ -149,8 +149,8 @@
       std::string stack_str;
       for (vector<Vertex::Index>::const_iterator it = stack_.begin();
            it != stack_.end(); ++it) {
-        stack_str += StringPrintf("%lu -> ",
-                                  static_cast<long unsigned int>(*it));
+        stack_str += base::StringPrintf("%lu -> ",
+                                        static_cast<long unsigned int>(*it));
       }
       LOG(INFO) << "stack: " << stack_str;
     }
diff --git a/delta_diff_generator.cc b/delta_diff_generator.cc
index ef7fdee..1ebf6bb 100644
--- a/delta_diff_generator.cc
+++ b/delta_diff_generator.cc
@@ -17,13 +17,13 @@
 #include <utility>
 #include <vector>
 
-#include <base/file_path.h>
+#include <base/files/file_path.h>
 #include <base/file_util.h>
 #include <base/logging.h>
 #include <base/memory/scoped_ptr.h>
-#include <base/string_number_conversions.h>
-#include <base/string_util.h>
-#include <base/stringprintf.h>
+#include <base/strings/string_number_conversions.h>
+#include <base/strings/string_util.h>
+#include <base/strings/stringprintf.h>
 #include <bzlib.h>
 
 #include "update_engine/bzip.h"
@@ -531,7 +531,8 @@
   for (int i = 0; i < manifest.kernel_install_operations_size(); ++i) {
     const DeltaArchiveManifest_InstallOperation& op =
         manifest.kernel_install_operations(i);
-    objects.push_back(DeltaObject(StringPrintf("<kernel-operation-%d>", i),
+    objects.push_back(DeltaObject(base::StringPrintf("<kernel-operation-%d>",
+                                                     i),
                                   op.type(),
                                   op.data_length()));
     total_size += op.data_length();
@@ -544,17 +545,18 @@
 
   std::sort(objects.begin(), objects.end());
 
-  static const char kFormatString[] = "%6.2f%% %10llu %-10s %s\n";
+  static const char kFormatString[] = "%6.2f%% %10jd %-10s %s\n";
   for (vector<DeltaObject>::const_iterator it = objects.begin();
        it != objects.end(); ++it) {
     const DeltaObject& object = *it;
     fprintf(stderr, kFormatString,
             object.size * 100.0 / total_size,
-            object.size,
+            static_cast<intmax_t>(object.size),
             object.type >= 0 ? kInstallOperationTypes[object.type] : "-",
             object.name.c_str());
   }
-  fprintf(stderr, kFormatString, 100.0, total_size, "", "<total>");
+  fprintf(stderr, kFormatString,
+          100.0, static_cast<intmax_t>(total_size), "", "<total>");
 }
 
 // Process a range of blocks from |range_start| to |range_end| in the extent at
@@ -716,14 +718,14 @@
     } else if (!old_data.empty() && bsdiff_allowed) {
       // If the source file is considered bsdiff safe (no bsdiff bugs
       // triggered), see if BSDIFF encoding is smaller.
-      FilePath old_chunk;
-      TEST_AND_RETURN_FALSE(file_util::CreateTemporaryFile(&old_chunk));
+      base::FilePath old_chunk;
+      TEST_AND_RETURN_FALSE(base::CreateTemporaryFile(&old_chunk));
       ScopedPathUnlinker old_unlinker(old_chunk.value());
       TEST_AND_RETURN_FALSE(
           utils::WriteFile(old_chunk.value().c_str(),
                            &old_data[0], old_data.size()));
-      FilePath new_chunk;
-      TEST_AND_RETURN_FALSE(file_util::CreateTemporaryFile(&new_chunk));
+      base::FilePath new_chunk;
+      TEST_AND_RETURN_FALSE(base::CreateTemporaryFile(&new_chunk));
       ScopedPathUnlinker new_unlinker(new_chunk.value());
       TEST_AND_RETURN_FALSE(
           utils::WriteFile(new_chunk.value().c_str(),
diff --git a/delta_diff_generator_unittest.cc b/delta_diff_generator_unittest.cc
index 65ca23f..c5c0fe6 100644
--- a/delta_diff_generator_unittest.cc
+++ b/delta_diff_generator_unittest.cc
@@ -15,7 +15,7 @@
 #include <vector>
 
 #include <base/logging.h>
-#include <base/string_util.h>
+#include <base/strings/string_util.h>
 #include <gtest/gtest.h>
 
 #include "update_engine/cycle_breaker.h"
diff --git a/delta_performer.cc b/delta_performer.cc
index ba8a1bf..89c319d 100644
--- a/delta_performer.cc
+++ b/delta_performer.cc
@@ -14,8 +14,9 @@
 
 #include <base/file_util.h>
 #include <base/memory/scoped_ptr.h>
-#include <base/string_util.h>
-#include <base/stringprintf.h>
+#include <base/strings/string_util.h>
+#include <base/strings/stringprintf.h>
+#include <base/format_macros.h>
 #include <google/protobuf/repeated_field.h>
 
 #include "update_engine/bzip_extent_writer.h"
@@ -87,10 +88,10 @@
   string total_operations_str("?");
   string completed_percentage_str("");
   if (num_total_operations_) {
-    total_operations_str = StringPrintf("%zu", num_total_operations_);
+    total_operations_str = base::StringPrintf("%zu", num_total_operations_);
     // Upcasting to 64-bit to avoid overflow, back to size_t for formatting.
     completed_percentage_str =
-        StringPrintf(" (%llu%%)",
+        base::StringPrintf(" (%" PRIu64 "%%)",
                      IntRatio(next_operation_num_, num_total_operations_,
                               100));
   }
@@ -100,10 +101,10 @@
   string payload_size_str("?");
   string downloaded_percentage_str("");
   if (payload_size) {
-    payload_size_str = StringPrintf("%zu", payload_size);
+    payload_size_str = base::StringPrintf("%zu", payload_size);
     // Upcasting to 64-bit to avoid overflow, back to size_t for formatting.
     downloaded_percentage_str =
-        StringPrintf(" (%llu%%)",
+        base::StringPrintf(" (%" PRIu64 "%%)",
                      IntRatio(total_bytes_received_, payload_size, 100));
   }
 
@@ -712,7 +713,7 @@
       start = -1;
     else
       start *= block_size;
-    ret += StringPrintf("%" PRIi64 ":%" PRIu64 ",", start, this_length);
+    ret += base::StringPrintf("%" PRIi64 ":%" PRIu64 ",", start, this_length);
     length += this_length;
   }
   TEST_AND_RETURN_FALSE(length == full_length);
@@ -758,7 +759,7 @@
   DiscardBuffer(true);
 
   int fd = is_kernel_partition ? kernel_fd_ : fd_;
-  const string path = StringPrintf("/proc/self/fd/%d", fd);
+  const string path = base::StringPrintf("/proc/self/fd/%d", fd);
 
   // If this is a non-idempotent operation, request a delayed exit and clear the
   // update state in case the operation gets interrupted. Do this as late as
diff --git a/delta_performer.h b/delta_performer.h
index a95e4e1..4338646 100644
--- a/delta_performer.h
+++ b/delta_performer.h
@@ -9,7 +9,7 @@
 
 #include <vector>
 
-#include <base/time.h>
+#include <base/time/time.h>
 #include <google/protobuf/repeated_field.h>
 #include <gtest/gtest_prod.h>  // for FRIEND_TEST
 
diff --git a/delta_performer_unittest.cc b/delta_performer_unittest.cc
index c0ec25d..f221fc0 100644
--- a/delta_performer_unittest.cc
+++ b/delta_performer_unittest.cc
@@ -11,8 +11,8 @@
 
 #include <base/file_util.h>
 #include <base/memory/scoped_ptr.h>
-#include <base/string_util.h>
-#include <base/stringprintf.h>
+#include <base/strings/string_util.h>
+#include <base/strings/stringprintf.h>
 #include <google/protobuf/repeated_field.h>
 #include <gtest/gtest.h>
 
@@ -192,9 +192,8 @@
   if (signature_test == kSignatureGeneratedShellBadKey) {
     LOG(INFO) << "Generating a mismatched private key.";
     ASSERT_EQ(0,
-              System(StringPrintf(
-                  "openssl genrsa -out %s 2048",
-                  private_key_path.c_str())));
+              System(base::StringPrintf("openssl genrsa -out %s 2048",
+                                        private_key_path.c_str())));
   }
   int signature_size = GetSignatureSize(private_key_path);
   string hash_file;
@@ -203,12 +202,12 @@
   string signature_size_string;
   if (signature_test == kSignatureGeneratedShellRotateCl1 ||
       signature_test == kSignatureGeneratedShellRotateCl2)
-    signature_size_string = StringPrintf("%d:%d",
-                                         signature_size, signature_size);
+    signature_size_string = base::StringPrintf("%d:%d",
+                                               signature_size, signature_size);
   else
-    signature_size_string = StringPrintf("%d", signature_size);
+    signature_size_string = base::StringPrintf("%d", signature_size);
   ASSERT_EQ(0,
-            System(StringPrintf(
+            System(base::StringPrintf(
                 "./delta_generator -in_file %s -signature_size %s "
                 "-out_hash_file %s",
                 payload_path.c_str(),
@@ -225,7 +224,7 @@
   ASSERT_TRUE(utils::MakeTempFile("signature.XXXXXX", &sig_file, NULL));
   ScopedPathUnlinker sig_unlinker(sig_file);
   ASSERT_EQ(0,
-            System(StringPrintf(
+            System(base::StringPrintf(
                 "openssl rsautl -raw -sign -inkey %s -in %s -out %s",
                 private_key_path.c_str(),
                 hash_file.c_str(),
@@ -236,7 +235,7 @@
   if (signature_test == kSignatureGeneratedShellRotateCl1 ||
       signature_test == kSignatureGeneratedShellRotateCl2) {
     ASSERT_EQ(0,
-              System(StringPrintf(
+              System(base::StringPrintf(
                   "openssl rsautl -raw -sign -inkey %s -in %s -out %s",
                   kUnittestPrivateKey2Path,
                   hash_file.c_str(),
@@ -246,14 +245,14 @@
   }
 
   ASSERT_EQ(0,
-            System(StringPrintf(
+            System(base::StringPrintf(
                 "./delta_generator -in_file %s -signature_file %s "
                 "-out_file %s",
                 payload_path.c_str(),
                 sig_file.c_str(),
                 payload_path.c_str())));
   int verify_result =
-      System(StringPrintf(
+      System(base::StringPrintf(
           "./delta_generator -in_file %s -public_key %s -public_key_version %d",
           payload_path.c_str(),
           signature_test == kSignatureGeneratedShellRotateCl2 ?
@@ -316,37 +315,39 @@
                             kRandomString,
                             kRandomString + sizeof(kRandomString) - 1);
     }
-    EXPECT_TRUE(utils::WriteFile(StringPrintf("%s/hardtocompress",
+    EXPECT_TRUE(utils::WriteFile(base::StringPrintf("%s/hardtocompress",
                                               a_mnt.c_str()).c_str(),
-                                 &hardtocompress[0],
+                                 hardtocompress.data(),
                                  hardtocompress.size()));
 
     vector<char> zeros(16 * 1024, 0);
     EXPECT_EQ(zeros.size(),
               file_util::WriteFile(
-                  FilePath(StringPrintf("%s/move-to-sparse", a_mnt.c_str())),
-                  &zeros[0], zeros.size()));
+                  base::FilePath(base::StringPrintf("%s/move-to-sparse",
+                                                    a_mnt.c_str())),
+                  zeros.data(), zeros.size()));
 
     EXPECT_TRUE(
-        WriteSparseFile(StringPrintf("%s/move-from-sparse", a_mnt.c_str()),
-                        16 * 1024));
+        WriteSparseFile(base::StringPrintf("%s/move-from-sparse",
+                                           a_mnt.c_str()), 16 * 1024));
 
-    EXPECT_EQ(0, system(StringPrintf("dd if=/dev/zero of=%s/move-semi-sparse "
-                                     "bs=1 seek=4096 count=1",
+    EXPECT_EQ(0,
+              system(base::StringPrintf("dd if=/dev/zero of=%s/move-semi-sparse"
+                                     " bs=1 seek=4096 count=1",
                                      a_mnt.c_str()).c_str()));
 
     // Write 1 MiB of 0xff to try to catch the case where writing a bsdiff
     // patch fails to zero out the final block.
     vector<char> ones(1024 * 1024, 0xff);
-    EXPECT_TRUE(utils::WriteFile(StringPrintf("%s/ones",
+    EXPECT_TRUE(utils::WriteFile(base::StringPrintf("%s/ones",
                                               a_mnt.c_str()).c_str(),
-                                 &ones[0],
+                                 ones.data(),
                                  ones.size()));
   }
 
   if (noop) {
-    EXPECT_TRUE(file_util::CopyFile(FilePath(state->a_img),
-                                    FilePath(state->b_img)));
+    EXPECT_TRUE(base::CopyFile(base::FilePath(state->a_img),
+                               base::FilePath(state->b_img)));
     old_image_info = new_image_info;
   } else {
     CreateExtImageAtPath(state->b_img, NULL);
@@ -360,40 +361,49 @@
     string b_mnt;
     ScopedLoopMounter b_mounter(state->b_img, &b_mnt, 0);
 
-    EXPECT_EQ(0, system(StringPrintf("cp %s/hello %s/hello2", b_mnt.c_str(),
-                                     b_mnt.c_str()).c_str()));
-    EXPECT_EQ(0, system(StringPrintf("rm %s/hello", b_mnt.c_str()).c_str()));
-    EXPECT_EQ(0, system(StringPrintf("mv %s/hello2 %s/hello", b_mnt.c_str(),
-                                     b_mnt.c_str()).c_str()));
-    EXPECT_EQ(0, system(StringPrintf("echo foo > %s/foo",
-                                     b_mnt.c_str()).c_str()));
-    EXPECT_EQ(0, system(StringPrintf("touch %s/emptyfile",
-                                     b_mnt.c_str()).c_str()));
-    EXPECT_TRUE(WriteSparseFile(StringPrintf("%s/fullsparse", b_mnt.c_str()),
-                                1024 * 1024));
+    EXPECT_EQ(0, system(base::StringPrintf("cp %s/hello %s/hello2",
+                                           b_mnt.c_str(),
+                                           b_mnt.c_str()).c_str()));
+    EXPECT_EQ(0, system(base::StringPrintf("rm %s/hello",
+                                           b_mnt.c_str()).c_str()));
+    EXPECT_EQ(0, system(base::StringPrintf("mv %s/hello2 %s/hello",
+                                           b_mnt.c_str(),
+                                           b_mnt.c_str()).c_str()));
+    EXPECT_EQ(0, system(base::StringPrintf("echo foo > %s/foo",
+                                           b_mnt.c_str()).c_str()));
+    EXPECT_EQ(0, system(base::StringPrintf("touch %s/emptyfile",
+                                           b_mnt.c_str()).c_str()));
+    EXPECT_TRUE(WriteSparseFile(base::StringPrintf("%s/fullsparse",
+                                                   b_mnt.c_str()),
+                                                   1024 * 1024));
 
     EXPECT_TRUE(
-        WriteSparseFile(StringPrintf("%s/move-to-sparse", b_mnt.c_str()),
+        WriteSparseFile(base::StringPrintf("%s/move-to-sparse", b_mnt.c_str()),
                         16 * 1024));
 
     vector<char> zeros(16 * 1024, 0);
     EXPECT_EQ(zeros.size(),
               file_util::WriteFile(
-                  FilePath(StringPrintf("%s/move-from-sparse", b_mnt.c_str())),
-                  &zeros[0], zeros.size()));
+                  base::FilePath(base::StringPrintf("%s/move-from-sparse",
+                                                    b_mnt.c_str())),
+                  zeros.data(), zeros.size()));
 
-    EXPECT_EQ(0, system(StringPrintf("dd if=/dev/zero of=%s/move-semi-sparse "
-                                     "bs=1 seek=4096 count=1",
-                                     b_mnt.c_str()).c_str()));
+    EXPECT_EQ(0, system(base::StringPrintf("dd if=/dev/zero "
+                                           "of=%s/move-semi-sparse "
+                                           "bs=1 seek=4096 count=1",
+                                           b_mnt.c_str()).c_str()));
 
-    EXPECT_EQ(0, system(StringPrintf("dd if=/dev/zero of=%s/partsparse bs=1 "
-                                     "seek=4096 count=1",
-                                     b_mnt.c_str()).c_str()));
-    EXPECT_EQ(0, system(StringPrintf("cp %s/srchardlink0 %s/tmp && "
-                                     "mv %s/tmp %s/srchardlink1",
-                                     b_mnt.c_str(), b_mnt.c_str(),
-                                     b_mnt.c_str(), b_mnt.c_str()).c_str()));
-    EXPECT_EQ(0, system(StringPrintf("rm %s/boguslink && "
+    EXPECT_EQ(0, system(base::StringPrintf("dd if=/dev/zero "
+                                           "of=%s/partsparse bs=1 "
+                                           "seek=4096 count=1",
+                                           b_mnt.c_str()).c_str()));
+    EXPECT_EQ(0, system(base::StringPrintf("cp %s/srchardlink0 %s/tmp && "
+                                           "mv %s/tmp %s/srchardlink1",
+                                           b_mnt.c_str(),
+                                           b_mnt.c_str(),
+                                           b_mnt.c_str(),
+                                           b_mnt.c_str()).c_str()));
+    EXPECT_EQ(0, system(base::StringPrintf("rm %s/boguslink && "
                                      "echo foobar > %s/boguslink",
                                      b_mnt.c_str(), b_mnt.c_str()).c_str()));
 
@@ -403,9 +413,9 @@
                             kRandomString,
                             kRandomString + sizeof(kRandomString));
     }
-    EXPECT_TRUE(utils::WriteFile(StringPrintf("%s/hardtocompress",
+    EXPECT_TRUE(utils::WriteFile(base::StringPrintf("%s/hardtocompress",
                                               b_mnt.c_str()).c_str(),
-                                 &hardtocompress[0],
+                                 hardtocompress.data(),
                                  hardtocompress.size()));
   }
 
@@ -433,10 +443,10 @@
 
   // Write kernels to disk
   EXPECT_TRUE(utils::WriteFile(state->old_kernel.c_str(),
-                               &state->old_kernel_data[0],
+                               state->old_kernel_data.data(),
                                state->old_kernel_data.size()));
   EXPECT_TRUE(utils::WriteFile(state->new_kernel.c_str(),
-                               &state->new_kernel_data[0],
+                               state->new_kernel_data.data(),
                                state->new_kernel_data.size()));
 
   EXPECT_TRUE(utils::MakeTempFile("delta.XXXXXX",
@@ -635,7 +645,7 @@
   LOG(INFO) << "Setting payload metadata size in Omaha  = "
             << state->metadata_size;
   ASSERT_TRUE(PayloadSigner::GetMetadataSignature(
-      &state->delta[0],
+      state->delta.data(),
       state->metadata_size,
       kUnittestPrivateKeyPath,
       &install_plan.metadata_signature));
@@ -743,7 +753,7 @@
 
   vector<char> updated_kernel_partition;
   EXPECT_TRUE(utils::ReadFile(state->old_kernel, &updated_kernel_partition));
-  EXPECT_EQ(0, strncmp(&updated_kernel_partition[0], kNewDataString,
+  EXPECT_EQ(0, strncmp(updated_kernel_partition.data(), kNewDataString,
                        strlen(kNewDataString)));
 
   uint64_t new_kernel_size;
@@ -893,7 +903,7 @@
       // in the manifest so that we pass the metadata size checks. Only
       // then we can get to manifest signature checks.
       ASSERT_TRUE(PayloadSigner::GetMetadataSignature(
-          &payload[0],
+          payload.data(),
           state.metadata_size,
           kUnittestPrivateKeyPath,
           &install_plan.metadata_signature));
@@ -1264,7 +1274,7 @@
                                        &temp_dir));
   string non_existing_file = temp_dir + "/non-existing";
   string existing_file = temp_dir + "/existing";
-  EXPECT_EQ(0, System(StringPrintf("touch %s", existing_file.c_str())));
+  EXPECT_EQ(0, System(base::StringPrintf("touch %s", existing_file.c_str())));
 
   // Non-official build, non-existing public-key, key in response -> true
   fake_hardware->SetIsOfficialBuild(false);
diff --git a/download_action.cc b/download_action.cc
index ab33491..8508670 100644
--- a/download_action.cc
+++ b/download_action.cc
@@ -9,8 +9,8 @@
 #include <vector>
 #include <glib.h>
 
-#include <base/file_path.h>
-#include <base/stringprintf.h>
+#include <base/files/file_path.h>
+#include <base/strings/stringprintf.h>
 
 #include "update_engine/action_pipe.h"
 #include "update_engine/p2p_manager.h"
@@ -49,7 +49,8 @@
   }
 
   if (delete_p2p_file) {
-    FilePath path = system_state_->p2p_manager()->FileGetPath(p2p_file_id_);
+    base::FilePath path =
+      system_state_->p2p_manager()->FileGetPath(p2p_file_id_);
     if (unlink(path.value().c_str()) != 0) {
       PLOG(ERROR) << "Error deleting p2p file " << path.value();
     } else {
@@ -72,7 +73,7 @@
 
   // File has already been created (and allocated, xattrs been
   // populated etc.) by FileShare() so just open it for writing.
-  FilePath path = p2p_manager->FileGetPath(p2p_file_id_);
+  base::FilePath path = p2p_manager->FileGetPath(p2p_file_id_);
   p2p_sharing_fd_ = open(path.value().c_str(), O_WRONLY);
   if (p2p_sharing_fd_ == -1) {
     PLOG(ERROR) << "Error opening file " << path.value();
@@ -200,7 +201,7 @@
       // hash. If this is the case, we NEED to clean it up otherwise
       // we're essentially timing out other peers downloading from us
       // (since we're never going to complete the file).
-      FilePath path = system_state_->p2p_manager()->FileGetPath(file_id);
+      base::FilePath path = system_state_->p2p_manager()->FileGetPath(file_id);
       if (!path.empty()) {
         if (unlink(path.value().c_str()) != 0) {
           PLOG(ERROR) << "Error deleting p2p file " << path.value();
diff --git a/download_action_unittest.cc b/download_action_unittest.cc
index 7bb0fc5..b238c69 100644
--- a/download_action_unittest.cc
+++ b/download_action_unittest.cc
@@ -10,9 +10,9 @@
 #include <utility>
 #include <vector>
 
-#include <base/file_path.h>
+#include <base/files/file_path.h>
 #include <base/file_util.h>
-#include <base/stringprintf.h>
+#include <base/strings/stringprintf.h>
 
 #include "update_engine/action_pipe.h"
 #include "update_engine/download_action.h"
@@ -32,9 +32,9 @@
 using testing::AtLeast;
 using testing::InSequence;
 using base::FilePath;
+using base::ReadFileToString;
 using base::StringPrintf;
 using file_util::WriteFile;
-using file_util::ReadFileToString;
 
 class DownloadActionTest : public ::testing::Test { };
 
diff --git a/fake_p2p_manager_configuration.h b/fake_p2p_manager_configuration.h
index 79b6302..52c9248 100644
--- a/fake_p2p_manager_configuration.h
+++ b/fake_p2p_manager_configuration.h
@@ -11,7 +11,7 @@
 #include <glib.h>
 
 #include <base/logging.h>
-#include <base/stringprintf.h>
+#include <base/strings/stringprintf.h>
 
 namespace chromeos_update_engine {
 
@@ -33,8 +33,8 @@
   }
 
   // P2PManager::Configuration override
-  virtual FilePath GetP2PDir() {
-    return FilePath(p2p_dir_);
+  virtual base::FilePath GetP2PDir() {
+    return base::FilePath(p2p_dir_);
   };
 
   // P2PManager::Configuration override
diff --git a/filesystem_copier_action_unittest.cc b/filesystem_copier_action_unittest.cc
index d6f9742..891fd51 100644
--- a/filesystem_copier_action_unittest.cc
+++ b/filesystem_copier_action_unittest.cc
@@ -9,8 +9,8 @@
 #include <vector>
 
 #include <base/posix/eintr_wrapper.h>
-#include <base/string_util.h>
-#include <base/stringprintf.h>
+#include <base/strings/string_util.h>
+#include <base/strings/stringprintf.h>
 #include <glib.h>
 #include <gmock/gmock.h>
 #include <gtest/gtest.h>
@@ -410,7 +410,7 @@
   ScopedPathUnlinker img_unlinker(img);
   CreateExtImageAtPath(img, NULL);
   // Extend the "partition" holding the file system from 10MiB to 20MiB.
-  EXPECT_EQ(0, System(StringPrintf(
+  EXPECT_EQ(0, System(base::StringPrintf(
       "dd if=/dev/zero of=%s seek=20971519 bs=1 count=1",
       img.c_str())));
   EXPECT_EQ(20 * 1024 * 1024, utils::FileSize(img));
diff --git a/filesystem_iterator_unittest.cc b/filesystem_iterator_unittest.cc
index 0a92ec1..83d699a 100644
--- a/filesystem_iterator_unittest.cc
+++ b/filesystem_iterator_unittest.cc
@@ -9,8 +9,8 @@
 #include <string>
 #include <vector>
 #include <gtest/gtest.h>
-#include "base/string_util.h"
-#include <base/stringprintf.h>
+#include <base/strings/string_util.h>
+#include <base/strings/stringprintf.h>
 #include "update_engine/filesystem_iterator.h"
 #include "update_engine/test_utils.h"
 #include "update_engine/utils.h"
@@ -31,7 +31,7 @@
 
   virtual void TearDown() {
     LOG(INFO) << "TearDown() rmdir " << test_dir_;
-    EXPECT_EQ(0, System(StringPrintf("rm -rf %s", TestDir())));
+    EXPECT_EQ(0, System(base::StringPrintf("rm -rf %s", TestDir())));
   }
 
   const char* TestDir() {
diff --git a/full_update_generator.cc b/full_update_generator.cc
index 4e7e0e4..3f32a1a 100644
--- a/full_update_generator.cc
+++ b/full_update_generator.cc
@@ -9,8 +9,8 @@
 
 #include <tr1/memory>
 
-#include <base/string_util.h>
-#include <base/stringprintf.h>
+#include <base/strings/string_util.h>
+#include <base/strings/stringprintf.h>
 
 #include "update_engine/bzip.h"
 #include "update_engine/utils.h"
@@ -163,7 +163,7 @@
       if (partition == 0) {
         graph->resize(graph->size() + 1);
         graph->back().file_name =
-            StringPrintf("<rootfs-operation-%" PRIi64 ">", counter++);
+            base::StringPrintf("<rootfs-operation-%" PRIi64 ">", counter++);
         op = &graph->back().op;
         final_order->push_back(graph->size() - 1);
       } else {
diff --git a/generate_delta_main.cc b/generate_delta_main.cc
index b239450..71c4556 100644
--- a/generate_delta_main.cc
+++ b/generate_delta_main.cc
@@ -14,8 +14,8 @@
 
 #include <base/command_line.h>
 #include <base/logging.h>
-#include <base/string_number_conversions.h>
-#include <base/string_split.h>
+#include <base/strings/string_number_conversions.h>
+#include <base/strings/string_split.h>
 #include <gflags/gflags.h>
 #include <glib.h>
 
@@ -255,7 +255,7 @@
   Prefs prefs;
   InstallPlan install_plan;
   LOG(INFO) << "Setting up preferences under: " << FLAGS_prefs_dir;
-  LOG_IF(ERROR, !prefs.Init(FilePath(FLAGS_prefs_dir)))
+  LOG_IF(ERROR, !prefs.Init(base::FilePath(FLAGS_prefs_dir)))
       << "Failed to initialize preferences.";
   // Get original checksums
   LOG(INFO) << "Calculating original checksums";
@@ -294,11 +294,16 @@
   CommandLine::Init(argc, argv);
   Terminator::Init();
   Subprocess::Init();
-  logging::InitLogging("delta_generator.log",
-                       logging::LOG_ONLY_TO_SYSTEM_DEBUG_LOG,
-                       logging::DONT_LOCK_LOG_FILE,
-                       logging::APPEND_TO_OLD_LOG_FILE,
-                       logging::DISABLE_DCHECK_FOR_NON_OFFICIAL_RELEASE_BUILDS);
+
+  logging::LoggingSettings log_settings;
+  log_settings.log_file     = "delta_generator.log";
+  log_settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG;
+  log_settings.lock_log     = logging::DONT_LOCK_LOG_FILE;
+  log_settings.delete_old   = logging::APPEND_TO_OLD_LOG_FILE;
+  log_settings.dcheck_state =
+    logging::DISABLE_DCHECK_FOR_NON_OFFICIAL_RELEASE_BUILDS;
+
+  logging::InitLogging(log_settings);
 
   vector<int> signature_sizes;
   ParseSignatureSizes(FLAGS_signature_size, &signature_sizes);
diff --git a/gpio_handler.cc b/gpio_handler.cc
index 1bbc906..7495ed9 100644
--- a/gpio_handler.cc
+++ b/gpio_handler.cc
@@ -5,9 +5,9 @@
 #include "update_engine/gpio_handler.h"
 
 #include <base/memory/scoped_ptr.h>
-#include <base/string_util.h>
-#include <base/stringprintf.h>
-#include <base/time.h>
+#include <base/strings/string_util.h>
+#include <base/strings/stringprintf.h>
+#include <base/time/time.h>
 #include <glib.h>
 
 #include "update_engine/file_descriptor.h"
@@ -300,8 +300,8 @@
                                      const char* dev_name,
                                      bool is_write) {
   CHECK(id >= 0 && id < kGpioIdMax && dev_name);
-  string file_name = StringPrintf("%s/%s", gpios_[id].dev_path.c_str(),
-                                  dev_name);
+  string file_name = base::StringPrintf("%s/%s", gpios_[id].dev_path.c_str(),
+                                        dev_name);
   if (!fd_->Open(file_name.c_str(), (is_write ? O_WRONLY : O_RDONLY))) {
     if (fd_->IsSettingErrno()) {
       PLOG(ERROR) << "failed to open " << file_name
diff --git a/gpio_mock_file_descriptor.cc b/gpio_mock_file_descriptor.cc
index cadec4c..7fb6d95 100644
--- a/gpio_mock_file_descriptor.cc
+++ b/gpio_mock_file_descriptor.cc
@@ -4,7 +4,7 @@
 
 #include "update_engine/gpio_mock_file_descriptor.h"
 
-#include <base/stringprintf.h>
+#include <base/strings/stringprintf.h>
 #include <gtest/gtest.h>
 
 #include "update_engine/utils.h"
@@ -20,11 +20,11 @@
 string TimeToString(Time time) {
   Time::Exploded exploded_time;
   time.LocalExplode(&exploded_time);
-  return StringPrintf("%d:%02d:%02d.%03d",
-                      exploded_time.hour,
-                      exploded_time.minute,
-                      exploded_time.second,
-                      exploded_time.millisecond);
+  return base::StringPrintf("%d:%02d:%02d.%03d",
+                            exploded_time.hour,
+                            exploded_time.minute,
+                            exploded_time.second,
+                            exploded_time.millisecond);
 }
 }  // namespace
 
@@ -172,8 +172,8 @@
   if (!(IsOpen() && buf))
     return -1;
 
-  string str = StringPrintf("%-*s", static_cast<int>(count),
-                            reinterpret_cast<const char*>(buf));
+  string str = base::StringPrintf("%-*s", static_cast<int>(count),
+                                  reinterpret_cast<const char*>(buf));
   size_t pos = 0;
   while ((pos = str.find('\n', pos)) != string::npos) {
     str.replace(pos, 1, "\\n");
diff --git a/gpio_mock_file_descriptor.h b/gpio_mock_file_descriptor.h
index 8c317ba..26b3d0c 100644
--- a/gpio_mock_file_descriptor.h
+++ b/gpio_mock_file_descriptor.h
@@ -6,7 +6,7 @@
 #define CHROMEOS_PLATFORM_UPDATE_ENGINE_GPIO_MOCK_FILE_DESCRIPTOR_H_
 
 #include <base/rand_util.h>
-#include <base/time.h>
+#include <base/time/time.h>
 
 #include "update_engine/file_descriptor.h"
 #include "update_engine/gpio_handler_unittest.h"
diff --git a/gpio_mock_udev_interface.cc b/gpio_mock_udev_interface.cc
index 296f74f..071ff41 100644
--- a/gpio_mock_udev_interface.cc
+++ b/gpio_mock_udev_interface.cc
@@ -6,7 +6,7 @@
 
 #include <string>
 
-#include <base/stringprintf.h>
+#include <base/strings/stringprintf.h>
 #include <gtest/gtest.h>
 
 #include "update_engine/gpio_handler_unittest.h"
@@ -173,7 +173,7 @@
     case 2: {
       const int gpio_id = udev_enum_id - 1;
       const std::string gpio_pattern =
-          StringPrintf("*%s", gpio_descriptors_[gpio_id].value);
+          base::StringPrintf("*%s", gpio_descriptors_[gpio_id].value);
       EXPECT_STREQ(sysname, gpio_pattern.c_str());
       if (strcmp(sysname, gpio_pattern.c_str()))
         return -1;
diff --git a/hardware.cc b/hardware.cc
index 8c676e4..44bc9de 100644
--- a/hardware.cc
+++ b/hardware.cc
@@ -6,7 +6,7 @@
 
 #include <base/file_util.h>
 #include <base/logging.h>
-#include <base/string_util.h>
+#include <base/strings/string_util.h>
 #include <rootdev/rootdev.h>
 #include <vboot/crossystem.h>
 
diff --git a/http_fetcher_unittest.cc b/http_fetcher_unittest.cc
index 82aef7f..f09bf52 100644
--- a/http_fetcher_unittest.cc
+++ b/http_fetcher_unittest.cc
@@ -13,9 +13,9 @@
 
 #include <base/logging.h>
 #include <base/memory/scoped_ptr.h>
-#include <base/string_util.h>
-#include <base/stringprintf.h>
-#include <base/time.h>
+#include <base/strings/string_util.h>
+#include <base/strings/stringprintf.h>
+#include <base/time/time.h>
 #include <chromeos/dbus/service_constants.h>
 #include <glib.h>
 #include <gtest/gtest.h>
@@ -56,7 +56,7 @@
 
 static inline string LocalServerUrlForPath(in_port_t port,
                                            const string& path) {
-  string port_str = (port ? StringPrintf(":%hu", port) : "");
+  string port_str = (port ? base::StringPrintf(":%hu", port) : "");
   return base::StringPrintf("http://127.0.0.1%s%s", port_str.c_str(),
                             path.c_str());
 }
@@ -736,10 +736,10 @@
     StartTransferArgs start_xfer_args = {
       fetcher.get(),
       LocalServerUrlForPath(server->GetPort(),
-                            StringPrintf("/flaky/%d/%d/%d/%d", kBigLength,
-                                         kFlakyTruncateLength,
-                                         kFlakySleepEvery,
-                                         kFlakySleepSecs))
+                            base::StringPrintf("/flaky/%d/%d/%d/%d", kBigLength,
+                                               kFlakyTruncateLength,
+                                               kFlakySleepEvery,
+                                               kFlakySleepSecs))
     };
 
     g_timeout_add(0, StartTransfer, &start_xfer_args);
@@ -853,10 +853,10 @@
     StartTransferArgs start_xfer_args = {
       fetcher.get(),
       LocalServerUrlForPath(0,
-                            StringPrintf("/flaky/%d/%d/%d/%d", kBigLength,
-                                         kFlakyTruncateLength,
-                                         kFlakySleepEvery,
-                                         kFlakySleepSecs))
+                            base::StringPrintf("/flaky/%d/%d/%d/%d", kBigLength,
+                                               kFlakyTruncateLength,
+                                               kFlakySleepEvery,
+                                               kFlakySleepSecs))
     };
     g_timeout_add(0, StartTransfer, &start_xfer_args);
     g_main_loop_run(loop);
@@ -1047,7 +1047,7 @@
     multi_fetcher->ClearRanges();
     for (vector<pair<off_t, off_t> >::const_iterator it = ranges.begin(),
              e = ranges.end(); it != e; ++it) {
-      std::string tmp_str = StringPrintf("%jd+", it->first);
+      std::string tmp_str = base::StringPrintf("%jd+", it->first);
       if (it->second > 0) {
         base::StringAppendF(&tmp_str, "%jd", it->second);
         multi_fetcher->AddRange(it->first, it->second);
diff --git a/hwid_override.cc b/hwid_override.cc
index 90e413b..2c648c0 100644
--- a/hwid_override.cc
+++ b/hwid_override.cc
@@ -8,7 +8,7 @@
 #include <string>
 
 #include <base/basictypes.h>
-#include <base/file_path.h>
+#include <base/files/file_path.h>
 #include <base/file_util.h>
 
 #include "update_engine/simple_key_value_store.h"
@@ -28,7 +28,7 @@
   base::FilePath kFile(root.value() + "/etc/lsb-release");
   string file_data;
   map<string, string> data;
-  if (file_util::ReadFileToString(kFile, &file_data)) {
+  if (base::ReadFileToString(kFile, &file_data)) {
     data = simple_key_value_store::ParseString(file_data);
   }
   return data[kHwidOverrideKey];
diff --git a/hwid_override.h b/hwid_override.h
index 4d9bf9b..04981ec 100644
--- a/hwid_override.h
+++ b/hwid_override.h
@@ -9,7 +9,7 @@
 #include <string>
 
 #include <base/basictypes.h>
-#include <base/file_path.h>
+#include <base/files/file_path.h>
 
 namespace chromeos_update_engine {
 
diff --git a/hwid_override_unittest.cc b/hwid_override_unittest.cc
index 01c9fa0..10f23ee 100644
--- a/hwid_override_unittest.cc
+++ b/hwid_override_unittest.cc
@@ -6,7 +6,7 @@
 
 #include <string>
 
-#include <base/file_path.h>
+#include <base/files/file_path.h>
 #include <base/file_util.h>
 #include <base/files/scoped_temp_dir.h>
 #include <gtest/gtest.h>
@@ -20,7 +20,7 @@
 
   virtual void SetUp() {
     ASSERT_TRUE(tempdir_.CreateUniqueTempDir());
-    ASSERT_TRUE(file_util::CreateDirectory(tempdir_.path().Append("etc")));
+    ASSERT_TRUE(base::CreateDirectory(tempdir_.path().Append("etc")));
   }
 
  protected:
diff --git a/libcurl_http_fetcher.cc b/libcurl_http_fetcher.cc
index 4667fe6..57f0595 100644
--- a/libcurl_http_fetcher.cc
+++ b/libcurl_http_fetcher.cc
@@ -8,8 +8,8 @@
 #include <string>
 
 #include <base/logging.h>
-#include <base/string_util.h>
-#include <base/stringprintf.h>
+#include <base/strings/string_util.h>
+#include <base/strings/stringprintf.h>
 
 #include "update_engine/certificate_checker.h"
 #include "update_engine/hardware_interface.h"
@@ -156,9 +156,9 @@
 
     // Create a string representation of the desired range.
     std::string range_str = (end_offset ?
-                             StringPrintf("%jd-%zu", resume_offset_,
-                                          end_offset) :
-                             StringPrintf("%jd-", resume_offset_));
+                             base::StringPrintf("%jd-%zu", resume_offset_,
+                                                end_offset) :
+                             base::StringPrintf("%jd-", resume_offset_));
     CHECK_EQ(curl_easy_setopt(curl_handle_, CURLOPT_RANGE, range_str.c_str()),
              CURLE_OK);
   }
diff --git a/main.cc b/main.cc
index 9098063..cc05099 100644
--- a/main.cc
+++ b/main.cc
@@ -9,8 +9,8 @@
 #include <base/command_line.h>
 #include <base/file_util.h>
 #include <base/logging.h>
-#include <base/string_util.h>
-#include <base/stringprintf.h>
+#include <base/strings/string_util.h>
+#include <base/strings/stringprintf.h>
 #include <gflags/gflags.h>
 #include <glib.h>
 #include <metrics/metrics_library.h>
@@ -62,7 +62,7 @@
 void SetupDbusService(UpdateEngineService* service) {
   DBusGConnection *bus;
   DBusGProxy *proxy;
-  GError *error = NULL;
+  GError *error = nullptr;
 
   bus = dbus_g_bus_get(DBUS_BUS_SYSTEM, &error);
   LOG_IF(FATAL, !bus) << "Failed to get bus: "
@@ -97,9 +97,11 @@
   // we stop caring about the old-style logs.
   if (utils::FileExists(symlink_path.c_str()) &&
       !utils::IsSymlink(symlink_path.c_str())) {
-    file_util::ReplaceFile(FilePath(symlink_path), FilePath(log_path));
+    base::ReplaceFile(base::FilePath(symlink_path),
+                      base::FilePath(log_path),
+                      nullptr);
   }
-  file_util::Delete(FilePath(symlink_path), true);
+  base::DeleteFile(base::FilePath(symlink_path), true);
   if (symlink(log_path.c_str(), symlink_path.c_str()) == -1) {
     PLOG(ERROR) << "Unable to create symlink " << symlink_path
                 << " pointing at " << log_path;
@@ -118,30 +120,32 @@
   const string kLogSymlink = kLogsRoot + "/update_engine.log";
   const string kLogsDir = kLogsRoot + "/update_engine";
   const string kLogPath =
-      StringPrintf("%s/update_engine.%s",
-                   kLogsDir.c_str(),
-                   GetTimeAsString(::time(NULL)).c_str());
+      base::StringPrintf("%s/update_engine.%s",
+                         kLogsDir.c_str(),
+                         GetTimeAsString(::time(nullptr)).c_str());
   mkdir(kLogsDir.c_str(), 0755);
   SetupLogSymlink(kLogSymlink, kLogPath);
   return kLogSymlink;
 }
 
 void SetupLogging() {
-  // Log to stderr initially.
-  logging::InitLogging(NULL,
-                       logging::LOG_ONLY_TO_SYSTEM_DEBUG_LOG,
-                       logging::DONT_LOCK_LOG_FILE,
-                       logging::APPEND_TO_OLD_LOG_FILE,
-                       logging::DISABLE_DCHECK_FOR_NON_OFFICIAL_RELEASE_BUILDS);
+  logging::LoggingSettings log_settings;
+  log_settings.lock_log = logging::DONT_LOCK_LOG_FILE;
+  log_settings.delete_old = logging::APPEND_TO_OLD_LOG_FILE;
+  log_settings.dcheck_state =
+    logging::DISABLE_DCHECK_FOR_NON_OFFICIAL_RELEASE_BUILDS;
+
   if (FLAGS_logtostderr) {
-    return;
+    // Log to stderr initially.
+    log_settings.log_file = nullptr;
+    log_settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG;
+  } else {
+    const string log_file = SetupLogFile("/var/log");
+    log_settings.log_file = log_file.c_str();
+    log_settings.logging_dest = logging::LOG_TO_FILE;
   }
-  const string log_file = SetupLogFile("/var/log");
-  logging::InitLogging(log_file.c_str(),
-                       logging::LOG_ONLY_TO_FILE,
-                       logging::DONT_LOCK_LOG_FILE,
-                       logging::APPEND_TO_OLD_LOG_FILE,
-                       logging::DISABLE_DCHECK_FOR_NON_OFFICIAL_RELEASE_BUILDS);
+
+  logging::InitLogging(log_settings);
 }
 
 }  // namespace {}
@@ -190,7 +194,7 @@
   dbus_g_object_type_install_info(UPDATE_ENGINE_TYPE_SERVICE,
                                   &dbus_glib_update_engine_service_object_info);
   UpdateEngineService* service =
-      UPDATE_ENGINE_SERVICE(g_object_new(UPDATE_ENGINE_TYPE_SERVICE, NULL));
+      UPDATE_ENGINE_SERVICE(g_object_new(UPDATE_ENGINE_TYPE_SERVICE, nullptr));
   service->system_state_ = &real_system_state;
   update_attempter->set_dbus_service(service);
   chromeos_update_engine::SetupDbusService(service);
@@ -217,7 +221,7 @@
 
   // Cleanup:
   g_main_loop_unref(loop);
-  update_attempter->set_dbus_service(NULL);
+  update_attempter->set_dbus_service(nullptr);
   g_object_unref(G_OBJECT(service));
 
   LOG(INFO) << "Chrome OS Update Engine terminating";
diff --git a/metadata.cc b/metadata.cc
index 3f96d0f..761ceb5 100644
--- a/metadata.cc
+++ b/metadata.cc
@@ -6,8 +6,8 @@
 #include <string>
 #include <vector>
 
-#include <base/string_util.h>
-#include <base/stringprintf.h>
+#include <base/strings/string_util.h>
+#include <base/strings/stringprintf.h>
 #include <et/com_err.h>
 #include <ext2fs/ext2_io.h>
 #include <ext2fs/ext2fs.h>
@@ -22,6 +22,7 @@
 using std::min;
 using std::string;
 using std::vector;
+using base::StringPrintf;
 
 namespace chromeos_update_engine {
 
diff --git a/metadata_unittest.cc b/metadata_unittest.cc
index 096ea9f..a1f3e48 100644
--- a/metadata_unittest.cc
+++ b/metadata_unittest.cc
@@ -9,8 +9,8 @@
 #include <string>
 #include <vector>
 
-#include <base/string_util.h>
-#include <base/stringprintf.h>
+#include <base/strings/string_util.h>
+#include <base/strings/stringprintf.h>
 #include <gtest/gtest.h>
 
 #include "update_engine/graph_types.h"
@@ -80,11 +80,12 @@
   {
     string a_img_mnt;
     ScopedLoopMounter a_img_mount(a_img, &a_img_mnt, 0);
-    System(StringPrintf("dd if=/dev/zero of=%s/test_file bs=%d count=%d",
-                        a_img_mnt.c_str(), block_size, EXT2_NDIR_BLOCKS + 1));
+    System(base::StringPrintf("dd if=/dev/zero of=%s/test_file bs=%d count=%d",
+                              a_img_mnt.c_str(), block_size,
+                              EXT2_NDIR_BLOCKS + 1));
   }
 
-  System(StringPrintf("cp %s %s", a_img.c_str(), b_img.c_str()));
+  System(base::StringPrintf("cp %s %s", a_img.c_str(), b_img.c_str()));
 
   int fd = open(data_file.c_str(), O_RDWR | O_CREAT, S_IRWXU);
   EXPECT_NE(fd, -1);
diff --git a/multi_range_http_fetcher.cc b/multi_range_http_fetcher.cc
index f19b9c3..9eeefcd 100644
--- a/multi_range_http_fetcher.cc
+++ b/multi_range_http_fetcher.cc
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include <base/stringprintf.h>
+#include <base/strings/stringprintf.h>
 
 #include "update_engine/multi_range_http_fetcher.h"
 #include "update_engine/utils.h"
@@ -163,7 +163,7 @@
 }
 
 std::string MultiRangeHttpFetcher::Range::ToString() const {
-  std::string range_str = StringPrintf("%jd+", offset());
+  std::string range_str = base::StringPrintf("%jd+", offset());
   if (HasLength())
     base::StringAppendF(&range_str, "%zu", length());
   else
diff --git a/omaha_request_action.cc b/omaha_request_action.cc
index 941b511..c706a16 100644
--- a/omaha_request_action.cc
+++ b/omaha_request_action.cc
@@ -12,10 +12,10 @@
 #include <base/bind.h>
 #include <base/logging.h>
 #include <base/rand_util.h>
-#include <base/string_number_conversions.h>
-#include <base/string_util.h>
-#include <base/stringprintf.h>
-#include <base/time.h>
+#include <base/strings/string_number_conversions.h>
+#include <base/strings/string_util.h>
+#include <base/strings/stringprintf.h>
+#include <base/time/time.h>
 #include <libxml/xpath.h>
 #include <libxml/xpathInternals.h>
 
@@ -100,7 +100,7 @@
 // to be sent, or an empty string otherwise.
 string GetPingAttribute(const string& name, int ping_days) {
   if (ShouldPing(ping_days)) {
-    return StringPrintf(" %s=\"%d\"", name.c_str(), ping_days);
+    return base::StringPrintf(" %s=\"%d\"", name.c_str(), ping_days);
   }
   return "";
 }
@@ -111,7 +111,7 @@
   string ping_active = GetPingAttribute("a", ping_active_days);
   string ping_roll_call = GetPingAttribute("r", ping_roll_call_days);
   if (!ping_active.empty() || !ping_roll_call.empty()) {
-    return StringPrintf("        <ping active=\"1\"%s%s></ping>\n",
+    return base::StringPrintf("        <ping active=\"1\"%s%s></ping>\n",
                         ping_active.c_str(),
                         ping_roll_call.c_str());
   }
@@ -135,7 +135,7 @@
       // borgmon charts show up updates that are deferred. This is also
       // the expected behavior when we move to Omaha v3.0 protocol, so it'll
       // be consistent.
-      app_body += StringPrintf(
+      app_body += base::StringPrintf(
           "        <updatecheck targetversionprefix=\"%s\""
           "></updatecheck>\n",
           XmlEncode(params->target_version_prefix()).c_str());
@@ -152,7 +152,7 @@
         prev_version = "0.0.0.0";
       }
 
-      app_body += StringPrintf(
+      app_body += base::StringPrintf(
           "        <event eventtype=\"%d\" eventresult=\"%d\" "
           "previousversion=\"%s\"></event>\n",
           OmahaEvent::kTypeUpdateComplete,
@@ -166,9 +166,9 @@
     // is not success.
     string error_code;
     if (event->result != OmahaEvent::kResultSuccess) {
-      error_code = StringPrintf(" errorcode=\"%d\"", event->error_code);
+      error_code = base::StringPrintf(" errorcode=\"%d\"", event->error_code);
     }
-    app_body = StringPrintf(
+    app_body = base::StringPrintf(
         "        <event eventtype=\"%d\" eventresult=\"%d\"%s></event>\n",
         event->type, event->result, error_code.c_str());
   }
@@ -213,8 +213,8 @@
   // include the attribute.
   string install_date_in_days_str = "";
   if (install_date_in_days >= 0) {
-    install_date_in_days_str = StringPrintf("installdate=\"%d\" ",
-                                            install_date_in_days);
+    install_date_in_days_str = base::StringPrintf("installdate=\"%d\" ",
+                                                  install_date_in_days);
   }
 
   string app_xml =
@@ -260,7 +260,7 @@
                              ping_roll_call_days, install_date_in_days,
                              system_state);
 
-  string install_source = StringPrintf("installsource=\"%s\" ",
+  string install_source = base::StringPrintf("installsource=\"%s\" ",
       (params->interactive() ? "ondemandupdate" : "scheduler"));
 
   string request_xml =
diff --git a/omaha_request_action_unittest.cc b/omaha_request_action_unittest.cc
index 0983ed9..5628b39 100644
--- a/omaha_request_action_unittest.cc
+++ b/omaha_request_action_unittest.cc
@@ -7,9 +7,9 @@
 
 #include <glib.h>
 
-#include "base/string_util.h"
-#include <base/stringprintf.h>
-#include "base/time.h"
+#include <base/strings/string_util.h>
+#include <base/strings/stringprintf.h>
+#include <base/time/time.h>
 #include "gtest/gtest.h"
 
 #include "update_engine/action_pipe.h"
@@ -400,7 +400,7 @@
   ScopedDirRemover temp_dir_remover(prefs_dir);
 
   Prefs prefs;
-  LOG_IF(ERROR, !prefs.Init(FilePath(prefs_dir)))
+  LOG_IF(ERROR, !prefs.Init(base::FilePath(prefs_dir)))
       << "Failed to initialize preferences.";
 
   ASSERT_FALSE(
@@ -474,7 +474,7 @@
   ScopedDirRemover temp_dir_remover(prefs_dir);
 
   Prefs prefs;
-  LOG_IF(ERROR, !prefs.Init(FilePath(prefs_dir)))
+  LOG_IF(ERROR, !prefs.Init(base::FilePath(prefs_dir)))
       << "Failed to initialize preferences.";
 
   ASSERT_TRUE(
@@ -520,7 +520,7 @@
   ScopedDirRemover temp_dir_remover(prefs_dir);
 
   Prefs prefs;
-  LOG_IF(ERROR, !prefs.Init(FilePath(prefs_dir)))
+  LOG_IF(ERROR, !prefs.Init(base::FilePath(prefs_dir)))
       << "Failed to initialize preferences.";
 
   ASSERT_TRUE(
@@ -567,7 +567,7 @@
   ScopedDirRemover temp_dir_remover(prefs_dir);
 
   Prefs prefs;
-  LOG_IF(ERROR, !prefs.Init(FilePath(prefs_dir)))
+  LOG_IF(ERROR, !prefs.Init(base::FilePath(prefs_dir)))
       << "Failed to initialize preferences.";
 
   ASSERT_TRUE(TestUpdateCheck(
@@ -617,7 +617,7 @@
   ScopedDirRemover temp_dir_remover(prefs_dir);
 
   Prefs prefs;
-  LOG_IF(ERROR, !prefs.Init(FilePath(prefs_dir)))
+  LOG_IF(ERROR, !prefs.Init(base::FilePath(prefs_dir)))
       << "Failed to initialize preferences.";
 
   ASSERT_FALSE(TestUpdateCheck(
@@ -695,7 +695,7 @@
   ScopedDirRemover temp_dir_remover(prefs_dir);
 
   Prefs prefs;
-  LOG_IF(ERROR, !prefs.Init(FilePath(prefs_dir)))
+  LOG_IF(ERROR, !prefs.Init(base::FilePath(prefs_dir)))
       << "Failed to initialize preferences.";
 
   ASSERT_TRUE(prefs.SetInt64(kPrefsUpdateCheckCount, 5));
@@ -1141,7 +1141,7 @@
             &post_data);
   // convert post_data to string
   string post_str(&post_data[0], post_data.size());
-  string expected_event = StringPrintf(
+  string expected_event = base::StringPrintf(
       "        <event eventtype=\"%d\" eventresult=\"%d\"></event>\n",
       OmahaEvent::kTypeUpdateDownloadStarted,
       OmahaEvent::kResultSuccess);
@@ -1160,7 +1160,7 @@
             &post_data);
   // convert post_data to string
   string post_str(&post_data[0], post_data.size());
-  string expected_event = StringPrintf(
+  string expected_event = base::StringPrintf(
       "        <event eventtype=\"%d\" eventresult=\"%d\" "
       "errorcode=\"%d\"></event>\n",
       OmahaEvent::kTypeDownloadComplete,
@@ -1232,8 +1232,9 @@
                                  NULL,
                                  &post_data));
     // convert post_data to string
-    string post_str(&post_data[0], post_data.size());
-    EXPECT_NE(post_str.find(StringPrintf(" delta_okay=\"%s\"", delta_okay_str)),
+    string post_str(post_data.data(), post_data.size());
+    EXPECT_NE(post_str.find(base::StringPrintf(" delta_okay=\"%s\"",
+                                               delta_okay_str)),
               string::npos)
         << "i = " << i;
   }
@@ -1276,8 +1277,8 @@
                                  &post_data));
     // convert post_data to string
     string post_str(&post_data[0], post_data.size());
-    EXPECT_NE(post_str.find(StringPrintf("installsource=\"%s\"",
-                                         interactive_str)),
+    EXPECT_NE(post_str.find(base::StringPrintf("installsource=\"%s\"",
+                                               interactive_str)),
               string::npos)
         << "i = " << i;
   }
@@ -1620,7 +1621,7 @@
   ScopedDirRemover temp_dir_remover(prefs_dir);
 
   Prefs prefs;
-  LOG_IF(ERROR, !prefs.Init(FilePath(prefs_dir)))
+  LOG_IF(ERROR, !prefs.Init(base::FilePath(prefs_dir)))
       << "Failed to initialize preferences.";
 
   ASSERT_FALSE(TestUpdateCheck(
@@ -1695,7 +1696,7 @@
   ScopedDirRemover temp_dir_remover(prefs_dir);
 
   Prefs prefs;
-  LOG_IF(ERROR, !prefs.Init(FilePath(prefs_dir)))
+  LOG_IF(ERROR, !prefs.Init(base::FilePath(prefs_dir)))
       << "Failed to initialize preferences.";
 
   // Set the timestamp to a very old value such that it exceeds the
@@ -2010,7 +2011,7 @@
   Prefs prefs;
   EXPECT_TRUE(utils::MakeTempDirectory("ParseInstallDateFromResponse.XXXXXX",
                                        &temp_dir));
-  prefs.Init(FilePath(temp_dir));
+  prefs.Init(base::FilePath(temp_dir));
 
   // Check that we parse elapsed_days in the Omaha Response correctly.
   // and that the kPrefsInstallDateDays value is written to.
@@ -2053,7 +2054,7 @@
   Prefs prefs;
   EXPECT_TRUE(utils::MakeTempDirectory("GetInstallDate.XXXXXX",
                                        &temp_dir));
-  prefs.Init(FilePath(temp_dir));
+  prefs.Init(base::FilePath(temp_dir));
 
   // If there is no prefs and OOBE is not complete, we should not
   // report anything to Omaha.
diff --git a/omaha_request_params.cc b/omaha_request_params.cc
index 065d5bb..3564b22 100644
--- a/omaha_request_params.cc
+++ b/omaha_request_params.cc
@@ -13,7 +13,7 @@
 #include <vector>
 
 #include <base/file_util.h>
-#include <base/string_util.h>
+#include <base/strings/string_util.h>
 #include <policy/device_policy.h>
 
 #include "update_engine/constants.h"
@@ -133,16 +133,16 @@
             << ", existing target channel = " << target_channel_
             << ", download channel = " << download_channel_;
   TEST_AND_RETURN_FALSE(IsValidChannel(new_target_channel));
-  FilePath kFile(root_ + kStatefulPartition + "/etc/lsb-release");
+  base::FilePath kFile(root_ + kStatefulPartition + "/etc/lsb-release");
   string file_data;
   map<string, string> data;
-  if (file_util::ReadFileToString(kFile, &file_data)) {
+  if (base::ReadFileToString(kFile, &file_data)) {
     data = simple_key_value_store::ParseString(file_data);
   }
   data[kUpdateChannelKey] = new_target_channel;
   data[kIsPowerwashAllowedKey] = is_powerwash_allowed ? "true" : "false";
   file_data = simple_key_value_store::AssembleString(data);
-  TEST_AND_RETURN_FALSE(file_util::CreateDirectory(kFile.DirName()));
+  TEST_AND_RETURN_FALSE(base::CreateDirectory(kFile.DirName()));
   TEST_AND_RETURN_FALSE(
       file_util::WriteFile(kFile, file_data.data(), file_data.size()) ==
       static_cast<int>(file_data.size()));
diff --git a/omaha_request_params.h b/omaha_request_params.h
index e7113ba..b04640c 100644
--- a/omaha_request_params.h
+++ b/omaha_request_params.h
@@ -8,7 +8,7 @@
 #include <string>
 
 #include <base/basictypes.h>
-#include <base/time.h>
+#include <base/time/time.h>
 #include <gtest/gtest_prod.h>  // for FRIEND_TEST
 
 // This gathers local system information and prepares info used by the
diff --git a/omaha_response_handler_action.cc b/omaha_response_handler_action.cc
index e54fc83..47c1143 100644
--- a/omaha_response_handler_action.cc
+++ b/omaha_response_handler_action.cc
@@ -7,7 +7,7 @@
 #include <string>
 
 #include <base/logging.h>
-#include "base/string_util.h"
+#include <base/strings/string_util.h>
 
 #include "update_engine/constants.h"
 #include "update_engine/delta_performer.h"
diff --git a/p2p_manager.cc b/p2p_manager.cc
index 596adf1..ddb9bf0 100644
--- a/p2p_manager.cc
+++ b/p2p_manager.cc
@@ -28,9 +28,9 @@
 #include <utility>
 #include <vector>
 
-#include <base/file_path.h>
+#include <base/files/file_path.h>
 #include <base/logging.h>
-#include <base/stringprintf.h>
+#include <base/strings/stringprintf.h>
 
 #include "update_engine/utils.h"
 
@@ -63,8 +63,8 @@
 
   virtual ~ConfigurationImpl() {}
 
-  virtual FilePath GetP2PDir() {
-    return FilePath(kDefaultP2PDir);
+  virtual base::FilePath GetP2PDir() {
+    return base::FilePath(kDefaultP2PDir);
   }
 
   virtual vector<string> GetInitctlArgs(bool is_start) {
@@ -80,7 +80,7 @@
     vector<string> args;
     args.push_back("p2p-client");
     args.push_back(string("--get-url=") + file_id);
-    args.push_back(StringPrintf("--minimum-size=%zu", minimum_size));
+    args.push_back(base::StringPrintf("--minimum-size=%zu", minimum_size));
     return args;
   }
 
@@ -108,7 +108,7 @@
                                 LookupCallback callback);
   virtual bool FileShare(const string& file_id,
                          size_t expected_size);
-  virtual FilePath FileGetPath(const string& file_id);
+  virtual base::FilePath FileGetPath(const string& file_id);
   virtual ssize_t FileGetSize(const string& file_id);
   virtual ssize_t FileGetExpectedSize(const string& file_id);
   virtual bool FileGetVisible(const string& file_id,
@@ -129,7 +129,7 @@
 
   // Gets the on-disk path for |file_id| depending on if the file
   // is visible or not.
-  FilePath GetPath(const string& file_id, Visibility visibility);
+  base::FilePath GetPath(const string& file_id, Visibility visibility);
 
   // Utility function used by EnsureP2PRunning() and EnsureP2PNotRunning().
   bool EnsureP2P(bool should_be_running);
@@ -313,7 +313,7 @@
 
   // Go through all files in the p2p dir and pick the ones that match
   // and get their ctime.
-  FilePath p2p_dir = configuration_->GetP2PDir();
+  base::FilePath p2p_dir = configuration_->GetP2PDir();
   dir = g_dir_open(p2p_dir.value().c_str(), 0, &error);
   if (dir == NULL) {
     LOG(ERROR) << "Error opening directory " << p2p_dir.value() << ": "
@@ -332,7 +332,7 @@
       continue;
 
     struct stat statbuf;
-    FilePath file = p2p_dir.Append(name);
+    base::FilePath file = p2p_dir.Append(name);
     if (stat(file.value().c_str(), &statbuf) != 0) {
       PLOG(ERROR) << "Error getting file status for " << file.value();
       continue;
@@ -349,7 +349,7 @@
   // Delete starting at element num_files_to_keep_.
   vector<pair<FilePath, Time> >::const_iterator i;
   for (i = matches.begin() + num_files_to_keep_; i < matches.end(); ++i) {
-    const FilePath& file = i->first;
+    const base::FilePath& file = i->first;
     LOG(INFO) << "Deleting p2p file " << file.value();
     if (unlink(file.value().c_str()) != 0) {
       PLOG(ERROR) << "Error deleting p2p file " << file.value();
@@ -555,7 +555,7 @@
 bool P2PManagerImpl::FileShare(const string& file_id,
                                size_t expected_size) {
   // Check if file already exist.
-  FilePath path = FileGetPath(file_id);
+  base::FilePath path = FileGetPath(file_id);
   if (!path.empty()) {
     // File exists - double check its expected size though.
     ssize_t file_expected_size = FileGetExpectedSize(file_id);
@@ -573,7 +573,7 @@
   // Before creating the file, bail if statvfs(3) indicates that at
   // least twice the size is not available in P2P_DIR.
   struct statvfs statvfsbuf;
-  FilePath p2p_dir = configuration_->GetP2PDir();
+  base::FilePath p2p_dir = configuration_->GetP2PDir();
   if (statvfs(p2p_dir.value().c_str(), &statvfsbuf) != 0) {
     PLOG(ERROR) << "Error calling statvfs() for dir " << p2p_dir.value();
     return false;
@@ -623,7 +623,7 @@
       }
     }
 
-    string decimal_size = StringPrintf("%zu", expected_size);
+    string decimal_size = base::StringPrintf("%zu", expected_size);
     if (fsetxattr(fd, kCrosP2PFileSizeXAttrName,
                   decimal_size.c_str(), decimal_size.size(), 0) != 0) {
       PLOG(ERROR) << "Error setting xattr " << path.value();
@@ -636,7 +636,7 @@
 
 FilePath P2PManagerImpl::FileGetPath(const string& file_id) {
   struct stat statbuf;
-  FilePath path;
+  base::FilePath path;
 
   path = GetPath(file_id, kVisible);
   if (stat(path.value().c_str(), &statbuf) == 0) {
@@ -654,7 +654,7 @@
 
 bool P2PManagerImpl::FileGetVisible(const string& file_id,
                                     bool *out_result) {
-  FilePath path = FileGetPath(file_id);
+  base::FilePath path = FileGetPath(file_id);
   if (path.empty()) {
     LOG(ERROR) << "No file for id " << file_id;
     return false;
@@ -665,7 +665,7 @@
 }
 
 bool P2PManagerImpl::FileMakeVisible(const string& file_id) {
-  FilePath path = FileGetPath(file_id);
+  base::FilePath path = FileGetPath(file_id);
   if (path.empty()) {
     LOG(ERROR) << "No file for id " << file_id;
     return false;
@@ -676,7 +676,7 @@
     return true;
 
   LOG_ASSERT(path.MatchesExtension(kTmpExtension));
-  FilePath new_path = path.RemoveExtension();
+  base::FilePath new_path = path.RemoveExtension();
   LOG_ASSERT(new_path.MatchesExtension(kP2PExtension));
   if (rename(path.value().c_str(), new_path.value().c_str()) != 0) {
     PLOG(ERROR) << "Error renaming " << path.value()
@@ -688,7 +688,7 @@
 }
 
 ssize_t P2PManagerImpl::FileGetSize(const string& file_id) {
-  FilePath path = FileGetPath(file_id);
+  base::FilePath path = FileGetPath(file_id);
   if (path.empty())
     return -1;
 
@@ -702,7 +702,7 @@
 }
 
 ssize_t P2PManagerImpl::FileGetExpectedSize(const string& file_id) {
-  FilePath path = FileGetPath(file_id);
+  base::FilePath path = FileGetPath(file_id);
   if (path.empty())
     return -1;
 
@@ -733,7 +733,7 @@
   const char* name;
   int num_files = 0;
 
-  FilePath p2p_dir = configuration_->GetP2PDir();
+  base::FilePath p2p_dir = configuration_->GetP2PDir();
   dir = g_dir_open(p2p_dir.value().c_str(), 0, &error);
   if (dir == NULL) {
     LOG(ERROR) << "Error opening directory " << p2p_dir.value() << ": "
diff --git a/p2p_manager.h b/p2p_manager.h
index 0636e07..0b393f2 100644
--- a/p2p_manager.h
+++ b/p2p_manager.h
@@ -9,9 +9,9 @@
 #include <vector>
 
 #include <base/callback.h>
-#include <base/file_path.h>
+#include <base/files/file_path.h>
 #include <base/memory/ref_counted.h>
-#include <base/time.h>
+#include <base/time/time.h>
 #include <policy/device_policy.h>
 #include <policy/libpolicy.h>
 
@@ -111,7 +111,7 @@
 
   // Gets a fully qualified path for the file identified by |file_id|.
   // If the file has not been shared already using the FileShare()
-  // method, an empty FilePath is returned - use FilePath::empty() to
+  // method, an empty base::FilePath is returned - use FilePath::empty() to
   // find out.
   virtual base::FilePath FileGetPath(const std::string& file_id) = 0;
 
diff --git a/p2p_manager_unittest.cc b/p2p_manager_unittest.cc
index bb34ada..3223724 100644
--- a/p2p_manager_unittest.cc
+++ b/p2p_manager_unittest.cc
@@ -15,7 +15,7 @@
 
 #include "base/bind.h"
 #include "base/callback.h"
-#include "base/stringprintf.h"
+#include <base/strings/stringprintf.h>
 #include <policy/libpolicy.h>
 #include <policy/mock_device_policy.h>
 
@@ -57,7 +57,7 @@
   Prefs prefs;
   EXPECT_TRUE(utils::MakeTempDirectory("PayloadStateP2PTests.XXXXXX",
                                        &temp_dir));
-  prefs.Init(FilePath(temp_dir));
+  prefs.Init(base::FilePath(temp_dir));
 
   scoped_ptr<P2PManager> manager(P2PManager::Construct(test_conf_,
                                                        &prefs, "cros_au", 3));
@@ -73,7 +73,7 @@
   Prefs prefs;
   EXPECT_TRUE(utils::MakeTempDirectory("PayloadStateP2PTests.XXXXXX",
                                        &temp_dir));
-  prefs.Init(FilePath(temp_dir));
+  prefs.Init(base::FilePath(temp_dir));
 
   scoped_ptr<P2PManager> manager(P2PManager::Construct(test_conf_,
                                                        &prefs, "cros_au", 3));
@@ -93,7 +93,7 @@
   Prefs prefs;
   EXPECT_TRUE(utils::MakeTempDirectory("PayloadStateP2PTests.XXXXXX",
                                        &temp_dir));
-  prefs.Init(FilePath(temp_dir));
+  prefs.Init(base::FilePath(temp_dir));
 
   scoped_ptr<P2PManager> manager(P2PManager::Construct(test_conf_,
                                                        &prefs, "cros_au", 3));
@@ -119,7 +119,7 @@
   Prefs prefs;
   EXPECT_TRUE(utils::MakeTempDirectory("PayloadStateP2PTests.XXXXXX",
                                        &temp_dir));
-  prefs.Init(FilePath(temp_dir));
+  prefs.Init(base::FilePath(temp_dir));
 
   scoped_ptr<P2PManager> manager(P2PManager::Construct(test_conf_,
                                                        &prefs, "cros_au", 3));
@@ -151,9 +151,10 @@
   for (int n = 0; n < 5; n++) {
     double current_timestamp;
     do {
-      FilePath file = test_conf_->GetP2PDir().Append(StringPrintf(
+      base::FilePath file = test_conf_->GetP2PDir().Append(base::StringPrintf(
           "file_%d.cros_au.p2p", n));
-      EXPECT_EQ(0, System(StringPrintf("touch %s", file.value().c_str())));
+      EXPECT_EQ(0, System(base::StringPrintf("touch %s",
+                                             file.value().c_str())));
 
       // Check that the current timestamp on the file is different from the
       // previous generated file. This timestamp depends on the file system
@@ -170,9 +171,9 @@
     } while (current_timestamp == last_timestamp);
     last_timestamp = current_timestamp;
 
-    EXPECT_EQ(0, System(StringPrintf("touch %s/file_%d.OTHER.p2p",
-                                     test_conf_->GetP2PDir().value().c_str(),
-                                     n)));
+    EXPECT_EQ(0, System(base::StringPrintf(
+        "touch %s/file_%d.OTHER.p2p",
+        test_conf_->GetP2PDir().value().c_str(), n)));
 
     // A sleep of one micro-second is enough to have a different "Change" time
     // on the file on newer file systems.
@@ -190,12 +191,14 @@
     bool expect;
 
     expect = (n >= 2);
-    file_name = StringPrintf("%s/file_%d.cros_au.p2p",
-                             test_conf_->GetP2PDir().value().c_str(), n);
+    file_name = base::StringPrintf(
+        "%s/file_%d.cros_au.p2p",
+         test_conf_->GetP2PDir().value().c_str(), n);
     EXPECT_EQ(!!g_file_test(file_name.c_str(), G_FILE_TEST_EXISTS), expect);
 
-    file_name = StringPrintf("%s/file_%d.OTHER.p2p",
-                             test_conf_->GetP2PDir().value().c_str(), n);
+    file_name = base::StringPrintf(
+        "%s/file_%d.OTHER.p2p",
+        test_conf_->GetP2PDir().value().c_str(), n);
     EXPECT_TRUE(g_file_test(file_name.c_str(), G_FILE_TEST_EXISTS));
   }
   // CountSharedFiles() only counts 'cros_au' files.
@@ -272,7 +275,7 @@
   }
 
   if (size_xattr != 0) {
-    string decimal_size = StringPrintf("%zu", size_xattr);
+    string decimal_size = base::StringPrintf("%zu", size_xattr);
     if (fsetxattr(fd, "user.cros-p2p-filesize",
                   decimal_size.c_str(), decimal_size.size(), 0) != 0) {
       PLOG(ERROR) << "Error setting xattr on " << path;
@@ -287,7 +290,7 @@
 
 // Check that sharing a *new* file works.
 TEST_F(P2PManagerTest, ShareFile) {
-  if (!utils::IsXAttrSupported(FilePath("/tmp"))) {
+  if (!utils::IsXAttrSupported(base::FilePath("/tmp"))) {
     LOG(WARNING) << "Skipping test because /tmp does not support xattr. "
                  << "Please update your system to support this feature.";
     return;
@@ -310,7 +313,7 @@
 
 // Check that making a shared file visible, does what is expected.
 TEST_F(P2PManagerTest, MakeFileVisible) {
-  if (!utils::IsXAttrSupported(FilePath("/tmp"))) {
+  if (!utils::IsXAttrSupported(base::FilePath("/tmp"))) {
     LOG(WARNING) << "Skipping test because /tmp does not support xattr. "
                  << "Please update your system to support this feature.";
     return;
@@ -337,7 +340,7 @@
 
 // Check that we return the right values for existing files in P2P_DIR.
 TEST_F(P2PManagerTest, ExistingFiles) {
-  if (!utils::IsXAttrSupported(FilePath("/tmp"))) {
+  if (!utils::IsXAttrSupported(base::FilePath("/tmp"))) {
     LOG(WARNING) << "Skipping test because /tmp does not support xattr. "
                  << "Please update your system to support this feature.";
     return;
@@ -348,7 +351,7 @@
   bool visible;
 
   // Check that errors are returned if the file does not exist
-  EXPECT_EQ(manager->FileGetPath("foo"), FilePath());
+  EXPECT_EQ(manager->FileGetPath("foo"), base::FilePath());
   EXPECT_EQ(manager->FileGetSize("foo"), -1);
   EXPECT_EQ(manager->FileGetExpectedSize("foo"), -1);
   EXPECT_FALSE(manager->FileGetVisible("foo", NULL));
@@ -364,7 +367,7 @@
   EXPECT_TRUE(visible);
 
   // One more time, this time with a .tmp variant. First ensure it errors out..
-  EXPECT_EQ(manager->FileGetPath("bar"), FilePath());
+  EXPECT_EQ(manager->FileGetPath("bar"), base::FilePath());
   EXPECT_EQ(manager->FileGetSize("bar"), -1);
   EXPECT_EQ(manager->FileGetExpectedSize("bar"), -1);
   EXPECT_FALSE(manager->FileGetVisible("bar", NULL));
diff --git a/payload_signer.cc b/payload_signer.cc
index 7ec483d..e521314 100644
--- a/payload_signer.cc
+++ b/payload_signer.cc
@@ -5,8 +5,8 @@
 #include "update_engine/payload_signer.h"
 
 #include <base/logging.h>
-#include <base/string_split.h>
-#include <base/string_util.h>
+#include <base/strings/string_split.h>
+#include <base/strings/string_util.h>
 #include <openssl/pem.h>
 
 #include "update_engine/delta_diff_generator.h"
diff --git a/payload_state.cc b/payload_state.cc
index 7505b96..642264d 100644
--- a/payload_state.cc
+++ b/payload_state.cc
@@ -7,8 +7,9 @@
 #include <algorithm>
 
 #include <base/logging.h>
-#include "base/string_util.h"
-#include <base/stringprintf.h>
+#include <base/strings/string_util.h>
+#include <base/strings/stringprintf.h>
+#include <base/format_macros.h>
 
 #include "update_engine/clock.h"
 #include "update_engine/constants.h"
@@ -655,27 +656,29 @@
 }
 
 string PayloadState::CalculateResponseSignature() {
-  string response_sign = StringPrintf("NumURLs = %d\n",
-                                      candidate_urls_.size());
+  string response_sign = base::StringPrintf(
+      "NumURLs = %d\n", static_cast<int>(candidate_urls_.size()));
 
   for (size_t i = 0; i < candidate_urls_.size(); i++)
-    response_sign += StringPrintf("Candidate Url%d = %s\n",
-                                  i, candidate_urls_[i].c_str());
+    response_sign += base::StringPrintf("Candidate Url%d = %s\n",
+                                        static_cast<int>(i),
+                                        candidate_urls_[i].c_str());
 
-  response_sign += StringPrintf("Payload Size = %llu\n"
-                                "Payload Sha256 Hash = %s\n"
-                                "Metadata Size = %llu\n"
-                                "Metadata Signature = %s\n"
-                                "Is Delta Payload = %d\n"
-                                "Max Failure Count Per Url = %d\n"
-                                "Disable Payload Backoff = %d\n",
-                                response_.size,
-                                response_.hash.c_str(),
-                                response_.metadata_size,
-                                response_.metadata_signature.c_str(),
-                                response_.is_delta_payload,
-                                response_.max_failure_count_per_url,
-                                response_.disable_payload_backoff);
+  response_sign += base::StringPrintf(
+      "Payload Size = %ju\n"
+      "Payload Sha256 Hash = %s\n"
+      "Metadata Size = %ju\n"
+      "Metadata Signature = %s\n"
+      "Is Delta Payload = %d\n"
+      "Max Failure Count Per Url = %d\n"
+      "Disable Payload Backoff = %d\n",
+      static_cast<uintmax_t>(response_.size),
+      response_.hash.c_str(),
+      static_cast<uintmax_t>(response_.metadata_size),
+      response_.metadata_signature.c_str(),
+      response_.is_delta_payload,
+      response_.max_failure_count_per_url,
+      response_.disable_payload_backoff);
   return response_sign;
 }
 
diff --git a/payload_state.h b/payload_state.h
index 9e75a30..bb47f1a 100644
--- a/payload_state.h
+++ b/payload_state.h
@@ -5,7 +5,7 @@
 #ifndef CHROMEOS_PLATFORM_UPDATE_ENGINE_PAYLOAD_STATE_H_
 #define CHROMEOS_PLATFORM_UPDATE_ENGINE_PAYLOAD_STATE_H_
 
-#include <base/time.h>
+#include <base/time/time.h>
 #include <gtest/gtest_prod.h>  // for FRIEND_TEST
 
 #include "update_engine/payload_state_interface.h"
diff --git a/payload_state_unittest.cc b/payload_state_unittest.cc
index 8029b69..f804599 100644
--- a/payload_state_unittest.cc
+++ b/payload_state_unittest.cc
@@ -4,9 +4,9 @@
 
 #include <glib.h>
 
-#include "base/file_path.h"
+#include <base/files/file_path.h>
 #include "base/file_util.h"
-#include "base/stringprintf.h"
+#include <base/strings/stringprintf.h>
 #include "gmock/gmock.h"
 #include "gtest/gtest.h"
 
@@ -73,17 +73,17 @@
 
   string expected_response_sign =
       (http_enabled ? expected_urls_both : expected_url_https_only) +
-      StringPrintf("Payload Size = 523456789\n"
-                   "Payload Sha256 Hash = %s\n"
-                   "Metadata Size = 558123\n"
-                   "Metadata Signature = metasign\n"
-                   "Is Delta Payload = %d\n"
-                   "Max Failure Count Per Url = %d\n"
-                   "Disable Payload Backoff = %d\n",
-                   hash.c_str(),
-                   response->is_delta_payload,
-                   response->max_failure_count_per_url,
-                   response->disable_payload_backoff);
+      base::StringPrintf("Payload Size = 523456789\n"
+                         "Payload Sha256 Hash = %s\n"
+                         "Metadata Size = 558123\n"
+                         "Metadata Signature = metasign\n"
+                         "Is Delta Payload = %d\n"
+                         "Max Failure Count Per Url = %d\n"
+                         "Disable Payload Backoff = %d\n",
+                         hash.c_str(),
+                         response->is_delta_payload,
+                         response->max_failure_count_per_url,
+                         response->disable_payload_backoff);
   EXPECT_EQ(expected_response_sign, stored_response_sign);
 }
 
@@ -1071,7 +1071,7 @@
   // We need persistent preferences for this test
   EXPECT_TRUE(utils::MakeTempDirectory("PayloadStateDurationTests.XXXXXX",
                                        &temp_dir));
-  prefs.Init(FilePath(temp_dir));
+  prefs.Init(base::FilePath(temp_dir));
 
   mock_system_state.set_clock(&fake_clock);
   mock_system_state.set_prefs(&prefs);
@@ -1135,7 +1135,7 @@
   // We need persistent preferences for this test
   EXPECT_TRUE(utils::MakeTempDirectory(
       "RebootAfterSuccessfulUpdateTest.XXXXXX", &temp_dir));
-  prefs.Init(FilePath(temp_dir));
+  prefs.Init(base::FilePath(temp_dir));
 
   mock_system_state.set_clock(&fake_clock);
   mock_system_state.set_prefs(&prefs);
@@ -1357,7 +1357,7 @@
   // Setup an environment with persistent prefs across simulated reboots.
   EXPECT_TRUE(utils::MakeTempDirectory("PayloadStateReboot.XXXXXX",
                                        &temp_dir));
-  prefs.Init(FilePath(temp_dir));
+  prefs.Init(base::FilePath(temp_dir));
   mock_system_state.set_prefs(&prefs);
 
   FakeHardware* fake_hardware = mock_system_state.get_fake_hardware();
@@ -1407,7 +1407,7 @@
   // Setup an environment with persistent prefs across simulated reboots.
   EXPECT_TRUE(utils::MakeTempDirectory("PayloadStateReboot.XXXXXX",
                                        &temp_dir));
-  prefs.Init(FilePath(temp_dir));
+  prefs.Init(base::FilePath(temp_dir));
   mock_system_state.set_prefs(&prefs);
 
   FakeHardware* fake_hardware = mock_system_state.get_fake_hardware();
@@ -1447,7 +1447,7 @@
   // Setup an environment with persistent prefs across simulated reboots.
   EXPECT_TRUE(utils::MakeTempDirectory("PayloadStateReboot.XXXXXX",
                                        &temp_dir));
-  prefs.Init(FilePath(temp_dir));
+  prefs.Init(base::FilePath(temp_dir));
   mock_system_state.set_prefs(&prefs);
 
   EXPECT_TRUE(payload_state.Initialize(&mock_system_state));
@@ -1480,7 +1480,7 @@
   // Setup an environment with persistent but initially empty prefs.
   EXPECT_TRUE(utils::MakeTempDirectory("PayloadStateReboot.XXXXXX",
                                        &temp_dir));
-  prefs.Init(FilePath(temp_dir));
+  prefs.Init(base::FilePath(temp_dir));
   mock_system_state.set_prefs(&prefs);
 
   EXPECT_TRUE(payload_state.Initialize(&mock_system_state));
@@ -1505,7 +1505,7 @@
   // We need persistent preferences for this test.
   EXPECT_TRUE(utils::MakeTempDirectory("PayloadStateP2PTests.XXXXXX",
                                        &temp_dir));
-  prefs.Init(FilePath(temp_dir));
+  prefs.Init(base::FilePath(temp_dir));
 
   mock_system_state.set_prefs(&prefs);
   EXPECT_TRUE(payload_state.Initialize(&mock_system_state));
@@ -1534,7 +1534,7 @@
   // We need persistent preferences for this test.
   EXPECT_TRUE(utils::MakeTempDirectory("PayloadStateP2PTests.XXXXXX",
                                        &temp_dir));
-  prefs.Init(FilePath(temp_dir));
+  prefs.Init(base::FilePath(temp_dir));
 
   mock_system_state.set_clock(&fake_clock);
   mock_system_state.set_prefs(&prefs);
@@ -1585,7 +1585,7 @@
 
   EXPECT_TRUE(utils::MakeTempDirectory("PayloadStateP2PTests.XXXXXX",
                                        &temp_dir));
-  prefs.Init(FilePath(temp_dir));
+  prefs.Init(base::FilePath(temp_dir));
   mock_system_state.set_prefs(&prefs);
   EXPECT_TRUE(payload_state.Initialize(&mock_system_state));
   SetupPayloadStateWith2Urls("Hash8593", true, &payload_state, &response);
@@ -1607,7 +1607,7 @@
 
   EXPECT_TRUE(utils::MakeTempDirectory("PayloadStateP2PTests.XXXXXX",
                                        &temp_dir));
-  prefs.Init(FilePath(temp_dir));
+  prefs.Init(base::FilePath(temp_dir));
   mock_system_state.set_clock(&fake_clock);
   mock_system_state.set_prefs(&prefs);
   EXPECT_TRUE(payload_state.Initialize(&mock_system_state));
@@ -1642,7 +1642,7 @@
 
   EXPECT_TRUE(utils::MakeTempDirectory("PayloadStateP2PTests.XXXXXX",
                                        &temp_dir));
-  prefs.Init(FilePath(temp_dir));
+  prefs.Init(base::FilePath(temp_dir));
   mock_system_state.set_clock(&fake_clock);
   mock_system_state.set_prefs(&prefs);
   EXPECT_TRUE(payload_state.Initialize(&mock_system_state));
diff --git a/policy_manager/evaluation_context.h b/policy_manager/evaluation_context.h
index e7b922f..dc7e53f 100644
--- a/policy_manager/evaluation_context.h
+++ b/policy_manager/evaluation_context.h
@@ -10,7 +10,7 @@
 #include <base/callback.h>
 #include <base/memory/ref_counted.h>
 #include <base/memory/weak_ptr.h>
-#include <base/time.h>
+#include <base/time/time.h>
 
 #include "update_engine/policy_manager/boxed_value.h"
 #include "update_engine/policy_manager/event_loop.h"
diff --git a/policy_manager/event_loop.h b/policy_manager/event_loop.h
index a8474ba..8a1e59e 100644
--- a/policy_manager/event_loop.h
+++ b/policy_manager/event_loop.h
@@ -12,7 +12,7 @@
 #include <glib.h>
 
 #include <base/callback.h>
-#include <base/time.h>
+#include <base/time/time.h>
 
 namespace chromeos_policy_manager {
 
diff --git a/policy_manager/real_random_provider.cc b/policy_manager/real_random_provider.cc
index 17ab024..4c8ae85 100644
--- a/policy_manager/real_random_provider.cc
+++ b/policy_manager/real_random_provider.cc
@@ -5,9 +5,9 @@
 #include <stdio.h>
 #include <unistd.h>
 
-#include <base/file_path.h>
+#include <base/files/file_path.h>
 #include <base/file_util.h>
-#include <base/stringprintf.h>
+#include <base/strings/stringprintf.h>
 
 #include "update_engine/policy_manager/real_random_provider.h"
 #include "update_engine/policy_manager/variable.h"
@@ -46,8 +46,8 @@
       if (rd == 0 || ferror(fp_.get())) {
         // Either EOF on fp or read failed.
         if (errmsg) {
-          *errmsg = StringPrintf("Error reading from the random device: %s",
-                                 kRandomDevice);
+          *errmsg = base::StringPrintf(
+              "Error reading from the random device: %s", kRandomDevice);
         }
         return NULL;
       }
diff --git a/policy_manager/real_random_provider_unittest.cc b/policy_manager/real_random_provider_unittest.cc
index 39a2a0e..acd4bb0 100644
--- a/policy_manager/real_random_provider_unittest.cc
+++ b/policy_manager/real_random_provider_unittest.cc
@@ -3,7 +3,7 @@
 // found in the LICENSE file.
 
 #include <base/memory/scoped_ptr.h>
-#include <base/time.h>
+#include <base/time/time.h>
 #include <gtest/gtest.h>
 
 #include "update_engine/policy_manager/pmtest_utils.h"
diff --git a/policy_manager/real_shill_provider.cc b/policy_manager/real_shill_provider.cc
index 48d01e6..90973e4 100644
--- a/policy_manager/real_shill_provider.cc
+++ b/policy_manager/real_shill_provider.cc
@@ -7,7 +7,7 @@
 #include <string>
 
 #include <base/logging.h>
-#include <base/stringprintf.h>
+#include <base/strings/stringprintf.h>
 #include <chromeos/dbus/service_constants.h>
 
 #include "update_engine/policy_manager/generic_variables.h"
@@ -157,7 +157,7 @@
       if (!connector_->GetConnectionType(provider_->default_service_path_,
                                          &conn_type)) {
         if (errmsg)
-          *errmsg = StringPrintf(
+          *errmsg = base::StringPrintf(
               "Could not retrieve type of default connection (%s)",
               provider_->default_service_path_.c_str());
         return NULL;
diff --git a/policy_manager/real_shill_provider.h b/policy_manager/real_shill_provider.h
index 55125bc..f50f2ac 100644
--- a/policy_manager/real_shill_provider.h
+++ b/policy_manager/real_shill_provider.h
@@ -11,7 +11,7 @@
 
 #include <string>
 
-#include <base/time.h>
+#include <base/time/time.h>
 
 #include "update_engine/clock_interface.h"
 #include "update_engine/dbus_wrapper_interface.h"
diff --git a/policy_manager/real_shill_provider_unittest.cc b/policy_manager/real_shill_provider_unittest.cc
index da1477a..494d609 100644
--- a/policy_manager/real_shill_provider_unittest.cc
+++ b/policy_manager/real_shill_provider_unittest.cc
@@ -3,7 +3,7 @@
 // found in the LICENSE file.
 
 #include <base/memory/scoped_ptr.h>
-#include <base/time.h>
+#include <base/time/time.h>
 #include <chromeos/dbus/service_constants.h>
 #include <glib.h>
 #include <gtest/gtest.h>
diff --git a/policy_manager/real_time_provider.cc b/policy_manager/real_time_provider.cc
index 0c20e2e..d66dd6f 100644
--- a/policy_manager/real_time_provider.cc
+++ b/policy_manager/real_time_provider.cc
@@ -4,7 +4,7 @@
 
 #include "update_engine/policy_manager/real_time_provider.h"
 
-#include <base/time.h>
+#include <base/time/time.h>
 
 #include "update_engine/clock_interface.h"
 
diff --git a/policy_manager/real_time_provider.h b/policy_manager/real_time_provider.h
index 447f435..49d8896 100644
--- a/policy_manager/real_time_provider.h
+++ b/policy_manager/real_time_provider.h
@@ -5,7 +5,7 @@
 #ifndef CHROMEOS_PLATFORM_UPDATE_ENGINE_POLICY_MANAGER_REAL_TIME_PROVIDER_H_
 #define CHROMEOS_PLATFORM_UPDATE_ENGINE_POLICY_MANAGER_REAL_TIME_PROVIDER_H_
 
-#include <base/time.h>
+#include <base/time/time.h>
 
 #include "update_engine/clock_interface.h"
 #include "update_engine/policy_manager/time_provider.h"
diff --git a/policy_manager/real_time_provider_unittest.cc b/policy_manager/real_time_provider_unittest.cc
index 1ac9083..cec2ed6 100644
--- a/policy_manager/real_time_provider_unittest.cc
+++ b/policy_manager/real_time_provider_unittest.cc
@@ -4,7 +4,7 @@
 
 #include <base/logging.h>
 #include <base/memory/scoped_ptr.h>
-#include <base/time.h>
+#include <base/time/time.h>
 #include <gtest/gtest.h>
 
 #include "update_engine/fake_clock.h"
diff --git a/policy_manager/shill_provider.h b/policy_manager/shill_provider.h
index 82405b6..4fbfedd 100644
--- a/policy_manager/shill_provider.h
+++ b/policy_manager/shill_provider.h
@@ -6,7 +6,7 @@
 #define CHROMEOS_PLATFORM_UPDATE_ENGINE_POLICY_MANAGER_SHILL_PROVIDER_H_
 
 #include <base/memory/scoped_ptr.h>
-#include <base/time.h>
+#include <base/time/time.h>
 
 #include "update_engine/policy_manager/provider.h"
 #include "update_engine/policy_manager/variable.h"
diff --git a/policy_manager/time_provider.h b/policy_manager/time_provider.h
index d09097b..7b8bbd9 100644
--- a/policy_manager/time_provider.h
+++ b/policy_manager/time_provider.h
@@ -6,7 +6,7 @@
 #define CHROMEOS_PLATFORM_UPDATE_ENGINE_POLICY_MANAGER_TIME_PROVIDER_H_
 
 #include <base/memory/scoped_ptr.h>
-#include <base/time.h>
+#include <base/time/time.h>
 
 #include "update_engine/policy_manager/provider.h"
 #include "update_engine/policy_manager/variable.h"
diff --git a/policy_manager/variable.h b/policy_manager/variable.h
index 8966a9a..eace46e 100644
--- a/policy_manager/variable.h
+++ b/policy_manager/variable.h
@@ -11,7 +11,7 @@
 
 #include <base/bind.h>
 #include <base/logging.h>
-#include <base/time.h>
+#include <base/time/time.h>
 #include <gtest/gtest_prod.h>  // for FRIEND_TEST
 
 #include "update_engine/policy_manager/event_loop.h"
diff --git a/postinstall_runner_action_unittest.cc b/postinstall_runner_action_unittest.cc
index e6995e3..891afc5 100644
--- a/postinstall_runner_action_unittest.cc
+++ b/postinstall_runner_action_unittest.cc
@@ -12,8 +12,8 @@
 #include <vector>
 
 #include <base/file_util.h>
-#include <base/string_util.h>
-#include <base/stringprintf.h>
+#include <base/strings/string_util.h>
+#include <base/strings/stringprintf.h>
 #include <gtest/gtest.h>
 
 #include "update_engine/constants.h"
@@ -138,13 +138,14 @@
 
   // Generate a fake postinst script inside the image.
   string script = (err_code ?
-                   StringPrintf("#!/bin/bash\nexit %d", err_code) :
-                   StringPrintf("#!/bin/bash\n"
-                                "mount | grep au_postint_mount | grep ext2\n"
-                                "if [ $? -eq 0 ]; then\n"
-                                "  touch %s/postinst_called\n"
-                                "fi\n",
-                                cwd.c_str()));
+                   base::StringPrintf("#!/bin/bash\nexit %d", err_code) :
+                   base::StringPrintf(
+                       "#!/bin/bash\n"
+                       "mount | grep au_postint_mount | grep ext2\n"
+                       "if [ $? -eq 0 ]; then\n"
+                       "  touch %s/postinst_called\n"
+                       "fi\n",
+                       cwd.c_str()));
   const string script_file_name = mountpoint + "/postinst";
   ASSERT_TRUE(WriteFileString(script_file_name, script));
   ASSERT_EQ(0, System(string("chmod a+x ") + script_file_name));
@@ -195,14 +196,14 @@
   if (should_succeed)
     EXPECT_TRUE(install_plan == collector_action.object());
 
-  const FilePath kPowerwashMarkerPath(powerwash_marker_file);
+  const base::FilePath kPowerwashMarkerPath(powerwash_marker_file);
   string actual_cmd;
   if (should_succeed && powerwash_required) {
-    EXPECT_TRUE(file_util::ReadFileToString(kPowerwashMarkerPath, &actual_cmd));
+    EXPECT_TRUE(base::ReadFileToString(kPowerwashMarkerPath, &actual_cmd));
     EXPECT_EQ(kPowerwashCommand, actual_cmd);
   } else {
     EXPECT_FALSE(
-        file_util::ReadFileToString(kPowerwashMarkerPath, &actual_cmd));
+        base::ReadFileToString(kPowerwashMarkerPath, &actual_cmd));
   }
 
   if (err_code == 2)
diff --git a/prefs.cc b/prefs.cc
index dda1919..c1e249c 100644
--- a/prefs.cc
+++ b/prefs.cc
@@ -6,8 +6,8 @@
 
 #include <base/file_util.h>
 #include <base/logging.h>
-#include <base/string_number_conversions.h>
-#include <base/string_util.h>
+#include <base/strings/string_number_conversions.h>
+#include <base/strings/string_util.h>
 
 #include "update_engine/utils.h"
 
@@ -15,15 +15,15 @@
 
 namespace chromeos_update_engine {
 
-bool Prefs::Init(const FilePath& prefs_dir) {
+bool Prefs::Init(const base::FilePath& prefs_dir) {
   prefs_dir_ = prefs_dir;
   return true;
 }
 
 bool Prefs::GetString(const string& key, string* value) {
-  FilePath filename;
+  base::FilePath filename;
   TEST_AND_RETURN_FALSE(GetFileNameForKey(key, &filename));
-  if (!file_util::ReadFileToString(filename, value)) {
+  if (!base::ReadFileToString(filename, value)) {
     LOG(INFO) << key << " not present in " << prefs_dir_.value();
     return false;
   }
@@ -31,9 +31,9 @@
 }
 
 bool Prefs::SetString(const std::string& key, const std::string& value) {
-  FilePath filename;
+  base::FilePath filename;
   TEST_AND_RETURN_FALSE(GetFileNameForKey(key, &filename));
-  TEST_AND_RETURN_FALSE(file_util::CreateDirectory(filename.DirName()));
+  TEST_AND_RETURN_FALSE(base::CreateDirectory(filename.DirName()));
   TEST_AND_RETURN_FALSE(
       file_util::WriteFile(filename, value.data(), value.size()) ==
       static_cast<int>(value.size()));
@@ -74,18 +74,19 @@
 }
 
 bool Prefs::Exists(const string& key) {
-  FilePath filename;
+  base::FilePath filename;
   TEST_AND_RETURN_FALSE(GetFileNameForKey(key, &filename));
-  return file_util::PathExists(filename);
+  return base::PathExists(filename);
 }
 
 bool Prefs::Delete(const string& key) {
-  FilePath filename;
+  base::FilePath filename;
   TEST_AND_RETURN_FALSE(GetFileNameForKey(key, &filename));
-  return file_util::Delete(filename, false);
+  return base::DeleteFile(filename, false);
 }
 
-bool Prefs::GetFileNameForKey(const std::string& key, FilePath* filename) {
+bool Prefs::GetFileNameForKey(const std::string& key,
+                              base::FilePath* filename) {
   // Allows only non-empty keys containing [A-Za-z0-9_-].
   TEST_AND_RETURN_FALSE(!key.empty());
   for (size_t i = 0; i < key.size(); ++i) {
diff --git a/prefs.h b/prefs.h
index e119389..f05da0a 100644
--- a/prefs.h
+++ b/prefs.h
@@ -5,7 +5,7 @@
 #ifndef CHROMEOS_PLATFORM_UPDATE_ENGINE_PREFS_H_
 #define CHROMEOS_PLATFORM_UPDATE_ENGINE_PREFS_H_
 
-#include "base/file_path.h"
+#include <base/files/file_path.h>
 #include "gtest/gtest_prod.h"  // for FRIEND_TEST
 #include "update_engine/prefs_interface.h"
 
@@ -22,7 +22,7 @@
   // Initializes the store by associating this object with |prefs_dir|
   // as the preference store directory. Returns true on success, false
   // otherwise.
-  bool Init(const FilePath& prefs_dir);
+  bool Init(const base::FilePath& prefs_dir);
 
   // PrefsInterface methods.
   bool GetString(const std::string& key, std::string* value);
@@ -42,10 +42,10 @@
 
   // Sets |filename| to the full path to the file containing the data
   // associated with |key|. Returns true on success, false otherwise.
-  bool GetFileNameForKey(const std::string& key, FilePath* filename);
+  bool GetFileNameForKey(const std::string& key, base::FilePath* filename);
 
   // Preference store directory.
-  FilePath prefs_dir_;
+  base::FilePath prefs_dir_;
 
   DISALLOW_COPY_AND_ASSIGN(Prefs);
 };
diff --git a/prefs_unittest.cc b/prefs_unittest.cc
index d2a07ee..a3595a3 100644
--- a/prefs_unittest.cc
+++ b/prefs_unittest.cc
@@ -8,8 +8,8 @@
 
 #include "base/basictypes.h"
 #include "base/file_util.h"
-#include "base/string_util.h"
-#include "base/stringprintf.h"
+#include <base/strings/string_util.h>
+#include <base/strings/stringprintf.h>
 #include "gtest/gtest.h"
 #include "update_engine/prefs.h"
 
@@ -20,12 +20,12 @@
 class PrefsTest : public ::testing::Test {
  protected:
   virtual void SetUp() {
-    ASSERT_TRUE(file_util::CreateNewTempDirectory("auprefs", &prefs_dir_));
+    ASSERT_TRUE(base::CreateNewTempDirectory("auprefs", &prefs_dir_));
     ASSERT_TRUE(prefs_.Init(prefs_dir_));
   }
 
   virtual void TearDown() {
-    file_util::Delete(prefs_dir_, true);  // recursive
+    base::DeleteFile(prefs_dir_, true);  // recursive
   }
 
   bool SetValue(const string& key, const string& value) {
@@ -34,24 +34,24 @@
         static_cast<int>(value.length());
   }
 
-  FilePath prefs_dir_;
+  base::FilePath prefs_dir_;
   Prefs prefs_;
 };
 
 TEST_F(PrefsTest, GetFileNameForKey) {
   const char kKey[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_-";
-  FilePath path;
+  base::FilePath path;
   EXPECT_TRUE(prefs_.GetFileNameForKey(kKey, &path));
   EXPECT_EQ(prefs_dir_.Append(kKey).value(), path.value());
 }
 
 TEST_F(PrefsTest, GetFileNameForKeyBadCharacter) {
-  FilePath path;
+  base::FilePath path;
   EXPECT_FALSE(prefs_.GetFileNameForKey("ABC abc", &path));
 }
 
 TEST_F(PrefsTest, GetFileNameForKeyEmpty) {
-  FilePath path;
+  base::FilePath path;
   EXPECT_FALSE(prefs_.GetFileNameForKey("", &path));
 }
 
@@ -79,38 +79,38 @@
   const char kValue[] = "some test value\non 2 lines";
   EXPECT_TRUE(prefs_.SetString(kKey, kValue));
   string value;
-  EXPECT_TRUE(file_util::ReadFileToString(prefs_dir_.Append(kKey), &value));
+  EXPECT_TRUE(base::ReadFileToString(prefs_dir_.Append(kKey), &value));
   EXPECT_EQ(kValue, value);
 }
 
 TEST_F(PrefsTest, SetStringBadKey) {
   const char kKey[] = ".no-dots";
   EXPECT_FALSE(prefs_.SetString(kKey, "some value"));
-  EXPECT_FALSE(file_util::PathExists(prefs_dir_.Append(kKey)));
+  EXPECT_FALSE(base::PathExists(prefs_dir_.Append(kKey)));
 }
 
 TEST_F(PrefsTest, SetStringCreateDir) {
   const char kKey[] = "a-test-key";
   const char kValue[] = "test value";
-  FilePath subdir = prefs_dir_.Append("subdir1").Append("subdir2");
+  base::FilePath subdir = prefs_dir_.Append("subdir1").Append("subdir2");
   EXPECT_TRUE(prefs_.Init(subdir));
   EXPECT_TRUE(prefs_.SetString(kKey, kValue));
   string value;
-  EXPECT_TRUE(file_util::ReadFileToString(subdir.Append(kKey), &value));
+  EXPECT_TRUE(base::ReadFileToString(subdir.Append(kKey), &value));
   EXPECT_EQ(kValue, value);
 }
 
 TEST_F(PrefsTest, SetStringDirCreationFailure) {
-  EXPECT_TRUE(prefs_.Init(FilePath("/dev/null")));
+  EXPECT_TRUE(prefs_.Init(base::FilePath("/dev/null")));
   const char kKey[] = "test-key";
   EXPECT_FALSE(prefs_.SetString(kKey, "test value"));
 }
 
 TEST_F(PrefsTest, SetStringFileCreationFailure) {
   const char kKey[] = "a-test-key";
-  file_util::CreateDirectory(prefs_dir_.Append(kKey));
+  base::CreateDirectory(prefs_dir_.Append(kKey));
   EXPECT_FALSE(prefs_.SetString(kKey, "test value"));
-  EXPECT_TRUE(file_util::DirectoryExists(prefs_dir_.Append(kKey)));
+  EXPECT_TRUE(base::DirectoryExists(prefs_dir_.Append(kKey)));
 }
 
 TEST_F(PrefsTest, GetInt64) {
@@ -130,7 +130,7 @@
 
 TEST_F(PrefsTest, GetInt64Max) {
   const char kKey[] = "test-key";
-  ASSERT_TRUE(SetValue(kKey, StringPrintf("%" PRIi64, kint64max)));
+  ASSERT_TRUE(SetValue(kKey, base::StringPrintf("%" PRIi64, kint64max)));
   int64_t value;
   EXPECT_TRUE(prefs_.GetInt64(kKey, &value));
   EXPECT_EQ(kint64max, value);
@@ -138,7 +138,7 @@
 
 TEST_F(PrefsTest, GetInt64Min) {
   const char kKey[] = "test-key";
-  ASSERT_TRUE(SetValue(kKey, StringPrintf("%" PRIi64, kint64min)));
+  ASSERT_TRUE(SetValue(kKey, base::StringPrintf("%" PRIi64, kint64min)));
   int64_t value;
   EXPECT_TRUE(prefs_.GetInt64(kKey, &value));
   EXPECT_EQ(kint64min, value);
@@ -161,30 +161,30 @@
   const char kKey[] = "test_int";
   EXPECT_TRUE(prefs_.SetInt64(kKey, -123));
   string value;
-  EXPECT_TRUE(file_util::ReadFileToString(prefs_dir_.Append(kKey), &value));
+  EXPECT_TRUE(base::ReadFileToString(prefs_dir_.Append(kKey), &value));
   EXPECT_EQ("-123", value);
 }
 
 TEST_F(PrefsTest, SetInt64BadKey) {
   const char kKey[] = "s p a c e s";
   EXPECT_FALSE(prefs_.SetInt64(kKey, 20));
-  EXPECT_FALSE(file_util::PathExists(prefs_dir_.Append(kKey)));
+  EXPECT_FALSE(base::PathExists(prefs_dir_.Append(kKey)));
 }
 
 TEST_F(PrefsTest, SetInt64Max) {
   const char kKey[] = "test-max-int";
   EXPECT_TRUE(prefs_.SetInt64(kKey, kint64max));
   string value;
-  EXPECT_TRUE(file_util::ReadFileToString(prefs_dir_.Append(kKey), &value));
-  EXPECT_EQ(StringPrintf("%" PRIi64, kint64max), value);
+  EXPECT_TRUE(base::ReadFileToString(prefs_dir_.Append(kKey), &value));
+  EXPECT_EQ(base::StringPrintf("%" PRIi64, kint64max), value);
 }
 
 TEST_F(PrefsTest, SetInt64Min) {
   const char kKey[] = "test-min-int";
   EXPECT_TRUE(prefs_.SetInt64(kKey, kint64min));
   string value;
-  EXPECT_TRUE(file_util::ReadFileToString(prefs_dir_.Append(kKey), &value));
-  EXPECT_EQ(StringPrintf("%" PRIi64, kint64min), value);
+  EXPECT_TRUE(base::ReadFileToString(prefs_dir_.Append(kKey), &value));
+  EXPECT_EQ(base::StringPrintf("%" PRIi64, kint64min), value);
 }
 
 TEST_F(PrefsTest, GetBooleanFalse) {
@@ -226,7 +226,7 @@
   const char kKey[] = "test-bool";
   EXPECT_TRUE(prefs_.SetBoolean(kKey, true));
   string value;
-  EXPECT_TRUE(file_util::ReadFileToString(prefs_dir_.Append(kKey), &value));
+  EXPECT_TRUE(base::ReadFileToString(prefs_dir_.Append(kKey), &value));
   EXPECT_EQ("true", value);
 }
 
@@ -234,14 +234,14 @@
   const char kKey[] = "test-bool";
   EXPECT_TRUE(prefs_.SetBoolean(kKey, false));
   string value;
-  EXPECT_TRUE(file_util::ReadFileToString(prefs_dir_.Append(kKey), &value));
+  EXPECT_TRUE(base::ReadFileToString(prefs_dir_.Append(kKey), &value));
   EXPECT_EQ("false", value);
 }
 
 TEST_F(PrefsTest, SetBooleanBadKey) {
   const char kKey[] = "s p a c e s";
   EXPECT_FALSE(prefs_.SetBoolean(kKey, true));
-  EXPECT_FALSE(file_util::PathExists(prefs_dir_.Append(kKey)));
+  EXPECT_FALSE(base::PathExists(prefs_dir_.Append(kKey)));
 }
 
 TEST_F(PrefsTest, ExistsWorks) {
diff --git a/real_system_state.cc b/real_system_state.cc
index e675aad..b554eb4 100644
--- a/real_system_state.cc
+++ b/real_system_state.cc
@@ -3,7 +3,7 @@
 // found in the LICENSE file.
 
 #include <base/file_util.h>
-#include <base/time.h>
+#include <base/time/time.h>
 
 #include "update_engine/constants.h"
 #include "update_engine/real_system_state.h"
@@ -14,21 +14,21 @@
 static const char kOOBECompletedMarker[] = "/home/chronos/.oobe_completed";
 
 RealSystemState::RealSystemState()
-    : device_policy_(NULL),
+    : device_policy_(nullptr),
       connection_manager_(this),
       request_params_(this),
-      p2p_manager_(NULL),
+      p2p_manager_(),
       system_rebooted_(false) {}
 
 bool RealSystemState::Initialize(bool enable_gpio) {
   metrics_lib_.Init();
 
-  if (!prefs_.Init(FilePath(kPrefsDirectory))) {
+  if (!prefs_.Init(base::FilePath(kPrefsDirectory))) {
     LOG(ERROR) << "Failed to initialize preferences.";
     return false;
   }
 
-  if (!powerwash_safe_prefs_.Init(FilePath(kPowerwashSafePrefsDir))) {
+  if (!powerwash_safe_prefs_.Init(base::FilePath(kPowerwashSafePrefsDir))) {
     LOG(ERROR) << "Failed to initialize powerwash preferences.";
     return false;
   }
diff --git a/simple_key_value_store.cc b/simple_key_value_store.cc
index 78e191e..24e9bc9 100644
--- a/simple_key_value_store.cc
+++ b/simple_key_value_store.cc
@@ -6,8 +6,8 @@
 #include <map>
 #include <string>
 #include <vector>
-#include "base/string_split.h"
-#include "base/string_util.h"
+#include <base/strings/string_split.h>
+#include <base/strings/string_util.h>
 
 using std::map;
 using std::string;
diff --git a/simple_key_value_store_unittest.cc b/simple_key_value_store_unittest.cc
index b8ca384..b85d3ad 100644
--- a/simple_key_value_store_unittest.cc
+++ b/simple_key_value_store_unittest.cc
@@ -5,7 +5,7 @@
 #include <map>
 #include <string>
 #include <gtest/gtest.h>
-#include "base/string_util.h"
+#include <base/strings/string_util.h>
 #include "update_engine/simple_key_value_store.h"
 
 using std::map;
diff --git a/subprocess.cc b/subprocess.cc
index b7bcb0d..7021cc5 100644
--- a/subprocess.cc
+++ b/subprocess.cc
@@ -13,8 +13,8 @@
 
 #include <base/logging.h>
 #include <base/memory/scoped_ptr.h>
-#include <base/string_util.h>
-#include <base/stringprintf.h>
+#include <base/strings/string_util.h>
+#include <base/strings/stringprintf.h>
 
 #include "update_engine/utils.h"
 
@@ -93,8 +93,8 @@
   int pointer = 0;
   for (size_t i = 0; i < arraysize(keys); i++) {
     if (getenv(keys[i])) {
-      ret[pointer] = strdup(StringPrintf("%s=%s", keys[i],
-                                         getenv(keys[i])).c_str());
+      ret[pointer] = strdup(base::StringPrintf("%s=%s", keys[i],
+                                               getenv(keys[i])).c_str());
       if (!ret[pointer]) {
         FreeArgv(ret);
         delete [] ret;
diff --git a/subprocess_unittest.cc b/subprocess_unittest.cc
index cb295e1..efda13b 100644
--- a/subprocess_unittest.cc
+++ b/subprocess_unittest.cc
@@ -13,9 +13,9 @@
 #include <string>
 #include <vector>
 
-#include <base/string_util.h>
-#include <base/stringprintf.h>
-#include <base/time.h>
+#include <base/strings/string_util.h>
+#include <base/strings/stringprintf.h>
+#include <base/time/time.h>
 #include <glib.h>
 #include <gtest/gtest.h>
 
@@ -181,8 +181,8 @@
     // tear down the sub process
     printf("tear down time\n");
     int status = System(
-        StringPrintf("wget -O /dev/null http://127.0.0.1:%d/quitquitquit",
-                     local_server_port));
+        base::StringPrintf("wget -O /dev/null http://127.0.0.1:%d/quitquitquit",
+                           local_server_port));
     EXPECT_NE(-1, status) << "system() failed";
     EXPECT_TRUE(WIFEXITED(status))
         << "command failed to run or died abnormally";
diff --git a/system_state.h b/system_state.h
index 648d9c6..8668542 100644
--- a/system_state.h
+++ b/system_state.h
@@ -5,7 +5,7 @@
 #ifndef CHROMEOS_PLATFORM_UPDATE_ENGINE_SYSTEM_STATE_H_
 #define CHROMEOS_PLATFORM_UPDATE_ENGINE_SYSTEM_STATE_H_
 
-#include <base/time.h>
+#include <base/time/time.h>
 #include "metrics/metrics_library.h"
 #include <policy/device_policy.h>
 #include <policy/libpolicy.h>
diff --git a/test_http_server.cc b/test_http_server.cc
index 92904ad..a94f554 100644
--- a/test_http_server.cc
+++ b/test_http_server.cc
@@ -29,9 +29,9 @@
 #include <vector>
 
 #include <base/logging.h>
-#include <base/string_split.h>
-#include <base/string_util.h>
-#include <base/stringprintf.h>
+#include <base/strings/string_split.h>
+#include <base/strings/string_util.h>
+#include <base/strings/stringprintf.h>
 
 #include "update_engine/http_common.h"
 
@@ -115,11 +115,12 @@
       if (range.find('-') < range.length() - 1)
         request->end_offset = atoll(range.c_str() + range.find('-') + 1) + 1;
       request->return_code = kHttpResponsePartialContent;
-      std::string tmp_str = StringPrintf("decoded range offsets: start=%jd "
-                                         "end=", request->start_offset);
+      std::string tmp_str = base::StringPrintf("decoded range offsets: "
+                                               "start=%jd end=",
+                                               (intmax_t)request->start_offset);
       if (request->end_offset > 0)
         base::StringAppendF(&tmp_str, "%jd (non-inclusive)",
-                            request->end_offset);
+                            (intmax_t)request->end_offset);
       else
         base::StringAppendF(&tmp_str, "unspecified");
       LOG(INFO) << tmp_str;
@@ -591,7 +592,7 @@
   // unit tests, avoid unilateral changes; (b) it is necessary to flush/sync the
   // file to prevent the spawning process from waiting indefinitely for this
   // message.
-  string listening_msg = StringPrintf("%s%hu", kListeningMsgPrefix, port);
+  string listening_msg = base::StringPrintf("%s%hu", kListeningMsgPrefix, port);
   LOG(INFO) << listening_msg;
   CHECK_EQ(write(report_fd, listening_msg.c_str(), listening_msg.length()),
            static_cast<int>(listening_msg.length()));
diff --git a/test_utils.cc b/test_utils.cc
index 8391c8e..0005f03 100644
--- a/test_utils.cc
+++ b/test_utils.cc
@@ -15,8 +15,8 @@
 #include <string>
 #include <vector>
 
-#include "base/string_util.h"
-#include <base/stringprintf.h>
+#include <base/strings/string_util.h>
+#include <base/strings/stringprintf.h>
 #include "base/logging.h"
 #include "update_engine/file_writer.h"
 #include "update_engine/filesystem_iterator.h"
@@ -25,6 +25,7 @@
 using std::set;
 using std::string;
 using std::vector;
+using base::StringPrintf;
 
 namespace chromeos_update_engine {
 
diff --git a/update_attempter.cc b/update_attempter.cc
index 40c7e29..d5c2d98 100644
--- a/update_attempter.cc
+++ b/update_attempter.cc
@@ -12,7 +12,7 @@
 #include <base/file_util.h>
 #include <base/logging.h>
 #include <base/rand_util.h>
-#include <base/stringprintf.h>
+#include <base/strings/stringprintf.h>
 #include <chromeos/dbus/service_constants.h>
 
 #include <glib.h>
@@ -854,7 +854,7 @@
     return;
 
   int64_t value = system_state_->clock()->GetBootTime().ToInternalValue();
-  string contents = StringPrintf("%" PRIi64, value);
+  string contents = base::StringPrintf("%" PRIi64, value);
 
   utils::WriteFile(update_completed_marker_.c_str(),
                    contents.c_str(),
@@ -1072,8 +1072,7 @@
       // after resetting to idle state, it doesn't go back to
       // UPDATE_STATUS_UPDATED_NEED_REBOOT state.
       if (!update_completed_marker_.empty()) {
-        const FilePath update_completed_marker_path(update_completed_marker_);
-        if (!file_util::Delete(update_completed_marker_path, false))
+        if (!base::DeleteFile(base::FilePath(update_completed_marker_), false))
           ret_value = false;
       }
 
diff --git a/update_attempter.h b/update_attempter.h
index 425d8ed..d76d168 100644
--- a/update_attempter.h
+++ b/update_attempter.h
@@ -11,7 +11,7 @@
 #include <string>
 #include <vector>
 
-#include <base/time.h>
+#include <base/time/time.h>
 #include <glib.h>
 #include <gtest/gtest_prod.h>  // for FRIEND_TEST
 
diff --git a/update_attempter_unittest.cc b/update_attempter_unittest.cc
index ac5bbe1..c67185c 100644
--- a/update_attempter_unittest.cc
+++ b/update_attempter_unittest.cc
@@ -205,7 +205,7 @@
           "update_attempter_unittest-update_completed_marker-XXXXXX",
           &test_update_completed_marker, NULL));
   ScopedPathUnlinker completed_marker_unlinker(test_update_completed_marker);
-  const FilePath marker(test_update_completed_marker);
+  const base::FilePath marker(test_update_completed_marker);
   EXPECT_EQ(0, file_util::WriteFile(marker, "", 0));
   UpdateAttempterUnderTest attempter(&mock_system_state_, &dbus_,
                                      test_update_completed_marker);
@@ -951,7 +951,7 @@
                                        &prefs_dir));
   ScopedDirRemover temp_dir_remover(prefs_dir);
 
-  LOG_IF(ERROR, !prefs.Init(FilePath(prefs_dir)))
+  LOG_IF(ERROR, !prefs.Init(base::FilePath(prefs_dir)))
       << "Failed to initialize preferences.";
   EXPECT_TRUE(prefs.SetInt64(kPrefsUpdateCheckCount, initial_value));
 
@@ -1018,7 +1018,7 @@
                                        &prefs_dir));
   ScopedDirRemover temp_dir_remover(prefs_dir);
 
-  LOG_IF(ERROR, !prefs.Init(FilePath(prefs_dir)))
+  LOG_IF(ERROR, !prefs.Init(base::FilePath(prefs_dir)))
       << "Failed to initialize preferences.";
   EXPECT_TRUE(prefs.SetInt64(kPrefsWallClockWaitPeriod, initial_value));
   EXPECT_TRUE(prefs.SetInt64(kPrefsUpdateCheckCount, initial_value));
@@ -1065,7 +1065,7 @@
   // We need persistent preferences for this test
   EXPECT_TRUE(utils::MakeTempDirectory("UpdateCheckScheduler.XXXXXX",
                                        &temp_dir));
-  prefs.Init(FilePath(temp_dir));
+  prefs.Init(base::FilePath(temp_dir));
   mock_system_state_.set_clock(&fake_clock);
   mock_system_state_.set_prefs(&prefs);
 
diff --git a/utils.cc b/utils.cc
index 70b9c75..e67abb2 100644
--- a/utils.cc
+++ b/utils.cc
@@ -21,15 +21,15 @@
 #include <algorithm>
 #include <vector>
 
-#include <base/file_path.h>
+#include <base/files/file_path.h>
 #include <base/file_util.h>
 #include <base/logging.h>
 #include <base/posix/eintr_wrapper.h>
 #include <base/rand_util.h>
-#include <base/string_number_conversions.h>
-#include <base/string_split.h>
-#include <base/string_util.h>
-#include <base/stringprintf.h>
+#include <base/strings/string_number_conversions.h>
+#include <base/strings/string_split.h>
+#include <base/strings/string_util.h>
+#include <base/strings/stringprintf.h>
 #include <glib.h>
 #include <google/protobuf/stubs/common.h>
 
@@ -72,7 +72,7 @@
 string ParseECVersion(string input_line) {
   TrimWhitespaceASCII(input_line, TRIM_ALL, &input_line);
 
-  // At this point we want to conver the format key=value pair from mosys to
+  // At this point we want to convert the format key=value pair from mosys to
   // a vector of key value pairs.
   vector<pair<string, string> > kv_pairs;
   if (base::SplitStringIntoKeyValuePairs(input_line, '=', ' ', &kv_pairs)) {
@@ -82,7 +82,7 @@
       if (it->first == "fw_version") {
         string output;
         // Trim any quotes.
-        TrimString(it->second, "\"", &output);
+        base::TrimString(it->second, "\"", &output);
         return output;
       }
     }
@@ -448,18 +448,18 @@
 }
 
 string SysfsBlockDevice(const string& device) {
-  FilePath device_path(device);
+  base::FilePath device_path(device);
   if (device_path.DirName().value() != "/dev") {
     return "";
   }
-  return FilePath("/sys/block").Append(device_path.BaseName()).value();
+  return base::FilePath("/sys/block").Append(device_path.BaseName()).value();
 }
 
 bool IsRemovableDevice(const std::string& device) {
   string sysfs_block = SysfsBlockDevice(device);
   string removable;
   if (sysfs_block.empty() ||
-      !file_util::ReadFileToString(FilePath(sysfs_block).Append("removable"),
+      !base::ReadFileToString(base::FilePath(sysfs_block).Append("removable"),
                                    &removable)) {
     return false;
   }
@@ -870,7 +870,7 @@
 string ToString(const Time utc_time) {
   Time::Exploded exp_time;
   utc_time.UTCExplode(&exp_time);
-  return StringPrintf("%d/%d/%d %d:%02d:%02d GMT",
+  return base::StringPrintf("%d/%d/%d %d:%02d:%02d GMT",
                       exp_time.month,
                       exp_time.day_of_month,
                       exp_time.year,
@@ -1110,8 +1110,8 @@
 
 bool DeletePowerwashMarkerFile(const char* file_path) {
   const char* marker_file = file_path ? file_path : kPowerwashMarkerFile;
-  const FilePath kPowerwashMarkerPath(marker_file);
-  bool result = file_util::Delete(kPowerwashMarkerPath, false);
+  const base::FilePath kPowerwashMarkerPath(marker_file);
+  bool result = base::DeleteFile(kPowerwashMarkerPath, false);
 
   if (result)
     LOG(INFO) << "Successfully deleted the powerwash marker file : "
@@ -1180,7 +1180,7 @@
   OmahaHashCalculator::Base64Encode(payload_hash.c_str(),
                                     payload_hash.size(),
                                     &encoded_hash);
-  return StringPrintf("cros_update_size_%zu_hash_%s",
+  return base::StringPrintf("cros_update_size_%zu_hash_%s",
                       payload_size,
                       encoded_hash.c_str());
 }
@@ -1232,7 +1232,7 @@
     return false;
   }
 
-  FILE *file = file_util::CreateAndOpenTemporaryFile(out_path);
+  FILE *file = base::CreateAndOpenTemporaryFile(out_path);
   if (file == NULL) {
     LOG(ERROR) << "Error creating temporary file.";
     return false;
diff --git a/utils.h b/utils.h
index e129cbe..0a4f7b4 100644
--- a/utils.h
+++ b/utils.h
@@ -12,9 +12,9 @@
 #include <unistd.h>
 #include <vector>
 
-#include <base/file_path.h>
+#include <base/files/file_path.h>
 #include <base/posix/eintr_wrapper.h>
-#include <base/time.h>
+#include <base/time/time.h>
 #include <ext2fs/ext2fs.h>
 #include <glib.h>
 #include "metrics/metrics_library.h"
diff --git a/utils_unittest.cc b/utils_unittest.cc
index ef771b9..e89f069 100644
--- a/utils_unittest.cc
+++ b/utils_unittest.cc
@@ -10,10 +10,10 @@
 #include <string>
 #include <vector>
 
-#include <base/file_path.h>
+#include <base/files/file_path.h>
 #include <base/file_util.h>
-#include <base/string_util.h>
-#include <base/stringprintf.h>
+#include <base/strings/string_util.h>
+#include <base/strings/stringprintf.h>
 #include <gtest/gtest.h>
 
 #include "update_engine/test_utils.h"
@@ -106,8 +106,8 @@
 }
 
 TEST(UtilsTest, ReadFileChunk) {
-  FilePath file;
-  EXPECT_TRUE(file_util::CreateTemporaryFile(&file));
+  base::FilePath file;
+  EXPECT_TRUE(base::CreateTemporaryFile(&file));
   ScopedPathUnlinker unlinker(file.value());
   vector<char> data;
   const size_t kSize = 1024 * 1024;