Remove network_client after switch back to using Shill.

Now that weaved is back to using shill_client, remove the replacement
network_client interface and its implementations.

Change-Id: I1d2b83b6d54d1d3d89fce98e01ecf30bf420b999
diff --git a/buffet/brillo_network_client.cc b/buffet/brillo_network_client.cc
deleted file mode 100644
index 6f4a4dd..0000000
--- a/buffet/brillo_network_client.cc
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
- * Copyright (C) 2015 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "buffet/brillo_network_client.h"
-
-#include <base/message_loop/message_loop.h>
-
-using weave::provider::Network;
-
-namespace buffet {
-
-namespace {
-const char kErrorDomain[] = "brillo_network";
-const int kConnectionTimeoutSeconds = 30;
-const int kConnectionActivePollSeconds = 3;
-const int kConnectionInactivePollSeconds = 10;
-}  // namespace
-
-BrilloNetworkClient::BrilloNetworkClient(
-    const std::set<std::string>& device_whitelist)
-    : NetworkClient{device_whitelist} {
-  UpdateConnectionState();
-}
-
-BrilloNetworkClient::~BrilloNetworkClient() {
-}
-
-void BrilloNetworkClient::AddConnectionChangedCallback(
-    const ConnectionChangedCallback& listener) {
-  connection_listeners_.push_back(listener);
-}
-
-void BrilloNetworkClient::Connect(const std::string& ssid,
-                                  const std::string& passphrase,
-                                  const weave::SuccessCallback& on_success,
-                                  const weave::ErrorCallback& on_error) {
-  if (!connectivity_client_.ConnectToAccessPoint(ssid, passphrase)) {
-    weave::ErrorPtr error;
-    weave::Error::AddTo(&error, FROM_HERE, kErrorDomain, "network_failure",
-                        "Failed to connect to service");
-    base::MessageLoop::current()->PostDelayedTask(
-        FROM_HERE, base::Bind(on_error, base::Owned(error.release())), {});
-    return;
-  }
-
-  connection_success_closure_ = on_success;
-  connectivity_state_ = State::kConnecting;
-
-  connection_timeout_closure_.Reset(
-      base::Bind(&BrilloNetworkClient::OnConnectionTimeout,
-                 base::Unretained(this)));
-  base::MessageLoop::current()->PostDelayedTask(
-      FROM_HERE,
-      connection_timeout_closure_.callback(),
-      base::TimeDelta::FromSeconds(kConnectionTimeoutSeconds));
-
-  ScheduleNextStatePoll();
-}
-
-Network::State BrilloNetworkClient::GetConnectionState() const {
-  return connectivity_state_;
-}
-
-void BrilloNetworkClient::StartAccessPoint(const std::string& ssid) {
-  connectivity_client_.EnableAccessPoint(ssid);
-  connectivity_state_ = State::kOffline;
-}
-
-void BrilloNetworkClient::StopAccessPoint() {
-  connectivity_client_.DisableAccessPoint();
-}
-
-void BrilloNetworkClient::OnConnectionTimeout() {
-  connectivity_state_ = State::kFailure;
-}
-
-void BrilloNetworkClient::ScheduleNextStatePoll() {
-  periodic_connection_state_closure_.Reset(
-      base::Bind(&BrilloNetworkClient::UpdateConnectionState,
-                 base::Unretained(this)));
-  int poll_period_seconds;
-  if (connectivity_state_ == State::kConnecting) {
-    poll_period_seconds = kConnectionActivePollSeconds;
-  } else {
-    poll_period_seconds = kConnectionInactivePollSeconds;
-  }
-  base::MessageLoop::current()->PostDelayedTask(
-      FROM_HERE,
-      periodic_connection_state_closure_.callback(),
-      base::TimeDelta::FromSeconds(poll_period_seconds));
-}
-
-void BrilloNetworkClient::UpdateConnectionState() {
-  bool was_connected = connectivity_state_ == State::kConnected;
-  bool is_connected = connectivity_client_.IsConnected();
-
-  if (is_connected) {
-    if (connectivity_state_ == State::kConnecting)
-      connection_success_closure_.Run();
-    connectivity_state_ = State::kConnected;
-  } else if (connectivity_state_ == State::kConnected) {
-    connectivity_state_ = State::kOffline;
-  }
-  if (is_connected != was_connected) {
-    for (const auto& listener : connection_listeners_) {
-      listener.Run();
-    }
-  }
-  ScheduleNextStatePoll();
-}
-
-std::unique_ptr<NetworkClient> NetworkClient::CreateInstance(
-    const std::set<std::string>& device_whitelist) {
-  return std::unique_ptr<NetworkClient>{
-      new BrilloNetworkClient{device_whitelist}};
-}
-
-}  // namespace buffet
diff --git a/buffet/brillo_network_client.h b/buffet/brillo_network_client.h
deleted file mode 100644
index f127a7e..0000000
--- a/buffet/brillo_network_client.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Copyright 2015 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef BUFFET_BRILLO_NETWORK_CLIENT_H_
-#define BUFFET_BRILLO_NETWORK_CLIENT_H_
-
-#include <memory>
-#include <vector>
-
-#include <base/cancelable_callback.h>
-
-#include "connectivity_client.h"
-
-#include "buffet/network_client.h"
-
-namespace buffet {
-
-class BrilloNetworkClient : public NetworkClient {
- public:
-  explicit BrilloNetworkClient(const std::set<std::string>& device_whitelist);
-  ~BrilloNetworkClient() override;
-
-  // Implements the Network interface.
-  void AddConnectionChangedCallback(
-      const ConnectionChangedCallback& listener) override;
-  void Connect(
-      const std::string& ssid,
-      const std::string& passphrase,
-      const weave::SuccessCallback& on_success,
-      const base::Callback<void(const weave::Error*)>& on_error) override;
-  State GetConnectionState() const override;
-  void StartAccessPoint(const std::string& ssid) override;
-  void StopAccessPoint() override;
-
- private:
-  enum class ConnectionState {
-    kIdle,
-    kInProgress,
-    kConnected,
-    kTimedOut
-  };
-  void OnConnectionTimeout();
-  void ScheduleNextStatePoll();
-  void UpdateConnectionState();
-
-  ConnectivityClient connectivity_client_;
-  std::vector<ConnectionChangedCallback> connection_listeners_;
-  base::CancelableClosure connection_timeout_closure_;
-  base::CancelableClosure periodic_connection_state_closure_;
-  base::Closure connection_success_closure_;
-  State connectivity_state_{State::kOffline};
-  bool is_connected_;
-
-  DISALLOW_COPY_AND_ASSIGN(BrilloNetworkClient);
-};
-
-}  // namespace buffet
-
-#endif  // BUFFET_BRILLO_NETWORK_CLIENT_H_
-
diff --git a/buffet/network_client.h b/buffet/network_client.h
deleted file mode 100644
index 82a7476..0000000
--- a/buffet/network_client.h
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * Copyright 2015 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef BUFFET_NETWORK_CLIENT_H_
-#define BUFFET_NETWORK_CLIENT_H_
-
-#include <memory>
-#include <set>
-#include <string>
-
-#include <base/cancelable_callback.h>
-#include <chromeos/errors/error_codes.h>
-#include <weave/provider/network.h>
-#include <weave/provider/wifi.h>
-
-#include "buffet/socket_stream.h"
-#include "buffet/weave_error_conversion.h"
-
-namespace buffet {
-
-class NetworkClient : public weave::provider::Network,
-                      public weave::provider::Wifi {
- public:
-  explicit NetworkClient(const std::set<std::string>& device_whitelist)
-      : device_whitelist_{device_whitelist} {
-  }
-
-  ~NetworkClient() override = default;
-
-  // NetworkProvider implementation.
-  void AddConnectionChangedCallback(
-      const ConnectionChangedCallback& listener) override {}
-
-  State GetConnectionState() const override {
-    return State::kOffline;
-  }
-
-  void OpenSslSocket(
-      const std::string& host,
-      uint16_t port,
-      const base::Callback<void(std::unique_ptr<weave::Stream>)>& on_success,
-      const weave::ErrorCallback& on_error) override {
-    auto socket = SocketStream::ConnectBlocking(host, port);
-    if (socket) {
-      SocketStream::TlsConnect(std::move(socket), host, on_success, on_error);
-      return;
-    }
-    chromeos::ErrorPtr error;
-    chromeos::errors::system::AddSystemError(&error, FROM_HERE, errno);
-    weave::ErrorPtr weave_error;
-    ConvertError(*error.get(), &weave_error);
-    on_error.Run(weave_error.get());
-  }
-
-  // WifiProvider implementation.
-  void Connect(const std::string& ssid,
-               const std::string& passphrase,
-               const weave::SuccessCallback& on_success,
-               const weave::ErrorCallback& on_error) override {}
-
-  void StartAccessPoint(const std::string& ssid) override {}
-
-  void StopAccessPoint() override {}
-
-  static std::unique_ptr<NetworkClient> CreateInstance(
-      const std::set<std::string>& device_whitelist);
-
- protected:
-  std::set<std::string> device_whitelist_;
-
- private:
-  DISALLOW_COPY_AND_ASSIGN(NetworkClient);
-};
-
-}  // namespace buffet
-
-#endif  // BUFFET_NETWORK_CLIENT_H_
-
diff --git a/buffet/stub_network_client.cc b/buffet/stub_network_client.cc
deleted file mode 100644
index c0671af..0000000
--- a/buffet/stub_network_client.cc
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * Copyright (C) 2015 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "buffet/network_client.h"
-
-namespace buffet {
-
-std::unique_ptr<NetworkClient> NetworkClient::CreateInstance(
-    const std::set<std::string>& device_whitelist) {
-  return std::unique_ptr<NetworkClient>{new NetworkClient{device_whitelist}};
-}
-
-}  // namespace buffet