update_engine: Cleanup of HardwareInterface - const/override

Made most of the members of HardwareInterface 'const' and
used C++11's override on implementations to guard against method
signature changes.

BUG=None
TEST=Ran all unit tests

Change-Id: I33eecb0e6a0fc662da75fbf8d9953f0bb09cb08d
Reviewed-on: https://chromium-review.googlesource.com/187483
Tested-by: Alex Vakulenko <avakulenko@chromium.org>
Reviewed-by: Alex Vakulenko <avakulenko@chromium.org>
Commit-Queue: Alex Vakulenko <avakulenko@chromium.org>
diff --git a/fake_hardware.h b/fake_hardware.h
index 6f4be77..ff572f9 100644
--- a/fake_hardware.h
+++ b/fake_hardware.h
@@ -17,7 +17,7 @@
   FakeHardware()
     : kernel_device_("/dev/sdz4"),
       boot_device_("/dev/sdz5"),
-      bootable_devices_{"/dev/sdz4", "/dev/sdz5"},
+      bootable_devices_({"/dev/sdz4", "/dev/sdz5"}),
       is_official_build_(true),
       is_normal_boot_mode_(true),
       hardware_class_("Fake HWID BLAH-1234"),
@@ -25,26 +25,43 @@
       ec_version_("Fake EC v1.0a") {}
 
   // HardwareInterface methods.
-  virtual const std::string BootKernelDevice() { return kernel_device_; }
-  virtual const std::string BootDevice() { return boot_device_; }
-  virtual std::vector<std::string> GetKernelDevices() override
-      { return bootable_devices_; }
+  virtual std::string BootKernelDevice() const override {
+    return kernel_device_;
+  }
+
+  virtual std::string BootDevice() const override { return boot_device_; }
+
+  virtual std::vector<std::string> GetKernelDevices() const override {
+    return bootable_devices_;
+  }
 
   virtual bool IsKernelBootable(const std::string& kernel_device,
-                                bool* bootable)
-      { std::map<std::string, bool>::const_iterator i =
-            is_bootable_.find(kernel_device);
-        *bootable = (i != is_bootable_.end()) ? i->second : true;
-        return true; }
+                                bool* bootable) const override {
+    auto i = is_bootable_.find(kernel_device);
+    *bootable = (i != is_bootable_.end()) ? i->second : true;
+    return true;
+  }
 
-  virtual bool MarkKernelUnbootable(const std::string& kernel_device)
-      { is_bootable_[kernel_device] = false; return true;}
+  virtual bool MarkKernelUnbootable(const std::string& kernel_device) override {
+    is_bootable_[kernel_device] = false;
+    return true;
+  }
 
-  virtual bool IsOfficialBuild() { return is_official_build_; }
-  virtual bool IsNormalBootMode() { return is_normal_boot_mode_; }
-  virtual std::string GetHardwareClass() { return hardware_class_; }
-  virtual std::string GetFirmwareVersion() { return firmware_version_; }
-  virtual std::string GetECVersion() { return ec_version_; }
+  virtual bool IsOfficialBuild() const override { return is_official_build_; }
+
+  virtual bool IsNormalBootMode() const override {
+    return is_normal_boot_mode_;
+  }
+
+  virtual std::string GetHardwareClass() const override {
+    return hardware_class_;
+  }
+
+  virtual std::string GetFirmwareVersion() const override {
+    return firmware_version_;
+  }
+
+  virtual std::string GetECVersion() const override { return ec_version_; }
 
   // Setters
   void SetBootDevice(const std::string boot_device) {