buffet: Pass CommandManager instance to DeviceRegistrationInfo

In order to generate device draft for device registration with
GCD cloud server, DeviceRegistrationInfo class needs access
to CommandManager class to get the CDD for supported commands.

BUG=chromium:396716
TEST=USE=buffet P2_TEST_FILTER="buffet::*" FEATURES=test emerge-link platform2

Change-Id: I076249a890dc865f3af119315ab1c1c50c6edcf4
Reviewed-on: https://chromium-review.googlesource.com/209564
Tested-by: Alex Vakulenko <avakulenko@chromium.org>
Reviewed-by: Chris Sosa <sosa@chromium.org>
Reviewed-by: Christopher Wiley <wiley@chromium.org>
Commit-Queue: Alex Vakulenko <avakulenko@chromium.org>
diff --git a/buffet/device_registration_info.h b/buffet/device_registration_info.h
index d1c0e6e..a150253 100644
--- a/buffet/device_registration_info.h
+++ b/buffet/device_registration_info.h
@@ -24,6 +24,8 @@
 
 namespace buffet {
 
+class CommandManager;
+
 extern const char kErrorDomainOAuth2[];
 extern const char kErrorDomainGCD[];
 extern const char kErrorDomainGCDServer[];
@@ -34,12 +36,14 @@
  public:
   // This is a helper class for unit testing.
   class TestHelper;
-  // Default-constructed uses CURL HTTP transport.
-  DeviceRegistrationInfo();
+  // This constructor uses CURL HTTP transport.
+  explicit DeviceRegistrationInfo(
+      const std::shared_ptr<CommandManager>& command_manager);
   // This constructor allows to pass in a custom HTTP transport
   // (mainly for testing).
-  DeviceRegistrationInfo(std::shared_ptr<http::Transport> transport,
-                         std::shared_ptr<StorageInterface> storage);
+  DeviceRegistrationInfo(const std::shared_ptr<CommandManager>& command_manager,
+                         const std::shared_ptr<http::Transport>& transport,
+                         const std::shared_ptr<StorageInterface>& storage);
 
   // Returns the authorization HTTP header that can be used to talk
   // to GCD server for authenticated device communication.
@@ -136,6 +140,8 @@
   std::shared_ptr<http::Transport> transport_;
   // Serialization interface to save and load device registration info.
   std::shared_ptr<StorageInterface> storage_;
+  // Global command manager.
+  std::shared_ptr<CommandManager> command_manager_;
 
   friend class TestHelper;
   DISALLOW_COPY_AND_ASSIGN(DeviceRegistrationInfo);