buffet: Move ShillClient to buffet

ShillClient is brillo specific code and should not be in libweave.

BUG=brillo:1249
TEST='FEATURES=test emerge-gizmo buffet'

Change-Id: Ib44f3621519eb9de4cafae3042117b71de413846
Reviewed-on: https://chromium-review.googlesource.com/290100
Reviewed-by: Vitaly Buka <vitalybuka@chromium.org>
Commit-Queue: Vitaly Buka <vitalybuka@chromium.org>
Tested-by: Vitaly Buka <vitalybuka@chromium.org>
diff --git a/buffet/buffet.gyp b/buffet/buffet.gyp
index 3c59e0a..fde6d30 100644
--- a/buffet/buffet.gyp
+++ b/buffet/buffet.gyp
@@ -33,6 +33,7 @@
         'dbus_constants.cc',
         'manager.cc',
         'peerd_client.cc',
+        'shill_client.cc',
         '../libweave/src/base_api_handler.cc',
         '../libweave/src/buffet_config.cc',
         '../libweave/src/commands/cloud_command_proxy.cc',
@@ -66,7 +67,6 @@
         '../libweave/src/privet/privet_types.cc',
         '../libweave/src/privet/publisher.cc',
         '../libweave/src/privet/security_manager.cc',
-        '../libweave/src/privet/shill_client.cc',
         '../libweave/src/privet/privet_types.cc',
         '../libweave/src/privet/wifi_bootstrap_manager.cc',
         '../libweave/src/privet/wifi_ssid_generator.cc',
diff --git a/buffet/main.cc b/buffet/main.cc
index 0d1dff9..276e030 100644
--- a/buffet/main.cc
+++ b/buffet/main.cc
@@ -24,19 +24,24 @@
 
 class Daemon final : public DBusServiceDaemon {
  public:
-  explicit Daemon(const weave::Device::Options& options)
-      : DBusServiceDaemon(kServiceName, kRootServicePath), options_{options} {}
+  Daemon(const weave::Device::Options& options,
+         const std::set<std::string>& device_whitelist)
+      : DBusServiceDaemon(kServiceName, kRootServicePath),
+        options_{options},
+        device_whitelist_{device_whitelist} {}
 
  protected:
   void RegisterDBusObjectsAsync(AsyncEventSequencer* sequencer) override {
     manager_.reset(new buffet::Manager(object_manager_->AsWeakPtr()));
-    manager_->Start(options_, sequencer);
+    manager_->Start(options_, device_whitelist_, sequencer);
   }
 
   void OnShutdown(int* return_code) override { manager_->Stop(); }
 
  private:
   weave::Device::Options options_;
+  std::set<std::string> device_whitelist_;
+
   std::unique_ptr<buffet::Manager> manager_;
   DISALLOW_COPY_AND_ASSIGN(Daemon);
 };
@@ -91,13 +96,12 @@
   options.definitions_path = base::FilePath{"/etc/buffet"};
   options.test_definitions_path = base::FilePath{FLAGS_test_definitions_path};
   options.xmpp_enabled = FLAGS_enable_xmpp;
-  options.device_whitelist.insert(device_whitelist.begin(),
-                                  device_whitelist.end());
   options.disable_privet = FLAGS_disable_privet;
   options.disable_security = FLAGS_disable_security;
   options.enable_ping = FLAGS_enable_ping;
   options.test_privet_ssid = FLAGS_test_privet_ssid;
 
-  buffet::Daemon daemon{options};
+  buffet::Daemon daemon{options, std::set<std::string>{device_whitelist.begin(),
+                                                       device_whitelist.end()}};
   return daemon.Run();
 }
diff --git a/buffet/manager.cc b/buffet/manager.cc
index f6b27a3..9df8caa 100644
--- a/buffet/manager.cc
+++ b/buffet/manager.cc
@@ -26,6 +26,7 @@
 #include "buffet/dbus_command_dispatcher.h"
 #include "buffet/dbus_conversion.h"
 #include "buffet/peerd_client.h"
+#include "buffet/shill_client.h"
 #include "weave/enum_to_string.h"
 
 using chromeos::dbus_utils::AsyncEventSequencer;
