Switch to use ComponentManager for traits/components

Removed the old StateManager, CommandManager and related classes
and switched over to using ComponentManager for all device trait and
component definitions as well as device state.

Change-Id: I99b99a935ba217703d31aa523a3124cca0fa3e90
Reviewed-on: https://weave-review.googlesource.com/1788
Reviewed-by: Alex Vakulenko <avakulenko@google.com>
diff --git a/src/device_registration_info.h b/src/device_registration_info.h
index 1399b37..f3b5302 100644
--- a/src/device_registration_info.h
+++ b/src/device_registration_info.h
@@ -21,13 +21,12 @@
 
 #include "src/backoff_entry.h"
 #include "src/commands/cloud_command_update_interface.h"
-#include "src/commands/command_manager.h"
+#include "src/component_manager.h"
 #include "src/config.h"
 #include "src/data_encoding.h"
 #include "src/notification/notification_channel.h"
 #include "src/notification/notification_delegate.h"
 #include "src/notification/pull_channel.h"
-#include "src/states/state_change_queue_interface.h"
 
 namespace base {
 class DictionaryValue;
@@ -54,12 +53,12 @@
       base::Callback<void(const base::DictionaryValue& response,
                           ErrorPtr error)>;
 
-  DeviceRegistrationInfo(const std::shared_ptr<CommandManager>& command_manager,
-                         const std::shared_ptr<StateManager>& state_manager,
-                         std::unique_ptr<Config> config,
-                         provider::TaskRunner* task_runner,
-                         provider::HttpClient* http_client,
-                         provider::Network* network);
+  DeviceRegistrationInfo(
+      ComponentManager* component_manager,
+      std::unique_ptr<Config> config,
+      provider::TaskRunner* task_runner,
+      provider::HttpClient* http_client,
+      provider::Network* network);
 
   ~DeviceRegistrationInfo() override;
 
@@ -236,7 +235,7 @@
   void FetchAndPublishCommands(const std::string& reason);
 
   void PublishStateUpdates();
-  void OnPublishStateDone(StateChangeQueueInterface::UpdateID update_id,
+  void OnPublishStateDone(ComponentManager::UpdateID update_id,
                           const base::DictionaryValue& reply,
                           ErrorPtr error);
   void OnPublishStateError(ErrorPtr error);
@@ -254,7 +253,8 @@
   void SetDeviceId(const std::string& cloud_id);
 
   // Callback called when command definitions are changed to re-publish new CDD.
-  void OnCommandDefsChanged();
+  void OnTraitDefsChanged();
+  void OnComponentTreeChanged();
   void OnStateChanged();
 
   // Overrides from NotificationDelegate.
@@ -299,10 +299,8 @@
   provider::HttpClient* http_client_{nullptr};
 
   provider::TaskRunner* task_runner_{nullptr};
-  // Global command manager.
-  std::shared_ptr<CommandManager> command_manager_;
-  // Device state manager.
-  std::shared_ptr<StateManager> state_manager_;
+  // Global component manager.
+  ComponentManager* component_manager_{nullptr};
 
   std::unique_ptr<Config> config_;