update_engine: Fix all the "using" declaration usage.

This patch removes unused "using" declarations, that is, declarations
included in a .cc file at a global scope such that "using foo::bar"
that later don't use the identifier "bar" at all.

This also unifies the usage of these identifiers in the .cc files
in favor of using the short name defined by the using declaration.
For example, in several cases the .h refer to a type like
"std::string" because using declarations are forbidden in header
files while the .cc includes "using std::string;" with the purpose
of just writting "string" in the .cc file. Very rarely, the full
identifier is used when a local name ocludes it, for example,
StringVectorToGStrv() and StringVectorToString() in utils.cc named
its argument just "vector" need to refer to std::vector with the
full name. This patch renames those arguments instead.

Finally, it also sorts a few lists of using declarations that weren't
in order.

BUG=None
TEST=FEATURES=test emerge-link update_engine

Change-Id: I30f6b9510ecb7e03640f1951c48d5bb106309840
Reviewed-on: https://chromium-review.googlesource.com/226423
Reviewed-by: Alex Vakulenko <avakulenko@chromium.org>
Commit-Queue: Alex Deymo <deymo@chromium.org>
Tested-by: Alex Deymo <deymo@chromium.org>
diff --git a/p2p_manager.cc b/p2p_manager.cc
index 9f0db53..240b44a 100644
--- a/p2p_manager.cc
+++ b/p2p_manager.cc
@@ -66,8 +66,8 @@
 
   virtual ~ConfigurationImpl() {}
 
-  virtual base::FilePath GetP2PDir() {
-    return base::FilePath(kDefaultP2PDir);
+  virtual FilePath GetP2PDir() {
+    return FilePath(kDefaultP2PDir);
   }
 
   virtual vector<string> GetInitctlArgs(bool is_start) {
@@ -83,7 +83,7 @@
     vector<string> args;
     args.push_back("p2p-client");
     args.push_back(string("--get-url=") + file_id);
-    args.push_back(base::StringPrintf("--minimum-size=%zu", minimum_size));
+    args.push_back(StringPrintf("--minimum-size=%zu", minimum_size));
     return args;
   }
 
@@ -111,7 +111,7 @@
                                 LookupCallback callback);
   virtual bool FileShare(const string& file_id,
                          size_t expected_size);
-  virtual base::FilePath FileGetPath(const string& file_id);
+  virtual 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,
@@ -133,7 +133,7 @@
 
   // Gets the on-disk path for |file_id| depending on if the file
   // is visible or not.
-  base::FilePath GetPath(const string& file_id, Visibility visibility);
+  FilePath GetPath(const string& file_id, Visibility visibility);
 
   // Utility function used by EnsureP2PRunning() and EnsureP2PNotRunning().
   bool EnsureP2P(bool should_be_running);
@@ -326,7 +326,7 @@
 
   // Go through all files in the p2p dir and pick the ones that match
   // and get their ctime.
-  base::FilePath p2p_dir = configuration_->GetP2PDir();
+  FilePath p2p_dir = configuration_->GetP2PDir();
   dir = g_dir_open(p2p_dir.value().c_str(), 0, &error);
   if (dir == nullptr) {
     LOG(ERROR) << "Error opening directory " << p2p_dir.value() << ": "
@@ -345,7 +345,7 @@
       continue;
 
     struct stat statbuf;
-    base::FilePath file = p2p_dir.Append(name);
+    FilePath file = p2p_dir.Append(name);
     if (stat(file.value().c_str(), &statbuf) != 0) {
       PLOG(ERROR) << "Error getting file status for " << file.value();
       continue;
@@ -362,7 +362,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 base::FilePath& file = i->first;
+    const 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();
@@ -568,7 +568,7 @@
 bool P2PManagerImpl::FileShare(const string& file_id,
                                size_t expected_size) {
   // Check if file already exist.
-  base::FilePath path = FileGetPath(file_id);
+  FilePath path = FileGetPath(file_id);
   if (!path.empty()) {
     // File exists - double check its expected size though.
     ssize_t file_expected_size = FileGetExpectedSize(file_id);
@@ -586,7 +586,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;
-  base::FilePath p2p_dir = configuration_->GetP2PDir();
+  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;
@@ -636,7 +636,7 @@
       }
     }
 
-    string decimal_size = base::StringPrintf("%zu", expected_size);
+    string decimal_size = StringPrintf("%zu", expected_size);
     if (fsetxattr(fd, kCrosP2PFileSizeXAttrName,
                   decimal_size.c_str(), decimal_size.size(), 0) != 0) {
       PLOG(ERROR) << "Error setting xattr " << path.value();
@@ -649,7 +649,7 @@
 
 FilePath P2PManagerImpl::FileGetPath(const string& file_id) {
   struct stat statbuf;
-  base::FilePath path;
+  FilePath path;
 
   path = GetPath(file_id, kVisible);
   if (stat(path.value().c_str(), &statbuf) == 0) {
@@ -667,7 +667,7 @@
 
 bool P2PManagerImpl::FileGetVisible(const string& file_id,
                                     bool *out_result) {
-  base::FilePath path = FileGetPath(file_id);
+  FilePath path = FileGetPath(file_id);
   if (path.empty()) {
     LOG(ERROR) << "No file for id " << file_id;
     return false;
@@ -678,7 +678,7 @@
 }
 
 bool P2PManagerImpl::FileMakeVisible(const string& file_id) {
-  base::FilePath path = FileGetPath(file_id);
+  FilePath path = FileGetPath(file_id);
   if (path.empty()) {
     LOG(ERROR) << "No file for id " << file_id;
     return false;
@@ -689,7 +689,7 @@
     return true;
 
   LOG_ASSERT(path.MatchesExtension(kTmpExtension));
-  base::FilePath new_path = path.RemoveExtension();
+  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()
@@ -701,7 +701,7 @@
 }
 
 ssize_t P2PManagerImpl::FileGetSize(const string& file_id) {
-  base::FilePath path = FileGetPath(file_id);
+  FilePath path = FileGetPath(file_id);
   if (path.empty())
     return -1;
 
@@ -709,7 +709,7 @@
 }
 
 ssize_t P2PManagerImpl::FileGetExpectedSize(const string& file_id) {
-  base::FilePath path = FileGetPath(file_id);
+  FilePath path = FileGetPath(file_id);
   if (path.empty())
     return -1;
 
@@ -740,7 +740,7 @@
   const char* name;
   int num_files = 0;
 
-  base::FilePath p2p_dir = configuration_->GetP2PDir();
+  FilePath p2p_dir = configuration_->GetP2PDir();
   dir = g_dir_open(p2p_dir.value().c_str(), 0, &error);
   if (dir == nullptr) {
     LOG(ERROR) << "Error opening directory " << p2p_dir.value() << ": "