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/update_attempter.cc b/update_attempter.cc
index 370cfd9..2911540 100644
--- a/update_attempter.cc
+++ b/update_attempter.cc
@@ -60,8 +60,6 @@
 using chromeos_update_manager::EvalStatus;
 using chromeos_update_manager::Policy;
 using chromeos_update_manager::UpdateCheckParams;
-using google::protobuf::NewPermanentCallback;
-using std::make_pair;
 using std::set;
 using std::shared_ptr;
 using std::string;
@@ -133,7 +131,7 @@
 
 UpdateAttempter::UpdateAttempter(SystemState* system_state,
                                  DBusWrapperInterface* dbus_iface,
-                                 const std::string& update_completed_marker)
+                                 const string& update_completed_marker)
     : processor_(new ActionProcessor()),
       system_state_(system_state),
       dbus_iface_(dbus_iface),
@@ -176,12 +174,12 @@
 
 bool UpdateAttempter::CheckAndReportDailyMetrics() {
   int64_t stored_value;
-  base::Time now = system_state_->clock()->GetWallclockTime();
+  Time now = system_state_->clock()->GetWallclockTime();
   if (system_state_->prefs()->Exists(kPrefsDailyMetricsLastReportedAt) &&
       system_state_->prefs()->GetInt64(kPrefsDailyMetricsLastReportedAt,
                                        &stored_value)) {
-    base::Time last_reported_at = base::Time::FromInternalValue(stored_value);
-    base::TimeDelta time_reported_since = now - last_reported_at;
+    Time last_reported_at = Time::FromInternalValue(stored_value);
+    TimeDelta time_reported_since = now - last_reported_at;
     if (time_reported_since.InSeconds() < 0) {
       LOG(WARNING) << "Last reported daily metrics "
                    << utils::FormatTimeDelta(time_reported_since) << " ago "
@@ -222,9 +220,9 @@
     return;
   }
 
-  base::Time lsb_release_timestamp = utils::TimeFromStructTimespec(&sb.st_ctim);
-  base::Time now = system_state_->clock()->GetWallclockTime();
-  base::TimeDelta age = now - lsb_release_timestamp;
+  Time lsb_release_timestamp = utils::TimeFromStructTimespec(&sb.st_ctim);
+  Time now = system_state_->clock()->GetWallclockTime();
+  TimeDelta age = now - lsb_release_timestamp;
   if (age.InSeconds() < 0) {
     LOG(ERROR) << "The OS age (" << utils::FormatTimeDelta(age)
                << ") is negative. Maybe the clock is wrong? "
@@ -232,7 +230,7 @@
     return;
   }
 
-  std::string metric = "Installer.OSAgeDays";
+  string metric = "Installer.OSAgeDays";
   LOG(INFO) << "Uploading " << utils::FormatTimeDelta(age)
             << " for metric " <<  metric;
   system_state_->metrics_lib()->SendToUMA(
@@ -751,11 +749,11 @@
   return (status_ == UPDATE_STATUS_IDLE && !GetRollbackPartition().empty());
 }
 
-std::string UpdateAttempter::GetRollbackPartition() const {
-  std::vector<std::string> kernel_devices =
+string UpdateAttempter::GetRollbackPartition() const {
+  vector<string> kernel_devices =
       system_state_->hardware()->GetKernelDevices();
 
-  std::string boot_kernel_device =
+  string boot_kernel_device =
       system_state_->hardware()->BootKernelDevice();
 
   LOG(INFO) << "UpdateAttempter::GetRollbackPartition";
@@ -769,10 +767,10 @@
   if (current == kernel_devices.end()) {
     LOG(ERROR) << "Unable to find the boot kernel device in the list of "
                << "available devices";
-    return std::string();
+    return string();
   }
 
-  for (std::string const& device_name : kernel_devices) {
+  for (string const& device_name : kernel_devices) {
     if (device_name != *current) {
       bool bootable = false;
       if (system_state_->hardware()->IsKernelBootable(device_name, &bootable) &&
@@ -782,21 +780,21 @@
     }
   }
 
-  return std::string();
+  return string();
 }
 
-std::vector<std::pair<std::string, bool>>
+vector<std::pair<string, bool>>
     UpdateAttempter::GetKernelDevices() const {
-  std::vector<std::string> kernel_devices =
+  vector<string> kernel_devices =
     system_state_->hardware()->GetKernelDevices();
 
-  std::string boot_kernel_device =
+  string boot_kernel_device =
     system_state_->hardware()->BootKernelDevice();
 
-  std::vector<std::pair<std::string, bool>> info_list;
+  vector<std::pair<string, bool>> info_list;
   info_list.reserve(kernel_devices.size());
 
-  for (std::string device_name : kernel_devices) {
+  for (string device_name : kernel_devices) {
     bool bootable = false;
     system_state_->hardware()->IsKernelBootable(device_name, &bootable);
     // Add '*' to the name of the partition we booted from.
@@ -840,7 +838,7 @@
     return;
 
   int64_t value = system_state_->clock()->GetBootTime().ToInternalValue();
-  string contents = base::StringPrintf("%" PRIi64, value);
+  string contents = StringPrintf("%" PRIi64, value);
 
   utils::WriteFile(update_completed_marker_.c_str(),
                    contents.c_str(),
@@ -1592,7 +1590,7 @@
   return true;
 }
 
-bool UpdateAttempter::GetBootTimeAtUpdate(base::Time *out_boot_time) {
+bool UpdateAttempter::GetBootTimeAtUpdate(Time *out_boot_time) {
   if (update_completed_marker_.empty())
     return false;