Move ownership of libweave config to DeviceManager

It was not pretty that global config was owner by class responsible for
cloud communications.

Change-Id: I1476c610662a9773d38eb2fc64e1e2a5c769b63c
Reviewed-on: https://weave-review.googlesource.com/1826
Reviewed-by: Alex Vakulenko <avakulenko@google.com>
diff --git a/src/device_registration_info.h b/src/device_registration_info.h
index b1b9293..5ba56a1 100644
--- a/src/device_registration_info.h
+++ b/src/device_registration_info.h
@@ -57,9 +57,8 @@
       base::Callback<void(const base::DictionaryValue& response,
                           ErrorPtr error)>;
 
-  DeviceRegistrationInfo(ComponentManager* component_manager,
-                         std::unique_ptr<Config>
-                             config,
+  DeviceRegistrationInfo(Config* config,
+                         ComponentManager* component_manager,
                          provider::TaskRunner* task_runner,
                          provider::HttpClient* http_client,
                          provider::Network* network,
@@ -121,7 +120,7 @@
 
   // TODO(vitalybuka): remove getters and pass config to dependent code.
   const Config::Settings& GetSettings() const { return config_->GetSettings(); }
-  Config* GetMutableConfig() { return config_.get(); }
+  Config* GetMutableConfig() { return config_; }
 
   GcdState GetGcdState() const { return gcd_state_; }
 
@@ -306,11 +305,12 @@
   provider::HttpClient* http_client_{nullptr};
 
   provider::TaskRunner* task_runner_{nullptr};
+
+  Config* config_{nullptr};
+
   // Global component manager.
   ComponentManager* component_manager_{nullptr};
 
-  std::unique_ptr<Config> config_;
-
   // Backoff manager for DoCloudRequest() method.
   std::unique_ptr<BackoffEntry::Policy> cloud_backoff_policy_;
   std::unique_ptr<BackoffEntry> cloud_backoff_entry_;