@@ -54,11 +55,14 @@
 }
 
 void Manager::Start(const weave::Device::Options& options,
+                    const std::set<std::string>& device_whitelist,
                     AsyncEventSequencer* sequencer) {
   peerd_client_.reset(new PeerdClient{dbus_object_.GetBus()});
+  shill_client_.reset(new ShillClient{dbus_object_.GetBus(), device_whitelist});
 
   device_ = weave::Device::Create();
-  device_->Start(options, peerd_client_.get(), &dbus_object_, sequencer);
+  device_->Start(options, peerd_client_.get(), shill_client_.get(),
+                 &dbus_object_, sequencer);
 
   command_dispatcher_.reset(new DBusCommandDispacher{
       dbus_object_.GetObjectManager(), device_->GetCommands()});
diff --git a/buffet/manager.h b/buffet/manager.h
index e9fcad9..c0037e9 100644
--- a/buffet/manager.h
+++ b/buffet/manager.h
@@ -30,9 +30,9 @@
 
 namespace buffet {
 
-class PeerdClient;
-
 class DBusCommandDispacher;
+class PeerdClient;
+class ShillClient;
 
 template<typename... Types>
 using DBusMethodResponsePtr =
@@ -53,6 +53,7 @@
   ~Manager();
 
   void Start(const weave::Device::Options& options,
+             const std::set<std::string>& device_whitelist,
              chromeos::dbus_utils::AsyncEventSequencer* sequencer);
 
   void Stop();
@@ -117,6 +118,7 @@
   chromeos::dbus_utils::DBusObject dbus_object_;
 
   std::unique_ptr<PeerdClient> peerd_client_;
+  std::unique_ptr<ShillClient> shill_client_;
   std::unique_ptr<weave::Device> device_;
   std::unique_ptr<DBusCommandDispacher> command_dispatcher_;
 
diff --git a/buffet/peerd_client.h b/buffet/peerd_client.h
index e24cd32..89322cd 100644
--- a/buffet/peerd_client.h
+++ b/buffet/peerd_client.h
@@ -2,8 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef BUFFET_PRIVET_PEERD_CLIENT_H_
-#define BUFFET_PRIVET_PEERD_CLIENT_H_
+#ifndef BUFFET_PEERD_CLIENT_H_
+#define BUFFET_PEERD_CLIENT_H_
 
 #include <map>
 #include <memory>
@@ -68,4 +68,4 @@
 
 }  // namespace buffet
 
-#endif  // BUFFET_PRIVET_PEERD_CLIENT_H_
+#endif  // BUFFET_PEERD_CLIENT_H_
diff --git a/libweave/src/privet/shill_client.cc b/buffet/shill_client.cc
similarity index 93%
rename from libweave/src/privet/shill_client.cc
rename to buffet/shill_client.cc
index 9c81064..1efc52d 100644
--- a/libweave/src/privet/shill_client.cc
+++ b/buffet/shill_client.cc
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "libweave/src/privet/shill_client.h"
+#include "buffet/shill_client.h"
 
 #include <set>
 
@@ -25,13 +25,11 @@
 using std::string;
 using std::vector;
 
-namespace weave {
-namespace privet {
+namespace buffet {
 
 namespace {
 
-void IgnoreDetachEvent() {
-}
+void IgnoreDetachEvent() {}
 
 bool GetStateForService(ServiceProxy* service, string* state) {
   CHECK(service) << "|service| was nullptr in GetStateForService()";
@@ -54,31 +52,31 @@
   return true;
 }
 
-NetworkState ShillNetworkStateToNetworkState(const string& state) {
+weave::NetworkState ShillServiceStateToNetworkState(const string& state) {
   // TODO(wiley) What does "unconfigured" mean in a world with multiple sets
   //             of WiFi credentials?
   // TODO(wiley) Detect disabled devices, update state appropriately.
   if ((state.compare(shill::kStateReady) == 0) ||
       (state.compare(shill::kStatePortal) == 0) ||
       (state.compare(shill::kStateOnline) == 0)) {
-    return NetworkState::kConnected;
+    return weave::NetworkState::kConnected;
   }
   if ((state.compare(shill::kStateAssociation) == 0) ||
       (state.compare(shill::kStateConfiguration) == 0)) {
-    return NetworkState::kConnecting;
+    return weave::NetworkState::kConnecting;
   }
   if ((state.compare(shill::kStateFailure) == 0) ||
       (state.compare(shill::kStateActivationFailure) == 0)) {
     // TODO(wiley) Get error information off the service object.
-    return NetworkState::kFailure;
+    return weave::NetworkState::kFailure;
   }
   if ((state.compare(shill::kStateIdle) == 0) ||
       (state.compare(shill::kStateOffline) == 0) ||
       (state.compare(shill::kStateDisconnect) == 0)) {
-    return NetworkState::kOffline;
+    return weave::NetworkState::kOffline;
   }
   LOG(WARNING) << "Unknown state found: '" << state << "'";
-  return NetworkState::kOffline;
+  return weave::NetworkState::kOffline;
 }
 
 }  // namespace
@@ -103,7 +101,7 @@
   VLOG(2) << "ShillClient::Init();";
   CleanupConnectingService(false);
   devices_.clear();
-  connectivity_state_ = NetworkState::kOffline;
+  connectivity_state_ = weave::NetworkState::kOffline;
   VariantDictionary properties;
   if (!manager_proxy_.GetProperties(&properties, nullptr)) {
     LOG(ERROR) << "Unable to get properties from Manager, waiting for "
@@ -146,7 +144,7 @@
   return true;
 }
 
-NetworkState ShillClient::GetConnectionState() const {
+weave::NetworkState ShillClient::GetConnectionState() const {
   return connectivity_state_;
 }
 
@@ -178,7 +176,7 @@
   if (new_owner.empty()) {
     CleanupConnectingService(false);
     devices_.clear();
-    connectivity_state_ = NetworkState::kOffline;
+    connectivity_state_ = weave::NetworkState::kOffline;
   } else {
     Init();  // New service owner means shill reset!
   }
@@ -297,7 +295,7 @@
       return;  // Spurious update?
     }
     device_state.selected_service.reset();
-    device_state.service_state = NetworkState::kOffline;
+    device_state.service_state = weave::NetworkState::kOffline;
     removed_old_service = true;
   }
   std::shared_ptr<ServiceProxy> new_service;
@@ -312,7 +310,7 @@
     // happened long in the past for the connecting service.
     string state;
     if (GetStateForService(new_service.get(), &state)) {
-      device_state.service_state = ShillNetworkStateToNetworkState(state);
+      device_state.service_state = ShillServiceStateToNetworkState(state);
     } else {
       LOG(WARNING) << "Failed to read properties from existing service "
                       "on selection.";
@@ -397,7 +395,8 @@
     const string& state) {
   if (!connecting_service_ ||
       connecting_service_->GetObjectPath() != service_path ||
-      ShillNetworkStateToNetworkState(state) != NetworkState::kConnected) {
+      ShillServiceStateToNetworkState(state) !=
+          weave::NetworkState::kConnected) {
     return;
   }
   connecting_service_reset_pending_ = true;
@@ -432,7 +431,7 @@
     if (kv.second.selected_service &&
         kv.second.selected_service->GetObjectPath() == service_path) {
       VLOG(3) << "Updated cached connection state for selected service.";
-      kv.second.service_state = ShillNetworkStateToNetworkState(state);
+      kv.second.service_state = ShillServiceStateToNetworkState(state);
       UpdateConnectivityState();
       return;
     }
@@ -442,7 +441,7 @@
 void ShillClient::UpdateConnectivityState() {
   // Update the connectivity state of the device by picking the
   // state of the currently most connected selected service.
-  NetworkState new_connectivity_state{NetworkState::kOffline};
+  weave::NetworkState new_connectivity_state{weave::NetworkState::kOffline};
   for (const auto& kv : devices_) {
     if (kv.second.service_state > new_connectivity_state) {
       new_connectivity_state = kv.second.service_state;
@@ -459,9 +458,10 @@
   // underway.  Therefore, call our callbacks later, when we're in a good
   // state.
   base::MessageLoop::current()->PostTask(
-      FROM_HERE, base::Bind(&ShillClient::NotifyConnectivityListeners,
-                            weak_factory_.GetWeakPtr(),
-                            GetConnectionState() == NetworkState::kConnected));
+      FROM_HERE,
+      base::Bind(&ShillClient::NotifyConnectivityListeners,
+                 weak_factory_.GetWeakPtr(),
+                 GetConnectionState() == weave::NetworkState::kConnected));
 }
 
 void ShillClient::NotifyConnectivityListeners(bool am_online) {
@@ -484,5 +484,4 @@
   connecting_service_reset_pending_ = false;
 }
 
-}  // namespace privet
-}  // namespace weave
+}  // namespace buffet
diff --git a/libweave/src/privet/shill_client.h b/buffet/shill_client.h
similarity index 91%
rename from libweave/src/privet/shill_client.h
rename to buffet/shill_client.h
index 7d9069f..06c1be5 100644
--- a/libweave/src/privet/shill_client.h
+++ b/buffet/shill_client.h
@@ -2,8 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef LIBWEAVE_SRC_PRIVET_SHILL_CLIENT_H_
-#define LIBWEAVE_SRC_PRIVET_SHILL_CLIENT_H_
+#ifndef BUFFET_SHILL_CLIENT_H_
+#define BUFFET_SHILL_CLIENT_H_
 
 #include <map>
 #include <set>
@@ -20,10 +20,9 @@
 #include "shill/dbus-proxies.h"
 #include "weave/network.h"
 
-namespace weave {
-namespace privet {
+namespace buffet {
 
-class ShillClient final : public Network {
+class ShillClient final : public weave::Network {
  public:
   ShillClient(const scoped_refptr<dbus::Bus>& bus,
               const std::set<std::string>& device_whitelist);
@@ -38,7 +37,7 @@
                         const std::string& passphrase,
                         const base::Closure& on_success,
                         chromeos::ErrorPtr* error) override;
-  NetworkState GetConnectionState() const override;
+  weave::NetworkState GetConnectionState() const override;
 
  private:
   struct DeviceState {
@@ -48,7 +47,7 @@
     // service (for instance, in the period between configuring a WiFi service
     // with credentials, and when Connect() is called.)
     std::shared_ptr<org::chromium::flimflam::ServiceProxy> selected_service;
-    NetworkState service_state{NetworkState::kOffline};
+    weave::NetworkState service_state{weave::NetworkState::kOffline};
   };
 
   bool IsMonitoredDevice(org::chromium::flimflam::DeviceProxy* device);
@@ -104,14 +103,13 @@
 
   // State for tracking our online connectivity.
   std::map<dbus::ObjectPath, DeviceState> devices_;
-  NetworkState connectivity_state_{NetworkState::kOffline};
+  weave::NetworkState connectivity_state_{weave::NetworkState::kOffline};
 
   base::WeakPtrFactory<ShillClient> weak_factory_{this};
 
   DISALLOW_COPY_AND_ASSIGN(ShillClient);
 };
 
-}  // namespace privet
-}  // namespace weave
+}  // namespace buffet
 
-#endif  // LIBWEAVE_SRC_PRIVET_SHILL_CLIENT_H_
+#endif  // BUFFET_SHILL_CLIENT_H_
diff --git a/libweave/include/weave/device.h b/libweave/include/weave/device.h
index c730280..e7d9d7d 100644
--- a/libweave/include/weave/device.h
+++ b/libweave/include/weave/device.h
@@ -16,6 +16,7 @@
 #include "weave/commands.h"
 #include "weave/config.h"
 #include "weave/mdns.h"
+#include "weave/network.h"
 #include "weave/privet.h"
 #include "weave/state.h"
 
@@ -36,7 +37,6 @@
     base::FilePath definitions_path;
     base::FilePath test_definitions_path;
     bool xmpp_enabled = true;
-    std::set<std::string> device_whitelist;
     bool disable_privet = false;
     bool disable_security = false;
     bool enable_ping = false;
@@ -47,6 +47,7 @@
 
   virtual void Start(const Options& options,
                      Mdns* mdns,
+                     Network* network,
                      chromeos::dbus_utils::DBusObject* dbus_object,
                      chromeos::dbus_utils::AsyncEventSequencer* sequencer) = 0;
 
diff --git a/libweave/src/device_manager.cc b/libweave/src/device_manager.cc
index 8cab8c3..bc83a04 100644
--- a/libweave/src/device_manager.cc
+++ b/libweave/src/device_manager.cc
@@ -15,7 +15,6 @@
 #include "libweave/src/commands/command_manager.h"
 #include "libweave/src/device_registration_info.h"
 #include "libweave/src/privet/privet_manager.h"
-#include "libweave/src/privet/shill_client.h"
 #include "libweave/src/states/state_change_queue.h"
 #include "libweave/src/states/state_manager.h"
 
@@ -40,6 +39,7 @@
 void DeviceManager::Start(
     const Options& options,
     Mdns* mdns,
+    Network* network,
     chromeos::dbus_utils::DBusObject* dbus_object,
     chromeos::dbus_utils::AsyncEventSequencer* sequencer) {
   command_manager_ = std::make_shared<CommandManager>();
@@ -56,22 +56,19 @@
   std::unique_ptr<BuffetConfig> config{new BuffetConfig{options.state_path}};
   config->Load(options.config_path);
 
-  shill_client_.reset(
-      new privet::ShillClient(dbus_object->GetBus(), options.device_whitelist));
-
   // TODO(avakulenko): Figure out security implications of storing
   // device info state data unencrypted.
   device_info_.reset(new DeviceRegistrationInfo(
       command_manager_, state_manager_, std::move(config), transport,
       base::MessageLoop::current()->task_runner(), options.xmpp_enabled,
-      shill_client_.get()));
+      network));
   base_api_handler_.reset(new BaseApiHandler{device_info_->AsWeakPtr(),
                                              state_manager_, command_manager_});
 
   device_info_->Start();
 
   if (!options.disable_privet)
-    StartPrivet(options, mdns, dbus_object, sequencer);
+    StartPrivet(options, mdns, network, dbus_object, sequencer);
 }
 
 Commands* DeviceManager::GetCommands() {
@@ -97,12 +94,12 @@
 void DeviceManager::StartPrivet(
     const Options& options,
     Mdns* mdns,
+    Network* network,
     chromeos::dbus_utils::DBusObject* dbus_object,
     chromeos::dbus_utils::AsyncEventSequencer* sequencer) {
   privet_.reset(new privet::Manager{});
-  privet_->Start(options, dbus_object->GetBus(), shill_client_.get(),
-                 device_info_.get(), command_manager_.get(),
-                 state_manager_.get(), mdns, sequencer);
+  privet_->Start(options, dbus_object->GetBus(), network, device_info_.get(),
+                 command_manager_.get(), state_manager_.get(), mdns, sequencer);
 
   privet_->AddOnWifiSetupChangedCallback(
       base::Bind(&DeviceManager::OnWiFiBootstrapStateChanged,
diff --git a/libweave/src/device_manager.h b/libweave/src/device_manager.h
index 68b7614..2e0f00a 100644
--- a/libweave/src/device_manager.h
+++ b/libweave/src/device_manager.h
@@ -25,7 +25,6 @@
 class StateManager;
 
 namespace privet {
-class ShillClient;
 class Manager;
 }  // namespace privet
 
@@ -36,6 +35,7 @@
 
   void Start(const Options& options,
              Mdns* mdns,
+             Network* network,
              chromeos::dbus_utils::DBusObject* dbus_object,
              chromeos::dbus_utils::AsyncEventSequencer* sequencer) override;
 
@@ -48,6 +48,7 @@
  private:
   void StartPrivet(const Options& options,
                    Mdns* mdns,
+                   Network* network,
                    chromeos::dbus_utils::DBusObject* dbus_object,
                    chromeos::dbus_utils::AsyncEventSequencer* sequencer);
 
@@ -58,7 +59,6 @@
   std::shared_ptr<StateManager> state_manager_;
   std::unique_ptr<DeviceRegistrationInfo> device_info_;
   std::unique_ptr<BaseApiHandler> base_api_handler_;
-  std::unique_ptr<privet::ShillClient> shill_client_;
   std::unique_ptr<privet::Manager> privet_;
 
   base::WeakPtrFactory<DeviceManager> weak_ptr_factory_{this};
diff --git a/libweave/src/device_registration_info.cc b/libweave/src/device_registration_info.cc
index 85d77ef..1eddc21 100644
--- a/libweave/src/device_registration_info.cc
+++ b/libweave/src/device_registration_info.cc
@@ -28,9 +28,9 @@
 #include "libweave/src/commands/command_manager.h"
 #include "libweave/src/commands/schema_constants.h"
 #include "libweave/src/notification/xmpp_channel.h"
-#include "libweave/src/privet/shill_client.h"
 #include "libweave/src/states/state_manager.h"
 #include "libweave/src/utils.h"
+#include "weave/network.h"
 
 namespace weave {
 
@@ -114,14 +114,14 @@
     const std::shared_ptr<chromeos::http::Transport>& transport,
     const scoped_refptr<base::SingleThreadTaskRunner>& task_runner,
     bool notifications_enabled,
-    privet::ShillClient* shill_client)
+    weave::Network* network)
     : transport_{transport},
       task_runner_{task_runner},
       command_manager_{command_manager},
       state_manager_{state_manager},
       config_{std::move(config)},
       notifications_enabled_{notifications_enabled},
-      shill_client_{shill_client} {
+      network_{network} {
   cloud_backoff_policy_.reset(new chromeos::BackoffEntry::Policy{});
   cloud_backoff_policy_->num_errors_to_ignore = 0;
   cloud_backoff_policy_->initial_delay_ms = 1000;
@@ -374,7 +374,7 @@
 
   notification_channel_starting_ = true;
   primary_notification_channel_.reset(new XmppChannel{
-      config_->robot_account(), access_token_, task_runner_, shill_client_});
+      config_->robot_account(), access_token_, task_runner_, network_});
   primary_notification_channel_->Start(this);
 }
 
diff --git a/libweave/src/device_registration_info.h b/libweave/src/device_registration_info.h
index 27289bd..9ea8e9d 100644
--- a/libweave/src/device_registration_info.h
+++ b/libweave/src/device_registration_info.h
@@ -45,10 +45,7 @@
 namespace weave {
 
 class StateManager;
-
-namespace privet {
-class ShillClient;
-}
+class Network;
 
 extern const char kErrorDomainOAuth2[];
 extern const char kErrorDomainGCD[];
@@ -71,7 +68,7 @@
       const std::shared_ptr<chromeos::http::Transport>& transport,
       const scoped_refptr<base::SingleThreadTaskRunner>& task_runner,
       bool notifications_enabled,
-      privet::ShillClient* shill_client);
+      weave::Network* network);
 
   ~DeviceRegistrationInfo() override;
 
@@ -341,7 +338,7 @@
   NotificationChannel* current_notification_channel_{nullptr};
   bool notification_channel_starting_{false};
 
-  privet::ShillClient* shill_client_{nullptr};
+  weave::Network* network_{nullptr};
 
   // Tracks our current registration status.
   RegistrationStatus registration_status_{RegistrationStatus::kUnconfigured};
diff --git a/libweave/src/notification/xmpp_channel.cc b/libweave/src/notification/xmpp_channel.cc
index 77debd8..76abb7e 100644
--- a/libweave/src/notification/xmpp_channel.cc
+++ b/libweave/src/notification/xmpp_channel.cc
@@ -15,7 +15,6 @@
 #include "libweave/src/notification/notification_delegate.h"
 #include "libweave/src/notification/notification_parser.h"
 #include "libweave/src/notification/xml_node.h"
-#include "libweave/src/privet/shill_client.h"
 #include "libweave/src/utils.h"
 #include "weave/network.h"
 
diff --git a/libweave/src/notification/xmpp_channel.h b/libweave/src/notification/xmpp_channel.h
index 57f86ab..66f7c78 100644
--- a/libweave/src/notification/xmpp_channel.h
+++ b/libweave/src/notification/xmpp_channel.h
@@ -25,10 +25,6 @@
 
 class Network;
 
-namespace privet {
-class ShillClient;
-}
-
 // Simple interface to abstract XmppChannel's SendMessage() method.
 class XmppChannelInterface {
  public:
diff --git a/libweave/src/privet/wifi_bootstrap_manager.cc b/libweave/src/privet/wifi_bootstrap_manager.cc
index 4eeaa94..841e903 100644
--- a/libweave/src/privet/wifi_bootstrap_manager.cc
+++ b/libweave/src/privet/wifi_bootstrap_manager.cc
@@ -284,10 +284,9 @@
       return;
   }
   chromeos::ErrorPtr error;
-  chromeos::Error::AddToPrintf(&error, FROM_HERE, errors::kDomain,
-                               errors::kInvalidState,
-                               "Unknown state returned from ShillClient: %s",
-                               EnumToString(service_state).c_str());
+  chromeos::Error::AddToPrintf(
+      &error, FROM_HERE, errors::kDomain, errors::kInvalidState,
+      "Unknown network state: %s", EnumToString(service_state).c_str());
   connection_state_ = ConnectionState{std::move(error)};
 }