libchromeos: Support building with libchrome r242728.

Also delete unused platform.* files.

BUG=chromium:331128,chromium:216672
TEST=built it
CQ-DEPEND=Ib6c567d9f92b5e24cba04d9c1bd57517ee0ee0d8
CQ-DEPEND=I6137e995c5642076d57f8b1cf8f3e587d2ee9c26

Change-Id: Ie6a27189b2880dbf2f7a172ded68aadbf75ab641
Reviewed-on: https://chromium-review.googlesource.com/181965
Reviewed-by: Daniel Erat <derat@chromium.org>
Tested-by: Daniel Erat <derat@chromium.org>
Commit-Queue: Daniel Erat <derat@chromium.org>
diff --git a/chromeos/cryptohome.cc b/chromeos/cryptohome.cc
index a1da038..2786059 100644
--- a/chromeos/cryptohome.cc
+++ b/chromeos/cryptohome.cc
@@ -12,8 +12,22 @@
 #include <vector>
 
 #include <base/file_util.h>
+
+#if BASE_VER >= 242728
+#include <base/strings/string_number_conversions.h>
+#include <base/strings/stringprintf.h>
+#else
 #include <base/string_number_conversions.h>
 #include <base/stringprintf.h>
+#endif
+
+#if BASE_VER >= 242728
+using base::ReadFile;
+using base::GetFileSize;
+#else
+using file_util::ReadFile;
+using file_util::GetFileSize;
+#endif
 
 namespace chromeos {
 namespace cryptohome {
@@ -30,7 +44,7 @@
     return true;
   FilePath salt_path(g_system_salt_path);
   int64 file_size;
-  if (!file_util::GetFileSize(salt_path, &file_size)) {
+  if (!GetFileSize(salt_path, &file_size)) {
     PLOG(ERROR) << "Could not get size of system salt: " <<  g_system_salt_path;
     return false;
   }
@@ -40,9 +54,7 @@
   }
   std::vector<char> buf;
   buf.resize(file_size);
-  unsigned int data_read = file_util::ReadFile(salt_path,
-                                               &buf.front(),
-                                               file_size);
+  unsigned int data_read = ReadFile(salt_path, &buf.front(), file_size);
   if (data_read != file_size) {
     PLOG(ERROR) << "Could not read entire file: " << data_read << " != "
                 << file_size;
diff --git a/chromeos/cryptohome.h b/chromeos/cryptohome.h
index 04c8883..53343ba 100644
--- a/chromeos/cryptohome.h
+++ b/chromeos/cryptohome.h
@@ -5,9 +5,17 @@
 #ifndef CHROMEOS_CRYPTOHOME_H_
 #define CHROMEOS_CRYPTOHOME_H_
 
+#if BASE_VER >= 242728
+#include <base/files/file_path.h>
+#else
 #include <base/file_path.h>
+#endif
 #include <string>
 
+#if BASE_VER >= 242728
+using base::FilePath;
+#endif
+
 namespace chromeos {
 namespace cryptohome {
 namespace home {
diff --git a/chromeos/dbus/dbus.cc b/chromeos/dbus/dbus.cc
index 698b775..0da32de 100644
--- a/chromeos/dbus/dbus.cc
+++ b/chromeos/dbus/dbus.cc
@@ -9,7 +9,15 @@
 #include <dbus/dbus.h>
 
 #include "base/logging.h"
+#if BASE_VER >= 242728
+#include "base/strings/stringprintf.h"
+#else
 #include "base/stringprintf.h"
+#endif
+
+#if BASE_VER >= 242728
+using base::StringPrintf;
+#endif
 
 namespace chromeos {
 namespace dbus {
diff --git a/chromeos/mock_platform.cc b/chromeos/mock_platform.cc
deleted file mode 100644
index 82f9d3a..0000000
--- a/chromeos/mock_platform.cc
+++ /dev/null
@@ -1,54 +0,0 @@
-// Copyright (c) 2013 The Chromium OS Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "mock_platform.h"
-
-namespace chromeos {
-
-MockPlatform::MockPlatform() : mock_enumerator_(new MockFileEnumerator()) {
-  ON_CALL(*this, GetOwnership(_, _, _))
-      .WillByDefault(Invoke(this, &MockPlatform::MockGetOwnership));
-  ON_CALL(*this, SetOwnership(_, _, _))
-      .WillByDefault(Return(true));
-  ON_CALL(*this, GetPermissions(_, _))
-      .WillByDefault(Invoke(this, &MockPlatform::MockGetPermissions));
-  ON_CALL(*this, SetPermissions(_, _))
-      .WillByDefault(Return(true));
-  ON_CALL(*this, SetGroupAccessible(_, _, _))
-      .WillByDefault(Return(true));
-  ON_CALL(*this, GetUserId(_, _, _))
-      .WillByDefault(Invoke(this, &MockPlatform::MockGetUserId));
-  ON_CALL(*this, GetGroupId(_, _))
-      .WillByDefault(Invoke(this, &MockPlatform::MockGetGroupId));
-  ON_CALL(*this, GetFileEnumerator(_, _, _))
-      .WillByDefault(Invoke(this, &MockPlatform::MockGetFileEnumerator));
-  ON_CALL(*this, GetCurrentTime())
-      .WillByDefault(Return(base::Time::NowFromSystemTime()));
-  ON_CALL(*this, Copy(_, _))
-      .WillByDefault(CallCopy());
-  ON_CALL(*this, GetFilesystemStats(_, _))
-      .WillByDefault(CallGetFilesystemStats());
-  ON_CALL(*this, FindFilesystemDevice(_, _))
-      .WillByDefault(CallFindFilesystemDevice());
-  ON_CALL(*this, DeleteFile(_, _))
-      .WillByDefault(CallDeleteFile());
-  ON_CALL(*this, EnumerateDirectoryEntries(_, _, _))
-      .WillByDefault(CallEnumerateDirectoryEntries());
-  ON_CALL(*this, DirectoryExists(_))
-      .WillByDefault(CallDirectoryExists());
-  ON_CALL(*this, FileExists(_))
-      .WillByDefault(CallPathExists());
-  ON_CALL(*this, CreateDirectory(_))
-    .WillByDefault(CallCreateDirectory());
-  ON_CALL(*this, ReadFile(_, _))
-      .WillByDefault(CallReadFile());
-  ON_CALL(*this, ReadFileToString(_, _))
-      .WillByDefault(CallReadFileToString());
-  ON_CALL(*this, Rename(_, _))
-      .WillByDefault(CallRename());
-}
-
-MockPlatform::~MockPlatform() {}
-
-}  // namespace chromeos
diff --git a/chromeos/mock_platform.h b/chromeos/mock_platform.h
deleted file mode 100644
index cf49e4e..0000000
--- a/chromeos/mock_platform.h
+++ /dev/null
@@ -1,175 +0,0 @@
-// Copyright (c) 2013 The Chromium OS Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef CHROMEOS_MOCK_PLATFORM_H_
-#define CHROMEOS_MOCK_PLATFORM_H_
-
-#include <base/file_util.h>
-#include <base/time.h>
-#include <gmock/gmock.h>
-
-#include "platform.h"
-
-namespace chromeos {
-
-using ::testing::_;
-using ::testing::Invoke;
-using ::testing::Return;
-
-class MockFileEnumerator : public FileEnumerator {
- public:
-  MockFileEnumerator() {
-    ON_CALL(*this, Next())
-      .WillByDefault(Invoke(this, &MockFileEnumerator::MockNext));
-  }
-  virtual ~MockFileEnumerator() {}
-
-  MOCK_METHOD0(Next, std::string(void));
-  MOCK_METHOD1(GetFindInfo, void(FindInfo* info));
-
-  std::vector<std::string> entries_;
- protected:
-  virtual std::string MockNext() {
-    if (entries_.empty())
-      return "";
-    std::string entry = entries_.at(0);
-    entries_.erase(entries_.begin(), entries_.begin()+1);
-    return entry;
-  }
-};
-
-
-// TODO(wad) Migrate to an in-memory-only mock filesystem.
-ACTION(CallDeleteFile) { return file_util::Delete(FilePath(arg0), arg1); }
-ACTION(CallEnumerateDirectoryEntries) {
-  // Pass a call to EnumerateDirectoryEntries through to a real Platform if it's
-  // not mocked.
-  Platform p;
-  return p.EnumerateDirectoryEntries(arg0, arg1, arg2);
-}
-ACTION(CallDirectoryExists) {
-  return file_util::DirectoryExists(FilePath(arg0));
-}
-ACTION(CallPathExists) {
-  return file_util::PathExists(FilePath(arg0));
-}
-ACTION(CallCreateDirectory) {
-  return file_util::CreateDirectory(FilePath(arg0));
-}
-ACTION(CallReadFile) { return Platform().ReadFile(arg0, arg1); }
-ACTION(CallReadFileToString) { return Platform().ReadFileToString(arg0, arg1); }
-ACTION(CallCopy) { return Platform().Copy(arg0, arg1); }
-ACTION(CallRename) { return Platform().Rename(arg0, arg1); }
-ACTION(CallGetFilesystemStats) {
-  return Platform().GetFilesystemStats(arg0, arg1);
-}
-ACTION(CallReportFilesystemDetails) {
-  return Platform().ReportFilesystemDetails(arg0, arg1);
-}
-ACTION(CallFindFilesystemDevice) {
-  return Platform().FindFilesystemDevice(arg0, arg1);
-}
-
-
-class MockPlatform : public Platform {
- public:
-  MockPlatform();
-  virtual ~MockPlatform();
-  MOCK_METHOD4(Mount, bool(const std::string&, const std::string&,
-                           const std::string&, const std::string&));
-  MOCK_METHOD2(Bind, bool(const std::string&, const std::string&));
-  MOCK_METHOD3(Unmount, bool(const std::string&, bool, bool*));
-  MOCK_METHOD2(GetMountsBySourcePrefix, bool(const std::string&,
-                  std::multimap<const std::string, const std::string>*));
-  MOCK_METHOD1(IsDirectoryMounted, bool(const std::string&));
-  MOCK_METHOD2(IsDirectoryMountedWith, bool(const std::string&,
-                                            const std::string&));
-  MOCK_METHOD2(GetProcessesWithOpenFiles, void(const std::string&,
-                                          std::vector<ProcessInformation>*));
-  MOCK_CONST_METHOD3(GetOwnership, bool(const std::string&, uid_t*, gid_t*));
-  MOCK_CONST_METHOD3(SetOwnership, bool(const std::string&, uid_t, gid_t));
-  MOCK_CONST_METHOD2(GetPermissions, bool(const std::string&, mode_t*));
-  MOCK_CONST_METHOD2(SetPermissions, bool(const std::string&, mode_t));
-  MOCK_CONST_METHOD3(SetGroupAccessible, bool(const std::string&,
-                                              gid_t group_id,
-                                              mode_t group_mode));
-  MOCK_CONST_METHOD3(GetUserId, bool(const std::string&, uid_t*, gid_t*));
-  MOCK_CONST_METHOD2(GetGroupId, bool(const std::string&, gid_t*));
-  MOCK_CONST_METHOD1(AmountOfFreeDiskSpace, int64(const std::string&));
-  MOCK_METHOD2(Symlink, bool(const std::string&, const std::string&));
-  MOCK_METHOD1(FileExists, bool(const std::string&));
-  MOCK_METHOD2(GetFileSize, bool(const std::string&, int64*));
-  MOCK_METHOD2(OpenFile, FILE*(const std::string&, const char*));
-  MOCK_METHOD1(CloseFile, bool(FILE*));
-  MOCK_METHOD1(CreateAndOpenTemporaryFile, FILE*(std::string*));
-  MOCK_METHOD2(Stat, bool(const std::string&, struct stat*));
-  MOCK_METHOD2(ReadFile, bool(const std::string&, chromeos::Blob*));
-  MOCK_METHOD2(ReadFileToString, bool(const std::string&, std::string*));
-  MOCK_METHOD2(Rename, bool(const std::string&, const std::string&));
-  MOCK_METHOD2(WriteOpenFile, bool(FILE*, const chromeos::Blob&));
-  MOCK_METHOD2(WriteFile, bool(const std::string&, const chromeos::Blob&));
-  MOCK_METHOD2(WriteStringToFile, bool(const std::string&, const std::string&));
-  MOCK_METHOD3(WriteArrayToFile, bool(const std::string& path, const char* data,
-                                      size_t size));
-  MOCK_CONST_METHOD0(GetCurrentTime, base::Time());
-  MOCK_METHOD2(Copy, bool(const std::string&, const std::string&));
-  MOCK_METHOD2(Move, bool(const std::string&, const std::string&));
-  MOCK_METHOD2(GetFilesystemStats, bool(const std::string&, struct statvfs*));
-  MOCK_METHOD2(ReportFilesystemDetails, bool(const std::string&,
-                                             const std::string&));
-  MOCK_METHOD2(FindFilesystemDevice, bool(const std::string&,
-                                          std::string*));
-  MOCK_METHOD3(EnumerateDirectoryEntries, bool(const std::string&, bool,
-                                               std::vector<std::string>*));
-  MOCK_METHOD2(DeleteFile, bool(const std::string&, bool));
-  MOCK_METHOD1(DirectoryExists, bool(const std::string&));
-  MOCK_METHOD1(CreateDirectory, bool(const std::string&));
-  MOCK_METHOD0(ClearUserKeyring, long(void));
-  MOCK_METHOD3(AddEcryptfsAuthToken, long(const chromeos::SecureBlob&,
-                                          const std::string&,
-                                          const chromeos::SecureBlob&));
-  MOCK_METHOD3(GetFileEnumerator, FileEnumerator*(const std::string&,
-                                                  bool,
-                                                  int));
-
-  MockFileEnumerator* get_mock_enumerator() { return mock_enumerator_.get(); }
-
- private:
-  bool MockGetOwnership(const std::string& path, uid_t* user_id,
-                        gid_t* group_id) const {
-    *user_id = getuid();
-    *group_id = getgid();
-    return true;
-  }
-
-  bool MockGetPermissions(const std::string& path, mode_t* mode) const {
-    *mode = S_IRWXU | S_IRGRP | S_IXGRP;
-    return true;
-  }
-
-  bool MockGetUserId(const std::string& user, uid_t* user_id, gid_t* group_id) {
-    *user_id = getuid();
-    *group_id = getgid();
-    return true;
-  }
-
-  bool MockGetGroupId(const std::string& group, gid_t* group_id) {
-    *group_id = getgid();
-    return true;
-  }
-
-  FileEnumerator* MockGetFileEnumerator(const std::string& root_path,
-                                        bool recursive,
-                                        int file_type) {
-    MockFileEnumerator* e = mock_enumerator_.release();
-    mock_enumerator_.reset(new MockFileEnumerator());
-    mock_enumerator_->entries_.assign(e->entries_.begin(), e->entries_.end());
-    return e;
-  }
-  scoped_ptr<MockFileEnumerator> mock_enumerator_;
-};
-
-}  // namespace chromeos
-
-#endif  // CHROMEOS_MOCK_PLATFORM_H_
diff --git a/chromeos/platform.cc b/chromeos/platform.cc
deleted file mode 100644
index 9c988ff..0000000
--- a/chromeos/platform.cc
+++ /dev/null
@@ -1,675 +0,0 @@
-// Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Contains the implementation of class Platform
-
-#include "platform.h"
-
-#include <errno.h>
-#include <grp.h>
-#include <limits.h>
-#include <mntent.h>
-#include <pwd.h>
-#include <signal.h>
-#include <stdint.h>
-#include <stdio.h>
-#include <sys/mount.h>
-#include <sys/stat.h>
-#include <sys/statvfs.h>
-#include <sys/types.h>
-#include <sys/wait.h>
-
-#include <base/file_util.h>
-#include <base/string_number_conversions.h>
-#include <base/string_split.h>
-#include <base/string_util.h>
-#include <base/stringprintf.h>
-#include <base/sys_info.h>
-#include <base/time.h>
-#include <chromeos/process.h>
-#include <chromeos/secure_blob.h>
-#include <chromeos/utility.h>
-
-using base::SplitString;
-using std::string;
-
-namespace chromeos {
-
-const int kDefaultMountOptions = MS_NOEXEC | MS_NOSUID | MS_NODEV;
-const int kDefaultPwnameLength = 1024;
-const int kDefaultUmask = S_IRGRP | S_IWGRP | S_IXGRP | S_IROTH | S_IWOTH
-                               | S_IXOTH;
-const std::string kMtab = "/etc/mtab";
-const std::string kProcDir = "/proc";
-const std::string kPathDf = "/bin/df";
-const std::string kPathTune2fs = "/sbin/tune2fs";
-
-Platform::Platform()
-  : mtab_path_(kMtab) {
-}
-
-Platform::~Platform() {
-}
-
-bool Platform::GetMountsBySourcePrefix(const std::string& from_prefix,
-                 std::multimap<const std::string, const std::string>* mounts) {
-  std::string contents;
-  if (!file_util::ReadFileToString(FilePath(mtab_path_), &contents))
-    return false;
-
-  std::vector<std::string> lines;
-  SplitString(contents, '\n', &lines);
-  for (std::vector<std::string>::iterator it = lines.begin();
-       it < lines.end();
-       ++it) {
-    if (it->substr(0, from_prefix.size()) != from_prefix)
-      continue;
-    // If there is no mounts pointer, we can return true right away.
-    if (!mounts)
-      return true;
-    size_t src_end = it->find(' ');
-    std::string source = it->substr(0, src_end);
-    size_t dst_start = src_end + 1;
-    size_t dst_end = it->find(' ', dst_start);
-    std::string destination = it->substr(dst_start, dst_end - dst_start);
-    mounts->insert(
-      std::pair<const std::string, const std::string>(source, destination));
-  }
-  return mounts && mounts->size();
-}
-
-bool Platform::IsDirectoryMounted(const std::string& directory) {
-  // Trivial string match from /etc/mtab to see if the cryptohome mount point is
-  // listed.  This works because Chrome OS is a controlled environment and the
-  // only way /home/chronos/user should be mounted is if cryptohome mounted it.
-  string contents;
-  if (file_util::ReadFileToString(FilePath(mtab_path_), &contents)) {
-    if (contents.find(StringPrintf(" %s ", directory.c_str()))
-        != string::npos) {
-      return true;
-    }
-  }
-  return false;
-}
-
-bool Platform::IsDirectoryMountedWith(const std::string& directory,
-                                      const std::string& from) {
-  // Trivial string match from /etc/mtab to see if the cryptohome mount point
-  // and the user's vault path are present.  Assumes this user is mounted if it
-  // finds both.  This will need to change if simultaneous login is implemented.
-  string contents;
-  if (file_util::ReadFileToString(FilePath(mtab_path_), &contents)) {
-    if ((contents.find(StringPrintf(" %s ", directory.c_str()))
-         != string::npos)
-        && (contents.find(StringPrintf("%s ",
-                                       from.c_str()).c_str())
-            != string::npos)) {
-      return true;
-    }
-  }
-  return false;
-}
-
-bool Platform::Mount(const std::string& from, const std::string& to,
-                     const std::string& type,
-                     const std::string& mount_options) {
-  if (mount(from.c_str(), to.c_str(), type.c_str(), kDefaultMountOptions,
-            mount_options.c_str())) {
-    return false;
-  }
-  return true;
-}
-
-bool Platform::Bind(const std::string& from, const std::string& to) {
-  if (mount(from.c_str(), to.c_str(), NULL, kDefaultMountOptions | MS_BIND,
-            NULL))
-    return false;
-  return true;
-}
-
-bool Platform::Unmount(const std::string& path, bool lazy, bool* was_busy) {
-  if (lazy) {
-    if (umount2(path.c_str(), MNT_DETACH)) {
-      if (was_busy) {
-        *was_busy = (errno == EBUSY);
-      }
-      return false;
-    }
-  } else {
-    if (umount(path.c_str())) {
-      if (was_busy) {
-        *was_busy = (errno == EBUSY);
-      }
-      return false;
-    }
-  }
-  if (was_busy) {
-    *was_busy = false;
-  }
-  return true;
-}
-
-void Platform::GetProcessesWithOpenFiles(
-    const std::string& path,
-    std::vector<ProcessInformation>* processes) {
-  std::vector<pid_t> pids;
-  LookForOpenFiles(path, &pids);
-  for (std::vector<pid_t>::iterator it = pids.begin(); it != pids.end(); ++it) {
-    pid_t pid = static_cast<pid_t>(*it);
-    processes->push_back(ProcessInformation());
-    GetProcessOpenFileInformation(pid, path,
-                                  &processes->at(processes->size() - 1));
-  }
-}
-
-std::string Platform::ReadLink(const std::string& link_path) {
-  char link_buf[PATH_MAX];
-  ssize_t link_length = readlink(link_path.c_str(), link_buf, sizeof(link_buf));
-  if (link_length > 0) {
-    return std::string(link_buf, link_length);
-  }
-  return std::string();
-}
-
-void Platform::GetProcessOpenFileInformation(pid_t pid,
-                                             const std::string& path_in,
-                                             ProcessInformation* process_info) {
-  process_info->set_process_id(pid);
-  FilePath pid_path(StringPrintf("/proc/%d", pid));
-  FilePath cmdline_file = pid_path.Append("cmdline");
-  string contents;
-  std::vector<std::string> cmd_line;
-  if (file_util::ReadFileToString(cmdline_file, &contents)) {
-    SplitString(contents, '\0', &cmd_line);
-  }
-  process_info->set_cmd_line(&cmd_line);
-
-  // Make sure that if we get a directory, it has a trailing separator
-  FilePath file_path(path_in);
-  file_util::EnsureEndsWithSeparator(&file_path);
-  std::string path = file_path.value();
-
-  FilePath cwd_path = pid_path.Append("cwd");
-  std::string link_val = ReadLink(cwd_path.value());
-  if (IsPathChild(path, link_val)) {
-    process_info->set_cwd(&link_val);
-  } else {
-    link_val.clear();
-    process_info->set_cwd(&link_val);
-  }
-
-  // Open /proc/<pid>/fd
-  FilePath fd_dirpath = pid_path.Append("fd");
-
-  file_util::FileEnumerator fd_dir_enum(fd_dirpath, false,
-                                        file_util::FileEnumerator::FILES);
-
-  std::set<std::string> open_files;
-  // List open file descriptors
-  for (FilePath fd_path = fd_dir_enum.Next();
-       !fd_path.empty();
-       fd_path = fd_dir_enum.Next()) {
-    link_val = ReadLink(fd_path.value());
-    if (IsPathChild(path, link_val)) {
-      open_files.insert(link_val);
-    }
-  }
-  process_info->set_open_files(&open_files);
-}
-
-void Platform::LookForOpenFiles(const std::string& path_in,
-                                std::vector<pid_t>* pids) {
-  // Make sure that if we get a directory, it has a trailing separator
-  FilePath file_path(path_in);
-  file_util::EnsureEndsWithSeparator(&file_path);
-  std::string path = file_path.value();
-
-  // Open /proc
-  file_util::FileEnumerator proc_dir_enum(FilePath(kProcDir), false,
-      file_util::FileEnumerator::DIRECTORIES);
-
-  int linkbuf_length = path.length();
-  std::vector<char> linkbuf(linkbuf_length);
-
-  // List PIDs in /proc
-  for (FilePath pid_path = proc_dir_enum.Next();
-       !pid_path.empty();
-       pid_path = proc_dir_enum.Next()) {
-    const char* pidstr = pid_path.BaseName().value().c_str();
-    pid_t pid = 0;
-    // Ignore PID 1 and errors
-    if (!base::StringToInt(pidstr, &pid) || pid <= 1) {
-      continue;
-    }
-
-    FilePath cwd_path = pid_path.Append("cwd");
-    ssize_t link_length = readlink(cwd_path.value().c_str(),
-                                   &linkbuf[0],
-                                   linkbuf.size());
-    if (link_length > 0) {
-      std::string open_file(&linkbuf[0], link_length);
-      if (IsPathChild(path, open_file)) {
-        pids->push_back(pid);
-        continue;
-      }
-    }
-
-    // Open /proc/<pid>/fd
-    FilePath fd_dirpath = pid_path.Append("fd");
-
-    file_util::FileEnumerator fd_dir_enum(fd_dirpath, false,
-                                          file_util::FileEnumerator::FILES);
-
-    // List open file descriptors
-    for (FilePath fd_path = fd_dir_enum.Next();
-         !fd_path.empty();
-         fd_path = fd_dir_enum.Next()) {
-      link_length = readlink(fd_path.value().c_str(), &linkbuf[0],
-                                     linkbuf.size());
-      if (link_length > 0) {
-        std::string open_file(&linkbuf[0], link_length);
-        if (IsPathChild(path, open_file)) {
-          pids->push_back(pid);
-          break;
-        }
-      }
-    }
-  }
-}
-
-bool Platform::IsPathChild(const std::string& parent,
-                           const std::string& child) {
-  if (parent.length() == 0 || child.length() == 0) {
-    return false;
-  }
-  if (child.length() >= parent.length()) {
-    if (child.compare(0, parent.length(), parent, 0, parent.length()) == 0) {
-      return true;
-    }
-  } else if ((parent[parent.length() - 1] == '/') &&
-             (child.length() == (parent.length() - 1))) {
-    if (child.compare(0, child.length(), parent, 0, parent.length() - 1) == 0) {
-      return true;
-    }
-  }
-  return false;
-}
-
-bool Platform::GetOwnership(const string& path,
-                            uid_t* user_id, gid_t* group_id) const {
-  struct stat path_status;
-  if (stat(path.c_str(), &path_status) != 0) {
-    PLOG(ERROR) << "stat() of " << path << " failed.";
-    return false;
-  }
-  if (user_id)
-    *user_id = path_status.st_uid;
-  if (group_id)
-    *group_id = path_status.st_gid;
-  return true;
-}
-
-bool Platform::SetOwnership(const std::string& path, uid_t user_id,
-                            gid_t group_id) const {
-  if (chown(path.c_str(), user_id, group_id)) {
-    PLOG(ERROR) << "chown() of " << path.c_str() << " to (" << user_id
-                << "," << group_id << ") failed.";
-    return false;
-  }
-  return true;
-}
-
-bool Platform::GetPermissions(const string& path, mode_t* mode) const {
-  struct stat path_status;
-  if (stat(path.c_str(), &path_status) != 0) {
-    PLOG(ERROR) << "stat() of " << path << " failed.";
-    return false;
-  }
-  *mode = path_status.st_mode;
-  return true;
-}
-
-bool Platform::SetPermissions(const std::string& path, mode_t mode) const {
-  if (chmod(path.c_str(), mode)) {
-    PLOG(ERROR) << "chmod() of " << path.c_str() << " to (" << std::oct << mode
-                << ") failed.";
-    return false;
-  }
-  return true;
-}
-
-bool Platform::SetGroupAccessible(const string& path, gid_t group_id,
-                                  mode_t group_mode) const {
-  uid_t user_id;
-  mode_t mode;
-  if (!GetOwnership(path, &user_id, NULL) ||
-      !GetPermissions(path, &mode) ||
-      !SetOwnership(path, user_id, group_id) ||
-      !SetPermissions(path, (mode & ~S_IRWXG) | (group_mode & S_IRWXG))) {
-    LOG(ERROR) << "Couldn't set up group access on directory: " << path;
-    return false;
-  }
-  return true;
-}
-
-int Platform::SetMask(int new_mask) const {
-  return umask(new_mask);
-}
-
-bool Platform::GetUserId(const std::string& user, uid_t* user_id,
-                         gid_t* group_id) const {
-  // Load the passwd entry
-  long user_name_length = sysconf(_SC_GETPW_R_SIZE_MAX);  // NOLINT long
-  if (user_name_length == -1) {
-    user_name_length = kDefaultPwnameLength;
-  }
-  struct passwd user_info, *user_infop;
-  std::vector<char> user_name_buf(user_name_length);
-  if (getpwnam_r(user.c_str(), &user_info, &user_name_buf[0],
-                user_name_length, &user_infop)) {
-    return false;
-  }
-  *user_id = user_info.pw_uid;
-  *group_id = user_info.pw_gid;
-  return true;
-}
-
-bool Platform::GetGroupId(const std::string& group, gid_t* group_id) const {
-  // Load the group entry
-  long group_name_length = sysconf(_SC_GETGR_R_SIZE_MAX);  // NOLINT long
-  if (group_name_length == -1) {
-    group_name_length = kDefaultPwnameLength;
-  }
-  struct group group_info, *group_infop;
-  std::vector<char> group_name_buf(group_name_length);
-  if (getgrnam_r(group.c_str(), &group_info, &group_name_buf[0],
-                group_name_length, &group_infop)) {
-    return false;
-  }
-  *group_id = group_info.gr_gid;
-  return true;
-}
-
-int64 Platform::AmountOfFreeDiskSpace(const string& path) const {
-  return base::SysInfo::AmountOfFreeDiskSpace(FilePath(path));
-}
-
-bool Platform::FileExists(const std::string& path) {
-  return file_util::PathExists(FilePath(path));
-}
-
-bool Platform::DirectoryExists(const std::string& path) {
-  return file_util::DirectoryExists(FilePath(path));
-}
-
-bool Platform::GetFileSize(const std::string& path, int64* size) {
-  return file_util::GetFileSize(FilePath(path), size);
-}
-
-FILE* Platform::CreateAndOpenTemporaryFile(std::string* path) {
-  FilePath created_path;
-  FILE* f = file_util::CreateAndOpenTemporaryFile(&created_path);
-  if (f)
-    path->assign(created_path.value());
-
-  return f;
-}
-
-FILE* Platform::OpenFile(const std::string& path, const char* mode) {
-  return file_util::OpenFile(FilePath(path), mode);
-}
-
-bool Platform::CloseFile(FILE* fp) {
-  return file_util::CloseFile(fp);
-}
-
-bool Platform::WriteOpenFile(FILE* fp, const chromeos::Blob& blob) {
-  return (fwrite(static_cast<const void*>(&blob.at(0)), 1, blob.size(), fp)
-            != blob.size());
-}
-
-bool Platform::WriteFile(const std::string& path,
-                         const chromeos::Blob& blob) {
-  return WriteArrayToFile(path,
-                          reinterpret_cast<const char*>(&blob[0]),
-                          blob.size());
-}
-
-bool Platform::WriteStringToFile(const std::string& path,
-                                 const std::string& data) {
-  return WriteArrayToFile(path, data.data(), data.size());
-}
-
-bool Platform::WriteArrayToFile(const std::string& path, const char* data,
-                                size_t size) {
-  FilePath file_path(path);
-  if (!file_util::DirectoryExists(file_path.DirName())) {
-    if (!file_util::CreateDirectory(file_path.DirName())) {
-      LOG(ERROR) << "Cannot create directory: " << file_path.DirName().value();
-      return false;
-    }
-  }
-  // chromeos::Blob::size_type is std::vector::size_type and is unsigned.
-  if (size > static_cast<std::string::size_type>(INT_MAX)) {
-    LOG(ERROR) << "Cannot write to " << path
-               << ". Data is too large: " << size << " bytes.";
-    return false;
-  }
-
-  int data_written = file_util::WriteFile(file_path, data, size);
-  return data_written == static_cast<int>(size);
-}
-
-bool Platform::ReadFile(const std::string& path, chromeos::Blob* blob) {
-  int64 file_size;
-  FilePath file_path(path);
-  if (!file_util::PathExists(file_path)) {
-    return false;
-  }
-  if (!file_util::GetFileSize(file_path, &file_size)) {
-    LOG(ERROR) << "Could not get size of " << path;
-    return false;
-  }
-  // Compare to the max of a signed integer.
-  if (file_size > static_cast<int64>(INT_MAX)) {
-    LOG(ERROR) << "File " << path << " is too large: "
-               << file_size << " bytes.";
-    return false;
-  }
-  chromeos::Blob buf(file_size);
-  int data_read = file_util::ReadFile(file_path,
-                                      reinterpret_cast<char*>(&buf[0]),
-                                      file_size);
-  // Cast is okay because of comparison to INT_MAX above.
-  if (data_read != static_cast<int>(file_size)) {
-    LOG(ERROR) << "Only read " << data_read << " of " << file_size << " bytes.";
-    return false;
-  }
-  blob->swap(buf);
-  return true;
-}
-
-bool Platform::ReadFileToString(const std::string& path, std::string* string) {
-  return file_util::ReadFileToString(FilePath(path), string);
-}
-
-bool Platform::CreateDirectory(const std::string& path) {
-  return file_util::CreateDirectory(FilePath(path));
-}
-
-bool Platform::DeleteFile(const std::string& path, bool is_recursive) {
-  return file_util::Delete(FilePath(path), is_recursive);
-}
-
-bool Platform::Move(const std::string& from, const std::string& to) {
-  return file_util::Move(FilePath(from), FilePath(to));
-}
-
-bool Platform::EnumerateDirectoryEntries(const std::string& path,
-                                         bool recursive,
-                                         std::vector<std::string>* ent_list) {
-  file_util::FileEnumerator::FileType ft = static_cast<typeof(ft)>(
-    file_util::FileEnumerator::FILES | file_util::FileEnumerator::DIRECTORIES |
-    file_util::FileEnumerator::SHOW_SYM_LINKS);
-  file_util::FileEnumerator ent_enum(FilePath(path), recursive, ft);
-  for (FilePath path = ent_enum.Next(); !path.empty(); path = ent_enum.Next())
-    ent_list->push_back(path.value());
-  return true;
-}
-
-base::Time Platform::GetCurrentTime() const {
-  return base::Time::Now();
-}
-
-bool Platform::Stat(const std::string& path, struct stat *buf) {
-  return lstat(path.c_str(), buf) == 0;
-}
-
-bool Platform::Rename(const std::string& from, const std::string& to) {
-  return rename(from.c_str(), to.c_str()) == 0;
-}
-
-bool Platform::Copy(const std::string& from, const std::string& to) {
-  FilePath from_path(from);
-  FilePath to_path(to);
-  return file_util::CopyDirectory(from_path, to_path, true);
-}
-
-bool Platform::GetFilesystemStats(const std::string& fs, struct statvfs *st) {
-  return statvfs(fs.c_str(), st) == 0;
-}
-
-bool Platform::FindFilesystemDevice(const std::string &filesystem_in,
-                                    std::string *device)
-{
-  /* Clear device to indicate failure case. */
-  device->clear();
-
-  /* Removing trailing slashes. */
-  std::string filesystem = filesystem_in;
-  size_t offset = filesystem.find_last_not_of('/');
-  if (offset != std::string::npos)
-    filesystem.erase(offset+1);
-
-  /* If we fail to open mtab, abort immediately. */
-  FILE *mtab_file = setmntent(mtab_path_.c_str(), "r");
-  if (!mtab_file)
-    return false;
-
-  /* Copy device of first matching filesystem location. */
-  struct mntent *entry;
-  while ((entry = getmntent(mtab_file)) != NULL) {
-    if (filesystem.compare(entry->mnt_dir) == 0) {
-      *device = entry->mnt_fsname;
-      break;
-    }
-  }
-  endmntent(mtab_file);
-
-  return (device->length() > 0);
-}
-
-bool Platform::ReportFilesystemDetails(const std::string &filesystem,
-                                       const std::string &logfile) {
-  chromeos::ProcessImpl process;
-  int rc;
-  std::string device;
-  if (!FindFilesystemDevice(filesystem, &device)) {
-    LOG(ERROR) << "Failed to find device for " << filesystem;
-    return false;
-  }
-
-  process.RedirectOutput(logfile);
-  process.AddArg(kPathTune2fs);
-  process.AddArg("-l");
-  process.AddArg(device);
-
-  rc = process.Run();
-  if (rc == 0)
-    return true;
-  LOG(ERROR) << "Failed to run tune2fs on " << device
-             << " (" << filesystem << ", exit " << rc << ")";
-  return false;
-}
-
-long Platform::ClearUserKeyring() {
-  CHECK(0 && "unimplemented stub called");
-  return 1;
-}
-
-long Platform::AddEcryptfsAuthToken(const chromeos::SecureBlob& key,
-                                    const std::string& key_sig,
-                                    const chromeos::SecureBlob& salt) {
-  CHECK(0 && "unimplemented stub called");
-  return 1;
-}
-
-FileEnumerator* Platform::GetFileEnumerator(const std::string& root_path,
-                                            bool recursive,
-                                            int file_type) {
-  return new FileEnumerator(root_path, recursive, file_type);
-}
-
-
-
-FileEnumerator::FileEnumerator(const std::string& root_path,
-                               bool recursive,
-                               int file_type) {
-  enumerator_ = new file_util::FileEnumerator(
-      FilePath(root_path),
-      recursive,
-      static_cast<file_util::FileEnumerator::FileType>(file_type));
-}
-
-FileEnumerator::FileEnumerator(const std::string& root_path,
-                               bool recursive,
-                               int file_type,
-                               const std::string& pattern) {
-  enumerator_ = new file_util::FileEnumerator(
-      FilePath(root_path),
-      recursive,
-      static_cast<file_util::FileEnumerator::FileType>(file_type),
-      pattern);
-}
-
-FileEnumerator::~FileEnumerator() {
-  if (enumerator_)
-    delete enumerator_;
-}
-
-std::string FileEnumerator::Next() {
-  if (!enumerator_)
-    return "";
-  return enumerator_->Next().value();
-}
-
-void FileEnumerator::GetFindInfo(FindInfo* info) {
-  DCHECK(info);
-  enumerator_->GetFindInfo(
-      reinterpret_cast<file_util::FileEnumerator::FindInfo*>(info));
-}
-
-// static
-bool FileEnumerator::IsDirectory(const FindInfo& info) {
- return !!S_ISDIR(info.stat.st_mode);
-}
-
-//static
-std::string FileEnumerator::GetFilename(const FindInfo& find_info) {
-  return find_info.filename;
-}
-
-// static
-int64 FileEnumerator::GetFilesize(const FindInfo& info) {
-  return file_util::FileEnumerator::GetFilesize(
-    *(reinterpret_cast<const file_util::FileEnumerator::FindInfo*>(&info)));
-}
-
-// static
-base::Time FileEnumerator::GetLastModifiedTime(const FindInfo& info) {
-  return file_util::FileEnumerator::GetLastModifiedTime(
-    *(reinterpret_cast<const file_util::FileEnumerator::FindInfo*>(&info)));
-}
-
-}  // namespace chromeos
diff --git a/chromeos/platform.h b/chromeos/platform.h
deleted file mode 100644
index 865b9db..0000000
--- a/chromeos/platform.h
+++ /dev/null
@@ -1,502 +0,0 @@
-// Copyright (c) 2013 The Chromium OS Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef CHROMEOS_PLATFORM_H_
-#define CHROMEOS_PLATFORM_H_
-
-#include <sys/stat.h>
-#include <sys/statvfs.h>
-
-#include <base/basictypes.h>
-#include <chromeos/secure_blob.h>
-#include <chromeos/utility.h>
-#include <map>
-#include <set>
-#include <string>
-#include <vector>
-
-namespace base { class Time; }
-namespace file_util { class FileEnumerator; }
-
-namespace chromeos {
-
-// Default umask
-extern const int kDefaultUmask;
-
-class ProcessInformation;
-class FileEnumerator;
-
-// Platform specific routines abstraction layer.
-// Also helps us to be able to mock them in tests.
-class Platform {
- public:
-  Platform();
-
-  virtual ~Platform();
-
-  // Calls the platform mount
-  //
-  // Parameters
-  //   from - The node to mount from
-  //   to - The node to mount to
-  //   type - The fs type
-  //   mount_options - The mount options to pass to mount()
-  virtual bool Mount(const std::string& from, const std::string& to,
-                     const std::string& type, const std::string& mount_options);
-
-  // Creates a bind mount
-  //
-  // Parameters
-  //   from - Where to mount from
-  //   to - Where to mount to
-  virtual bool Bind(const std::string& from, const std::string& to);
-
-  // Calls the platform unmount
-  //
-  // Parameters
-  //   path - The path to unmount
-  //   lazy - Whether to call a lazy unmount
-  //   was_busy (OUT) - Set to true on return if the mount point was busy
-  virtual bool Unmount(const std::string& path, bool lazy, bool* was_busy);
-
-
-  // Returns true if any mounts match. Populates |mounts| if
-  // any mount sources have a matching prefix (|from_prefix|).
-  //
-  // Parameters
-  //   from_prefix - Prefix for matching mount sources
-  //   mounts - matching mounted paths, may be NULL
-  virtual bool GetMountsBySourcePrefix(const std::string& from_prefix,
-                  std::multimap<const std::string, const std::string>* mounts);
-
-  // Returns true if the directory is in the mtab
-  //
-  // Parameters
-  //   directory - The directory to check
-  virtual bool IsDirectoryMounted(const std::string& directory);
-
-  // Returns true if the directory is in the mtab mounted with the specified
-  // source
-  //
-  // Parameters
-  //   directory - The directory to check
-  //   from - The source node
-  virtual bool IsDirectoryMountedWith(const std::string& directory,
-                                      const std::string& from);
-
-  // GetProcessesWithOpenFiles
-  //
-  // Parameters
-  //   path - The path to check if the process has open files on
-  //   pids (OUT) - The PIDs found
-  virtual void GetProcessesWithOpenFiles(const std::string& path_in,
-                                 std::vector<ProcessInformation>* processes);
-
-  // Calls the platform stat() function to obtain the ownership of
-  // a given path. The path may be a directory or a file.
-  //
-  // Parameters
-  //   path - The path to look up
-  //   user_id - The user ID of the path. NULL if the result is not needed.
-  //   group_id - The group ID of the path. NULL if the result is not needed.
-  virtual bool GetOwnership(const std::string& path, uid_t* user_id,
-                            gid_t* group_id) const;
-
-  // Calls the platform chown() function on the given path.
-  //
-  // The path may be a directory or a file.
-  //
-  // Parameters
-  //   path - The path to set ownership on
-  //   user_id - The user_id to assign ownership to
-  //   group_id - The group_id to assign ownership to
-  virtual bool SetOwnership(const std::string& directory, uid_t user_id,
-                            gid_t group_id) const;
-
-  // Calls the platform stat() function to obtain the permissions of
-  // the given path. The path may be a directory or a file.
-  //
-  // Parameters
-  //   path - The path to look up
-  //   mode - The permissions of the path
-  virtual bool GetPermissions(const std::string& path, mode_t* mode) const;
-
-  // Calls the platform chmod() function on the given path.
-  // The path may be a directory or a file.
-  //
-  // Parameters
-  //   path - The path to change the permissions on
-  //   mode - the mode to change the permissions to
-  virtual bool SetPermissions(const std::string& path, mode_t mode) const;
-
-  // Sets the path accessible by a group with specified permissions
-  //
-  // Parameters
-  //   path - The path to change the ownership and permissions on
-  //   group_id - The group ID to assign to the path
-  //   group_mode - The group permissions to assign to the path
-  virtual bool SetGroupAccessible(const std::string& path,
-                                  gid_t group_id,
-                                  mode_t group_mode) const;
-
-  // Sets the current umask, returning the old mask
-  //
-  // Parameters
-  //   new_mask - The mask to set
-  virtual int SetMask(int new_mask) const;
-
-  // Returns the user and group ids for a user
-  //
-  // Parameters
-  //   user - The username to query for
-  //   user_id (OUT) - The user ID on success
-  //   group_id (OUT) - The group ID on success
-  virtual bool GetUserId(const std::string& user, uid_t* user_id,
-                         gid_t* group_id) const;
-
-  // Returns the group id for a group
-  //
-  // Parameters
-  //   group - The group name to query for
-  //   group_id (OUT) - The group ID on success
-  virtual bool GetGroupId(const std::string& group, gid_t* group_id) const;
-
-  // Return the available disk space in bytes on the volume containing |path|,
-  // or -1 on failure.
-  // Code duplicated from Chrome's base::SysInfo::AmountOfFreeDiskSpace().
-  //
-  // Parameters
-  //   path - the pathname of any file within the mounted file system
-  virtual int64 AmountOfFreeDiskSpace(const std::string& path) const;
-
-  // Returns true if the specified file exists.
-  //
-  // Parameters
-  //  path - Path of the file to check
-  virtual bool FileExists(const std::string& path);
-
-  // Check if a directory exists as the given path
-  virtual bool DirectoryExists(const std::string& path);
-
-  // Provides the size of a file at |path| if it exists.
-  //
-  // Parameters
-  //   path - Path of the file to check
-  //   size - int64* to populate with the size
-  // Returns true if the size was acquired and false otherwise.
-  virtual bool GetFileSize(const std::string& path, int64* size);
-
-  // Opens a file, if possible, returning a FILE*. If not, returns NULL.
-  //
-  // Parameters
-  //   path - Path of the file to open
-  //   mode - mode string of the file when opened
-  virtual FILE* OpenFile(const std::string& path, const char* mode);
-
-  // Closes a FILE* opened with OpenFile()
-  //
-  // Parameters
-  //  fp - FILE* to close
-  virtual bool CloseFile(FILE* fp);
-
-  // Creates and opens a temporary file if possible.
-  //
-  // Parameters
-  //  path - Pointer to where the file is created if successful.
-  virtual FILE* CreateAndOpenTemporaryFile(std::string* path);
-
-  // Reads a file completely into a Blob.
-  //
-  // Parameters
-  //  path - Path of the file to read
-  //  blob - blob to populate
-  virtual bool ReadFile(const std::string& path, chromeos::Blob* blob);
-  virtual bool ReadFileToString(const std::string& path, std::string* string);
-
-  // Writes to the open file pointer.
-  //
-  // Parameters
-  //   fp   - pointer to the FILE*
-  //   blob - data to write
-  virtual bool WriteOpenFile(FILE* fp, const chromeos::Blob& blob);
-
-  // Writes the entirety of the data to the given file.
-  //
-  // Parameters
-  //  path - Path of the file to write
-  //  blob - blob to populate from
-  virtual bool WriteFile(const std::string& path, const chromeos::Blob& blob);
-
-  // Writes the entirety of the string to the given file.
-  //
-  // Parameters
-  //  path - Path of the file to write
-  //  data - string to write out
-  virtual bool WriteStringToFile(const std::string& path,
-                                 const std::string& data);
-
-  // Returns true if the |data| was completely written to |path|.
-  //
-  // Parameters
-  //   path - Path to the file to write
-  //   data - char array to write
-  //   size - length of |data|
-  virtual bool WriteArrayToFile(const std::string& path, const char* data,
-                                size_t size);
-
-  // Delete file(s) at the given path
-  //
-  // Parameters
-  //  path - string containing file path to delete
-  //  recursive - whether to perform recursive deletion of the subtree
-  virtual bool DeleteFile(const std::string& path, bool recursive);
-
-  // Create a directory with the given path
-  virtual bool CreateDirectory(const std::string& path);
-
-  // Enumerate all directory entries in a given directory
-  //
-  // Parameters
-  //  path - root of the tree to enumerate
-  //  is_recursive - true to enumerate recursively
-  //  ent_list - vector of strings to add enumerate directory entry paths into
-  virtual bool EnumerateDirectoryEntries(const std::string& path,
-                                         bool is_recursive,
-                                         std::vector<std::string>* ent_list);
-
-  // Returns a new FileEnumerator instance.
-  //
-  // The caller TAKES OWNERSHIP of the returned pointer.
-  //
-  // Parameters
-  // (see FileEnumerator())
-  virtual FileEnumerator* GetFileEnumerator(const std::string& root_path,
-                                            bool recursive,
-                                            int file_type);
-
-  // Look up information about a file or directory
-  //
-  // Parameters
-  //  path - element to look up
-  //  buf - buffer to store results into
-  virtual bool Stat(const std::string& path, struct stat *buf);
-
-  // Rename a file or directory
-  //
-  // Parameters
-  //  from
-  //  to
-  virtual bool Rename(const std::string& from, const std::string& to);
-
-  // Retuns the current time.
-  virtual base::Time GetCurrentTime() const;
-
-  // Copies from to to.
-  virtual bool Copy(const std::string& from, const std::string& to);
-
-  // Moves a given path on the filesystem
-  //
-  // Parameters
-  //   from - path to move
-  //   to   - destination of the move
-  virtual bool Move(const std::string& from, const std::string& to);
-
-  // Get filesystem stats, like statvfs(2).
-  //
-  // Parameters
-  //  filesystem - filesystem to get stats for
-  //  stats - buf to dump stats into
-  virtual bool GetFilesystemStats(const std::string& filesystem,
-                                  struct statvfs *stats);
-
-  // Find the device for a given filesystem.
-  //
-  // Parameters
-  //   filesystem - the filesystem to examine
-  //   device - output: the device name that "filesystem" in mounted on
-  virtual bool FindFilesystemDevice(const std::string &filesystem,
-                                    std::string *device);
-
-  // Runs "tune2fs -l" with redirected output.
-  //
-  // Parameters
-  //  filesystem - the filesystem to examine
-  //  lgofile - the path written with output
-  virtual bool ReportFilesystemDetails(const std::string &filesystem,
-                                       const std::string &logfile);
-
-
-  // Clears the kernel-managed user keyring
-  virtual long ClearUserKeyring();
-
-  // Creates an ecryptfs auth token and installs it in the kernel keyring.
-  //
-  // Parameters
-  //   key - The key to add
-  //   key_sig - The key's (ascii) signature
-  //   salt - The salt
-  virtual long AddEcryptfsAuthToken(const chromeos::SecureBlob& key,
-                                    const std::string& key_sig,
-                                    const chromeos::SecureBlob& salt);
-
-  // Override the location of the mtab file used. Default is kMtab.
-  virtual void set_mtab_path(const std::string &mtab_path) {
-    mtab_path_ = mtab_path;
-  }
-
- private:
-  // Returns the process and open file information for the specified process id
-  // with files open on the given path
-  //
-  // Parameters
-  //   pid - The process to check
-  //   path_in - The file path to check for
-  //   process_info (OUT) - The ProcessInformation to store the results in
-  void GetProcessOpenFileInformation(pid_t pid, const std::string& path_in,
-                                     ProcessInformation* process_info);
-
-  // Returns a vector of PIDs that have files open on the given path
-  //
-  // Parameters
-  //   path - The path to check if the process has open files on
-  //   pids (OUT) - The PIDs found
-  void LookForOpenFiles(const std::string& path_in, std::vector<pid_t>* pids);
-
-  // Returns true if child is a file or folder below or equal to parent.  If
-  // parent is a directory, it should end with a '/' character.
-  //
-  // Parameters
-  //   parent - The parent directory
-  //   child - The child directory/file
-  bool IsPathChild(const std::string& parent, const std::string& child);
-
-  // Returns the target of the specified link
-  //
-  // Parameters
-  //   link_path - The link to check
-  std::string ReadLink(const std::string& link_path);
-
-  std::string mtab_path_;
-
-  DISALLOW_COPY_AND_ASSIGN(Platform);
-};
-
-class ProcessInformation {
- public:
-  ProcessInformation()
-      : cmd_line_(),
-      process_id_(-1) { }
-  virtual ~ProcessInformation() { }
-
-  std::string GetCommandLine() {
-    std::string result;
-    for (std::vector<std::string>::iterator cmd_itr = cmd_line_.begin();
-         cmd_itr != cmd_line_.end();
-         cmd_itr++) {
-      if (result.length()) {
-        result.append(" ");
-      }
-      result.append((*cmd_itr));
-    }
-    return result;
-  }
-
-  // Set the command line array.  This method DOES swap out the contents of
-  // |value|.  The caller should expect an empty vector on return.
-  void set_cmd_line(std::vector<std::string>* value) {
-    cmd_line_.clear();
-    cmd_line_.swap(*value);
-  }
-
-  const std::vector<std::string>& get_cmd_line() {
-    return cmd_line_;
-  }
-
-  // Set the command line array.  This method DOES swap out the contents of
-  // |value|.  The caller should expect an empty set on return.
-  void set_open_files(std::set<std::string>* value) {
-    open_files_.clear();
-    open_files_.swap(*value);
-  }
-
-  const std::set<std::string>& get_open_files() {
-    return open_files_;
-  }
-
-  // Set the command line array.  This method DOES swap out the contents of
-  // |value|.  The caller should expect an empty string on return.
-  void set_cwd(std::string* value) {
-    cwd_.clear();
-    cwd_.swap(*value);
-  }
-
-  const std::string& get_cwd() {
-    return cwd_;
-  }
-
-  void set_process_id(int value) {
-    process_id_ = value;
-  }
-
-  int get_process_id() {
-    return process_id_;
-  }
-
- private:
-  std::vector<std::string> cmd_line_;
-  std::set<std::string> open_files_;
-  std::string cwd_;
-  int process_id_;
-};
-
-// A class for enumerating the files in a provided path. The order of the
-// results is not guaranteed.
-//
-// DO NOT USE FROM THE MAIN THREAD of your application unless it is a test
-// program where latency does not matter. This class is blocking.
-//
-// See file_util::FileEnumerator for details.  This is merely a mockable
-// wrapper.
-class FileEnumerator {
- public:
-  typedef struct {
-    struct stat stat;
-    std::string filename;
-  } FindInfo;
-  enum FileType {
-    FILES                 = 1 << 0,
-    DIRECTORIES           = 1 << 1,
-    INCLUDE_DOT_DOT       = 1 << 2,
-    SHOW_SYM_LINKS        = 1 << 4,
-  };
-
-  FileEnumerator(const std::string& root_path,
-                 bool recursive,
-                 int file_type);
-  FileEnumerator(const std::string& root_path,
-                 bool recursive,
-                 int file_type,
-                 const std::string& pattern);
-  // Meant for testing only.
-  FileEnumerator() : enumerator_(NULL) { }
-  virtual ~FileEnumerator();
-
-  // Returns an empty string if there are no more results.
-  virtual std::string Next();
-
-  // Write the file info into |info|.
-  virtual void GetFindInfo(FindInfo* info);
-
-  // The static methods are exclusively helpers for interpreting FindInfo.
-  static bool IsDirectory(const FindInfo& info);
-  static std::string GetFilename(const FindInfo& find_info);
-  static int64 GetFilesize(const FindInfo& find_info);
-  static base::Time GetLastModifiedTime(const FindInfo& find_info);
- private:
-   file_util::FileEnumerator* enumerator_;
-};
-
-}  // namespace chromeos
-
-#endif  // CHROMEOS_PLATFORM_H_
diff --git a/chromeos/policy/device_policy_impl.cc b/chromeos/policy/device_policy_impl.cc
index 479d391..73fb888 100644
--- a/chromeos/policy/device_policy_impl.cc
+++ b/chromeos/policy/device_policy_impl.cc
@@ -5,7 +5,6 @@
 #include "device_policy_impl.h"
 
 #include <base/basictypes.h>
-#include <base/file_path.h>
 #include <base/file_util.h>
 #include <base/logging.h>
 #include <openssl/evp.h>
@@ -16,6 +15,14 @@
 #include "bindings/chrome_device_policy.pb.h"
 #include "bindings/device_management_backend.pb.h"
 
+#if BASE_VER >= 242728
+using base::PathExists;
+using base::ReadFileToString;
+#else
+using file_util::PathExists;
+using file_util::ReadFileToString;
+#endif
+
 namespace policy {
 
 namespace {
@@ -25,11 +32,10 @@
 // Reads the public key used to sign the policy from |key_file| and stores it
 // in |public_key|. Returns true on success.
 bool ReadPublicKeyFromFile(const FilePath& key_file, std::string* public_key) {
-  if (!file_util::PathExists(key_file))
+  if (!PathExists(key_file))
     return false;
   public_key->clear();
-  if (!file_util::ReadFileToString(key_file, public_key) ||
-      public_key->empty()) {
+  if (!ReadFileToString(key_file, public_key) || public_key->empty()) {
     LOG(ERROR) << "Could not read public key off disk";
     return false;
   }
@@ -109,7 +115,7 @@
   }
 
   std::string polstr;
-  if (!file_util::ReadFileToString(policy_path_, &polstr) || polstr.empty()) {
+  if (!ReadFileToString(policy_path_, &polstr) || polstr.empty()) {
     LOG(ERROR) << "Could not read policy off disk";
     return false;
   }
@@ -451,8 +457,7 @@
 
 bool DevicePolicyImpl::VerifyPolicyFiles() {
   // Both the policy and its signature have to exist.
-  if (!file_util::PathExists(policy_path_) ||
-      !file_util::PathExists(keyfile_path_)) {
+  if (!PathExists(policy_path_) || !PathExists(keyfile_path_)) {
     return false;
   }
 
diff --git a/chromeos/policy/device_policy_impl.h b/chromeos/policy/device_policy_impl.h
index 235c761..439f8f2 100644
--- a/chromeos/policy/device_policy_impl.h
+++ b/chromeos/policy/device_policy_impl.h
@@ -9,7 +9,11 @@
 #include <vector>
 
 #include <base/basictypes.h>
+#if BASE_VER >= 242728
+#include <base/files/file_path.h>
+#else
 #include <base/file_path.h>
+#endif
 
 #include "bindings/chrome_device_policy.pb.h"
 #include "bindings/device_management_backend.pb.h"
@@ -17,6 +21,10 @@
 
 #pragma GCC visibility push(default)
 
+#if BASE_VER >= 242728
+using base::FilePath;
+#endif
+
 namespace policy {
 
 // This class holds device settings that are to be enforced across all users.
diff --git a/chromeos/policy/tests/libpolicy_unittest.cc b/chromeos/policy/tests/libpolicy_unittest.cc
index 82a1e66..d3042e6 100644
--- a/chromeos/policy/tests/libpolicy_unittest.cc
+++ b/chromeos/policy/tests/libpolicy_unittest.cc
@@ -2,15 +2,24 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include <base/file_path.h>
 #include <base/logging.h>
 #include <gtest/gtest.h>
 #include <openssl/err.h>
 #include <openssl/ssl.h>
 
+#if BASE_VER >= 242728
+#include <base/files/file_path.h>
+#else
+#include <base/file_path.h>
+#endif
+
 #include <chromeos/policy/device_policy_impl.h>
 #include <chromeos/policy/libpolicy.h>
 
+#if BASE_VER >= 242728
+using base::FilePath;
+#endif
+
 namespace policy {
 
 static const char kPolicyFileAllSet[] =
diff --git a/chromeos/process.cc b/chromeos/process.cc
index 1978c6b..c59f7ba 100644
--- a/chromeos/process.cc
+++ b/chromeos/process.cc
@@ -12,17 +12,29 @@
 
 #include <map>
 
-// TODO(cmasone): Come back and clear this out (http://crosbug.com/38805).
-#if BASE_VER > 125070
-#include <base/posix/eintr_wrapper.h>
-#else
-#include <base/eintr_wrapper.h>
-#endif
 #include <base/file_util.h>
 #include <base/logging.h>
+#include <base/posix/eintr_wrapper.h>
+
+#if BASE_VER >= 242728
+#include <base/strings/string_number_conversions.h>
+#include <base/strings/string_util.h>
+#include <base/time/time.h>
+#else
 #include <base/string_number_conversions.h>
 #include <base/string_util.h>
 #include <base/time.h>
+#endif
+
+#if BASE_VER >= 242728
+using base::DirectoryExists;
+using base::FilePath;
+using base::ReadFileToString;
+using base::StringPrintf;
+#else
+using file_util::DirectoryExists;
+using file_util::ReadFileToString;
+#endif
 
 namespace chromeos {
 
@@ -35,7 +47,7 @@
 }
 
 bool Process::ProcessExists(pid_t pid) {
-  return file_util::DirectoryExists(FilePath(StringPrintf("/proc/%d", pid)));
+  return DirectoryExists(FilePath(StringPrintf("/proc/%d", pid)));
 }
 
 ProcessImpl::ProcessImpl() : pid_(0), uid_(-1), gid_(-1),
@@ -133,7 +145,11 @@
 }
 
 bool ProcessImpl::Start() {
+#if BASE_VER >= 242728
+  scoped_ptr<char*[]> argv(new char*[arguments_.size() + 1]);
+#else
   scoped_array<char*> argv(new char*[arguments_.size() + 1]);
+#endif
 
   for (size_t i = 0; i < arguments_.size(); ++i)
     argv[i] = const_cast<char*>(arguments_[i].c_str());
@@ -304,7 +320,7 @@
 
 bool ProcessImpl::ResetPidByFile(const std::string& pid_file) {
   std::string contents;
-  if (!file_util::ReadFileToString(FilePath(pid_file), &contents)) {
+  if (!ReadFileToString(FilePath(pid_file), &contents)) {
     LOG(ERROR) << "Could not read pid file" << pid_file;
     return false;
   }
diff --git a/chromeos/process.h b/chromeos/process.h
index 73e45e5..7e294fc 100644
--- a/chromeos/process.h
+++ b/chromeos/process.h
@@ -13,8 +13,17 @@
 
 #include <base/bind.h>
 #include <base/callback.h>
+#if BASE_VER >= 242728
+#include <base/strings/string_util.h>
+#include <base/strings/stringprintf.h>
+#else
 #include <base/string_util.h>
 #include <base/stringprintf.h>
+#endif
+
+#if BASE_VER >= 242728
+using base::StringPrintf;
+#endif
 
 namespace chromeos {
 // Manages a process.  Can create the process, attach to an existing
diff --git a/chromeos/process_test.cc b/chromeos/process_test.cc
index a69f743..483051b 100644
--- a/chromeos/process_test.cc
+++ b/chromeos/process_test.cc
@@ -11,6 +11,21 @@
 
 #include <unistd.h>
 
+#if BASE_VER >= 242728
+#include <base/files/file_path.h>
+#endif
+
+#if BASE_VER >= 242728
+using base::CreateDirectory;
+using base::FilePath;
+using base::PathExists;
+using base::ReadFileToString;
+#else
+using file_util::CreateDirectory;
+using file_util::PathExists;
+using file_util::ReadFileToString;
+#endif
+
 // This test assumes the following standard binaries are installed.
 static const char kBinBash[] = "/bin/bash";
 static const char kBinCat[] = "/bin/cat";
@@ -61,14 +76,22 @@
   void SetUp() {
     test_path_ = FilePath("test");
     output_file_ = test_path_.Append("fork_out").value();
+#if BASE_VER >= 242728
+    base::DeleteFile(test_path_, true);
+#else
     file_util::Delete(test_path_, true);
-    file_util::CreateDirectory(test_path_);
+#endif
+    CreateDirectory(test_path_);
     process_.RedirectOutput(output_file_);
     chromeos::ClearLog();
   }
 
   void TearDown() {
+#if BASE_VER >= 242728
+    base::DeleteFile(test_path_, true);
+#else
     file_util::Delete(test_path_, true);
+#endif
   }
 
  protected:
@@ -113,29 +136,28 @@
 TEST_F(ProcessTest, BadOutputFile) {
   process_.AddArg(kBinEcho);
   process_.RedirectOutput("/bad/path");
-  EXPECT_EQ(Process::kErrorExitStatus, process_.Run());
+  EXPECT_EQ(static_cast<pid_t>(Process::kErrorExitStatus), process_.Run());
 }
 
 TEST_F(ProcessTest, ExistingOutputFile) {
   process_.AddArg(kBinEcho);
   process_.AddArg("hello world");
-  EXPECT_FALSE(file_util::PathExists(FilePath(output_file_)));
+  EXPECT_FALSE(PathExists(FilePath(output_file_)));
   EXPECT_EQ(0, process_.Run());
-  EXPECT_TRUE(file_util::PathExists(FilePath(output_file_)));
-  EXPECT_EQ(Process::kErrorExitStatus, process_.Run());
+  EXPECT_TRUE(PathExists(FilePath(output_file_)));
+  EXPECT_EQ(static_cast<pid_t>(Process::kErrorExitStatus), process_.Run());
 }
 
 TEST_F(ProcessTest, BadExecutable) {
   process_.AddArg("false");
-  EXPECT_EQ(Process::kErrorExitStatus, process_.Run());
+  EXPECT_EQ(static_cast<pid_t>(Process::kErrorExitStatus), process_.Run());
 }
 
 void ProcessTest::CheckStderrCaptured() {
   std::string contents;
   process_.AddArg(kBinCp);
   EXPECT_EQ(1, process_.Run());
-  EXPECT_TRUE(file_util::ReadFileToString(FilePath(output_file_),
-                                                   &contents));
+  EXPECT_TRUE(ReadFileToString(FilePath(output_file_), &contents));
   EXPECT_NE(std::string::npos, contents.find("missing file operand"));
   EXPECT_EQ("", GetLog());
 }
@@ -166,8 +188,7 @@
   EXPECT_GE(pipe_fd, 0);
   EXPECT_EQ(-1, process_.GetPipe(STDOUT_FILENO));
   EXPECT_EQ(-1, process_.GetPipe(STDIN_FILENO));
-  EXPECT_TRUE(file_util::ReadFileToString(GetFdPath(pipe_fd),
-                                          &contents));
+  EXPECT_TRUE(ReadFileToString(GetFdPath(pipe_fd), &contents));
   EXPECT_NE(std::string::npos, contents.find("missing file operand"));
   EXPECT_EQ("", GetLog());
 }
@@ -195,8 +216,7 @@
   EXPECT_GE(pipe_fd, 0);
   EXPECT_EQ(-1, process_.GetPipe(STDERR_FILENO));
   EXPECT_EQ(-1, process_.GetPipe(STDIN_FILENO));
-  EXPECT_TRUE(file_util::ReadFileToString(GetFdPath(pipe_fd),
-                                          &contents));
+  EXPECT_TRUE(ReadFileToString(GetFdPath(pipe_fd), &contents));
   EXPECT_NE(std::string::npos, contents.find("hello world\n"));
   EXPECT_EQ("", GetLog());
 }
@@ -235,10 +255,9 @@
   ASSERT_NE(0, geteuid());
   process_.AddArg(kBinEcho);
   process_.SetUid(0);
-  EXPECT_EQ(Process::kErrorExitStatus, process_.Run());
+  EXPECT_EQ(static_cast<pid_t>(Process::kErrorExitStatus), process_.Run());
   std::string contents;
-  EXPECT_TRUE(file_util::ReadFileToString(FilePath(output_file_),
-                                          &contents));
+  EXPECT_TRUE(ReadFileToString(FilePath(output_file_), &contents));
   EXPECT_NE(std::string::npos,
             contents.find("Unable to set UID to 0: 1\n"));
 }
@@ -247,16 +266,15 @@
   ASSERT_NE(0, getegid());
   process_.AddArg(kBinEcho);
   process_.SetGid(0);
-  EXPECT_EQ(Process::kErrorExitStatus, process_.Run());
+  EXPECT_EQ(static_cast<pid_t>(Process::kErrorExitStatus), process_.Run());
   std::string contents;
-  EXPECT_TRUE(file_util::ReadFileToString(FilePath(output_file_),
-                                          &contents));
+  EXPECT_TRUE(ReadFileToString(FilePath(output_file_), &contents));
   EXPECT_NE(std::string::npos,
             contents.find("Unable to set GID to 0: 1\n"));
 }
 
 TEST_F(ProcessTest, NoParams) {
-  EXPECT_EQ(Process::kErrorExitStatus, process_.Run());
+  EXPECT_EQ(static_cast<pid_t>(Process::kErrorExitStatus), process_.Run());
 }
 
 TEST_F(ProcessTest, SegFaultHandling) {
diff --git a/chromeos/syslog_logging.cc b/chromeos/syslog_logging.cc
index 2da1a31..5d9a9da 100644
--- a/chromeos/syslog_logging.cc
+++ b/chromeos/syslog_logging.cc
@@ -88,11 +88,19 @@
   return flags;
 }
 void InitLog(int init_flags) {
+#if BASE_VER >= 242728
+  logging::LoggingSettings settings;
+  settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG;
+  settings.dcheck_state =
+      logging::DISABLE_DCHECK_FOR_NON_OFFICIAL_RELEASE_BUILDS;
+  logging::InitLogging(settings);
+#else
   logging::InitLogging("/dev/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);
+#endif
   logging::SetLogMessageHandler(HandleMessage);
   SetLogFlags(init_flags);
 }
diff --git a/chromeos/test_helpers.h b/chromeos/test_helpers.h
index 8cf4ad8..c66ba52 100644
--- a/chromeos/test_helpers.h
+++ b/chromeos/test_helpers.h
@@ -14,11 +14,21 @@
 #include <base/logging.h>
 #include <chromeos/syslog_logging.h>
 
+#if BASE_VER >= 242728
+#include <base/files/file_path.h>
+#endif
+
+#if BASE_VER >= 242728
+using base::FilePath;
+using base::ReadFileToString;
+#else
+using file_util::ReadFileToString;
+#endif
+
 inline void ExpectFileEquals(const char* golden,
                              const char* file_path) {
   std::string contents;
-  EXPECT_TRUE(file_util::ReadFileToString(FilePath(file_path),
-                                          &contents));
+  EXPECT_TRUE(ReadFileToString(FilePath(file_path), &contents));
   EXPECT_EQ(golden, contents);
 }
 
diff --git a/chromeos/utility.cc b/chromeos/utility.cc
index 4c8de57..8319f6c 100644
--- a/chromeos/utility.cc
+++ b/chromeos/utility.cc
@@ -2,7 +2,11 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
+#if BASE_VER >= 242728
+#include <base/strings/string_number_conversions.h>
+#else
 #include <base/string_number_conversions.h>
+#endif
 #include <chromeos/utility.h>
 
 #include <cstring>
@@ -14,6 +18,11 @@
 #include <dbus/dbus.h>
 #include <fcntl.h>
 
+#if BASE_VER >= 242728
+using base::DictionaryValue;
+using base::ListValue;
+#endif
+
 namespace {
 
 bool DBusMessageIterToPrimitiveValue(DBus::MessageIter& iter, Value** result) {
diff --git a/chromeos/utility.h b/chromeos/utility.h
index 3327ce1..21b0aa2 100644
--- a/chromeos/utility.h
+++ b/chromeos/utility.h
@@ -44,6 +44,10 @@
 #define CHROMEOS_CASE_RETURN_LABEL(label) \
     case label: return #label
 
+#if BASE_VER >= 242728
+using base::Value;
+#endif
+
 namespace chromeos {
 
 typedef std::vector<unsigned char> Blob;
diff --git a/chromeos/utility_test.cc b/chromeos/utility_test.cc
index 3304b0d..00af5cf 100644
--- a/chromeos/utility_test.cc
+++ b/chromeos/utility_test.cc
@@ -2,7 +2,6 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include <base/string_number_conversions.h>
 #include <chromeos/test_helpers.h>
 #include <chromeos/utility.h>
 
@@ -10,6 +9,18 @@
 #include <dbus/dbus.h>
 #include <gtest/gtest.h>
 
+#if BASE_VER >= 242728
+#include <base/strings/string_number_conversions.h>
+#else
+#include <base/string_number_conversions.h>
+#endif
+
+#if BASE_VER >= 242728
+using base::DictionaryValue;
+using base::ListValue;
+using base::Value;
+#endif
+
 static void MessageToValues(DBus::Message& m, std::vector<Value*>* result,
                             bool* success) {
   Value* v = NULL;
diff --git a/libchromeos-242728.gyp b/libchromeos-242728.gyp
new file mode 100644
index 0000000..7e38705
--- /dev/null
+++ b/libchromeos-242728.gyp
@@ -0,0 +1,8 @@
+{
+  'variables': {
+    'libbase_ver': 242728,
+  },
+  'includes': [
+    '../libchromeos/libchromeos.gypi',
+  ],
+}
diff --git a/libchromeos.gypi b/libchromeos.gypi
index 14ceb8c..5bfd9b2 100644
--- a/libchromeos.gypi
+++ b/libchromeos.gypi
@@ -8,6 +8,9 @@
       # Need to sort that out before we enable this.
       'enable_werror': 0,
     },
+    'defines': [
+      'BASE_VER=<(libbase_ver)',
+    ],
     'include_dirs': [
       '../libchromeos',
     ],
@@ -51,14 +54,10 @@
           ],
         },
       },
-      'defines': [
-        'BASE_VER=<(libbase_ver)',
-      ],
       'sources': [
         'chromeos/dbus/abstract_dbus_service.cc',
         'chromeos/dbus/dbus.cc',
         'chromeos/dbus/error_constants.cc',
-        'chromeos/platform.cc',
         'chromeos/process_information.cc',
         'chromeos/process.cc',
         'chromeos/secure_blob.cc',