firmwarehandler: Provide a factory for building

Provide a factory for building the firmware blob handler.  This allows
us to later provide built-time parameters to the handler through the
constructor and not within the object itself.

Change-Id: I19c90de45eaf65b78dfd55beb61f2ad4cc6fa43e
Signed-off-by: Patrick Venture <venture@google.com>
diff --git a/firmware_handler.cpp b/firmware_handler.cpp
index 7f4fff4..e459c61 100644
--- a/firmware_handler.cpp
+++ b/firmware_handler.cpp
@@ -2,6 +2,7 @@
 
 #include "firmware_handler.hpp"
 
+#include <memory>
 #include <string>
 #include <vector>
 
@@ -15,6 +16,12 @@
 #endif
 };
 
+std::unique_ptr<GenericBlobInterface>
+    FirmwareBlobHandler::CreateFirmwareBlobHandler()
+{
+    return std::make_unique<FirmwareBlobHandler>();
+}
+
 bool FirmwareBlobHandler::canHandleBlob(const std::string& path)
 {
     /* Check if the path is in our supported list (or active list). */
diff --git a/firmware_handler.hpp b/firmware_handler.hpp
index ada0c14..e22c335 100644
--- a/firmware_handler.hpp
+++ b/firmware_handler.hpp
@@ -1,6 +1,7 @@
 #pragma once
 
 #include <blobs-ipmid/blobs.hpp>
+#include <memory>
 
 namespace blobs
 {
@@ -18,6 +19,8 @@
 class FirmwareBlobHandler : public GenericBlobInterface
 {
   public:
+    static std::unique_ptr<GenericBlobInterface> CreateFirmwareBlobHandler();
+
     FirmwareBlobHandler() = default;
     ~FirmwareBlobHandler() = default;
     FirmwareBlobHandler(const FirmwareBlobHandler&) = default;
diff --git a/main.cpp b/main.cpp
index 127d37b..b7d35d1 100644
--- a/main.cpp
+++ b/main.cpp
@@ -13,7 +13,8 @@
 void setupFirmwareHandler()
 {
     auto* manager = getBlobManager();
-    if (!manager->registerHandler(std::make_unique<FirmwareBlobHandler>()))
+    if (!manager->registerHandler(
+            FirmwareBlobHandler::CreateFirmwareBlobHandler()))
     {
         log<level::ERR>("Failed to register Firmware Handler");
     }