Deprecate DISALLOW_COPY_AND_ASSIGN.

Chromium has decided to follow Google C++ styleguide (crbug/1010217)
when it comes to deleting implicit copy constructors and assign
operators, and will deprecate DISALLOW_COPY_AND_ASSIGN in favor of
manually deleted constructor in public.

This CL changes DISALLOW_COPY_AND_ASSIGN to deleted constructor, and
tries to move it to the right place.

This script tries to locate the constructor, and move deleted
constructor nearby (and optimistically assumes it is public). If not
found, it tries to move the lines below `public:`.

camera is excluded since it has external style code and will be handled
manually later.

Script used is at Idfe5d64ffb1fdbf53f00cf76ff63cd1e66ba934b

BUG=chromium:1144735
TEST=CQ

Exempt-From-Owner-Approval: Mechanical change involving a lot of owners.
Change-Id: I91c772eb49db979c0cd0773d090c3e4527874cc1
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform2/+/2526882
Tested-by: Qijiang Fan <fqj@google.com>
Commit-Queue: Qijiang Fan <fqj@google.com>
Reviewed-by: Hidehiko Abe <hidehiko@chromium.org>
Reviewed-by: Miriam Zimmerman <mutexlox@chromium.org>
diff --git a/patchpanel/adb_proxy.h b/patchpanel/adb_proxy.h
index 661c43e..7765b5e 100644
--- a/patchpanel/adb_proxy.h
+++ b/patchpanel/adb_proxy.h
@@ -31,6 +31,9 @@
 class AdbProxy : public brillo::Daemon {
  public:
   explicit AdbProxy(base::ScopedFD control_fd);
+  AdbProxy(const AdbProxy&) = delete;
+  AdbProxy& operator=(const AdbProxy&) = delete;
+
   virtual ~AdbProxy();
 
  protected:
@@ -55,7 +58,6 @@
   uint32_t arcvm_vsock_cid_;
 
   base::WeakPtrFactory<AdbProxy> weak_factory_{this};
-  DISALLOW_COPY_AND_ASSIGN(AdbProxy);
 };
 
 }  // namespace patchpanel
diff --git a/patchpanel/address_manager.h b/patchpanel/address_manager.h
index 6b5c7c8..03be35e 100644
--- a/patchpanel/address_manager.h
+++ b/patchpanel/address_manager.h
@@ -38,6 +38,9 @@
   };
 
   AddressManager();
+  AddressManager(const AddressManager&) = delete;
+  AddressManager& operator=(const AddressManager&) = delete;
+
   virtual ~AddressManager() = default;
 
   // Generates a MAC address guaranteed to be unique for the lifetime of this
@@ -60,8 +63,6 @@
   std::map<Guest, std::unique_ptr<SubnetPool>> pools_;
 
   base::WeakPtrFactory<AddressManager> weak_ptr_factory_{this};
-
-  DISALLOW_COPY_AND_ASSIGN(AddressManager);
 };
 
 }  // namespace patchpanel
diff --git a/patchpanel/arc_service.h b/patchpanel/arc_service.h
index 2001fec..0e81a76 100644
--- a/patchpanel/arc_service.h
+++ b/patchpanel/arc_service.h
@@ -39,6 +39,9 @@
              AddressManager* addr_mgr,
              TrafficForwarder* forwarder,
              GuestMessage::GuestType guest);
+  ArcService(const ArcService&) = delete;
+  ArcService& operator=(const ArcService&) = delete;
+
   ~ArcService();
 
   bool Start(uint32_t id);
@@ -105,7 +108,6 @@
   FRIEND_TEST(ArcServiceTest, NotStarted_AddRemoveDevice);
 
   base::WeakPtrFactory<ArcService> weak_factory_{this};
-  DISALLOW_COPY_AND_ASSIGN(ArcService);
 };
 
 }  // namespace patchpanel
diff --git a/patchpanel/broadcast_forwarder.h b/patchpanel/broadcast_forwarder.h
index a4df2f2..7ec27df 100644
--- a/patchpanel/broadcast_forwarder.h
+++ b/patchpanel/broadcast_forwarder.h
@@ -30,6 +30,9 @@
 class BroadcastForwarder {
  public:
   explicit BroadcastForwarder(const std::string& dev_ifname);
+  BroadcastForwarder(const BroadcastForwarder&) = delete;
+  BroadcastForwarder& operator=(const BroadcastForwarder&) = delete;
+
   virtual ~BroadcastForwarder() = default;
 
   bool AddGuest(const std::string& br_ifname);
@@ -91,7 +94,6 @@
   void OnFileCanReadWithoutBlocking(int fd);
 
   base::WeakPtrFactory<BroadcastForwarder> weak_factory_{this};
-  DISALLOW_COPY_AND_ASSIGN(BroadcastForwarder);
 };
 
 }  // namespace patchpanel
diff --git a/patchpanel/crostini_service.h b/patchpanel/crostini_service.h
index 17862c1..ce4cb08 100644
--- a/patchpanel/crostini_service.h
+++ b/patchpanel/crostini_service.h
@@ -29,6 +29,9 @@
                   AddressManager* addr_mgr,
                   Datapath* datapath,
                   TrafficForwarder* forwarder);
+  CrostiniService(const CrostiniService&) = delete;
+  CrostiniService& operator=(const CrostiniService&) = delete;
+
   ~CrostiniService();
 
   bool Start(uint64_t vm_id, bool is_termina, int subnet_index);
@@ -69,7 +72,6 @@
   scoped_refptr<dbus::Bus> bus_;
 
   base::WeakPtrFactory<CrostiniService> weak_factory_{this};
-  DISALLOW_COPY_AND_ASSIGN(CrostiniService);
 };
 
 }  // namespace patchpanel
diff --git a/patchpanel/datapath.h b/patchpanel/datapath.h
index 5520fb2..cf41f2e 100644
--- a/patchpanel/datapath.h
+++ b/patchpanel/datapath.h
@@ -52,6 +52,9 @@
   Datapath(MinijailedProcessRunner* process_runner,
            Firewall* firewall,
            ioctl_t ioctl_hook);
+  Datapath(const Datapath&) = delete;
+  Datapath& operator=(const Datapath&) = delete;
+
   virtual ~Datapath() = default;
 
   // Start and stop the Datapath, creating or destroying the initial iptables
@@ -313,8 +316,6 @@
   // TODO(b/161507671) Rely on RoutingService to obtain this information once
   // shill/routing_table.cc has been migrated to patchpanel.
   std::map<std::string, int> if_nametoindex_;
-
-  DISALLOW_COPY_AND_ASSIGN(Datapath);
 };
 
 }  // namespace patchpanel
diff --git a/patchpanel/datapath_fuzzer.cc b/patchpanel/datapath_fuzzer.cc
index d72c3f3..4a41bd3 100644
--- a/patchpanel/datapath_fuzzer.cc
+++ b/patchpanel/datapath_fuzzer.cc
@@ -30,6 +30,8 @@
  public:
   explicit RandomProcessRunner(FuzzedDataProvider* data_provider)
       : data_provider_{data_provider} {}
+  RandomProcessRunner(const RandomProcessRunner&) = delete;
+  RandomProcessRunner& operator=(const RandomProcessRunner&) = delete;
   ~RandomProcessRunner() = default;
 
   int Run(const std::vector<std::string>& argv, bool log_failures) override {
@@ -38,8 +40,6 @@
 
  private:
   FuzzedDataProvider* data_provider_;
-
-  DISALLOW_COPY_AND_ASSIGN(RandomProcessRunner);
 };
 
 namespace {
diff --git a/patchpanel/dbus/client.cc b/patchpanel/dbus/client.cc
index e3f5eed..53fda20 100644
--- a/patchpanel/dbus/client.cc
+++ b/patchpanel/dbus/client.cc
@@ -89,6 +89,9 @@
  public:
   ClientImpl(const scoped_refptr<dbus::Bus>& bus, dbus::ObjectProxy* proxy)
       : bus_(std::move(bus)), proxy_(proxy) {}
+  ClientImpl(const ClientImpl&) = delete;
+  ClientImpl& operator=(const ClientImpl&) = delete;
+
   ~ClientImpl();
 
   bool NotifyArcStartup(pid_t pid) override;
@@ -139,8 +142,6 @@
 
   bool SendSetVpnIntentRequest(int socket,
                                SetVpnIntentRequest::VpnRoutingPolicy policy);
-
-  DISALLOW_COPY_AND_ASSIGN(ClientImpl);
 };
 
 ClientImpl::~ClientImpl() {
diff --git a/patchpanel/device.h b/patchpanel/device.h
index d3876e7..fd63668 100644
--- a/patchpanel/device.h
+++ b/patchpanel/device.h
@@ -38,6 +38,9 @@
            std::unique_ptr<SubnetAddress> host_ipv4_addr,
            std::unique_ptr<SubnetAddress> guest_ipv4_addr,
            std::unique_ptr<Subnet> lxd_ipv4_subnet = nullptr);
+    Config(const Config&) = delete;
+    Config& operator=(const Config&) = delete;
+
     ~Config() = default;
 
     MacAddress mac_addr() const { return mac_addr_; }
@@ -80,7 +83,6 @@
     // TAP devices currently associated with the configuration.
     std::string tap_;
 
-    DISALLOW_COPY_AND_ASSIGN(Config);
   };
 
   struct Options {
@@ -99,6 +101,9 @@
          const std::string& guest_ifname,
          std::unique_ptr<Config> config,
          const Options& options);
+  Device(const Device&) = delete;
+  Device& operator=(const Device&) = delete;
+
   ~Device() = default;
 
   const std::string& phys_ifname() const { return phys_ifname_; }
@@ -120,7 +125,6 @@
   FRIEND_TEST(DeviceTest, DisableLegacyAndroidDeviceSendsTwoMessages);
 
   base::WeakPtrFactory<Device> weak_factory_{this};
-  DISALLOW_COPY_AND_ASSIGN(Device);
 };
 
 }  // namespace patchpanel
diff --git a/patchpanel/fake_process_runner.h b/patchpanel/fake_process_runner.h
index 5767812..31d973f 100644
--- a/patchpanel/fake_process_runner.h
+++ b/patchpanel/fake_process_runner.h
@@ -21,6 +21,9 @@
  public:
   explicit FakeProcessRunner(std::vector<std::string>* runs = nullptr)
       : runs_(runs ? runs : &runs_vec_) {}
+  FakeProcessRunner(const FakeProcessRunner&) = delete;
+  FakeProcessRunner& operator=(const FakeProcessRunner&) = delete;
+
   ~FakeProcessRunner() = default;
 
   int Run(const std::vector<std::string>& argv, bool log_failures) override {
@@ -79,8 +82,6 @@
   uint32_t add_con_prefix_len_;
   bool add_enable_multicast_;
   std::string add_con_pid_;
-
-  DISALLOW_COPY_AND_ASSIGN(FakeProcessRunner);
 };
 
 }  // namespace patchpanel
diff --git a/patchpanel/firewall.h b/patchpanel/firewall.h
index 0b8365a..6695d6e 100644
--- a/patchpanel/firewall.h
+++ b/patchpanel/firewall.h
@@ -33,6 +33,9 @@
   typedef std::pair<uint16_t, std::string> Hole;
 
   Firewall() = default;
+  Firewall(const Firewall&) = delete;
+  Firewall& operator=(const Firewall&) = delete;
+
   ~Firewall() = default;
 
   bool AddAcceptRules(Protocol protocol,
@@ -90,8 +93,6 @@
                                           uint16_t port);
 
   virtual int RunInMinijail(const std::vector<std::string>& argv);
-
-  DISALLOW_COPY_AND_ASSIGN(Firewall);
 };
 
 }  // namespace patchpanel
diff --git a/patchpanel/firewall_fuzzer.cc b/patchpanel/firewall_fuzzer.cc
index d2833d5..56e8871 100644
--- a/patchpanel/firewall_fuzzer.cc
+++ b/patchpanel/firewall_fuzzer.cc
@@ -20,13 +20,14 @@
 class FakeFirewall : public Firewall {
  public:
   FakeFirewall() = default;
+  FakeFirewall(const FakeFirewall&) = delete;
+  FakeFirewall& operator=(const FakeFirewall&) = delete;
+
   ~FakeFirewall() = default;
 
  private:
   // The fake's implementation always succeeds.
   int RunInMinijail(const std::vector<std::string>& argv) override { return 0; }
-
-  DISALLOW_COPY_AND_ASSIGN(FakeFirewall);
 };
 
 }  // namespace patchpanel
diff --git a/patchpanel/firewall_test.cc b/patchpanel/firewall_test.cc
index a1e48c3..0eb5879 100644
--- a/patchpanel/firewall_test.cc
+++ b/patchpanel/firewall_test.cc
@@ -19,6 +19,9 @@
 class FirewallTest : public testing::Test {
  public:
   FirewallTest() = default;
+  FirewallTest(const FirewallTest&) = delete;
+  FirewallTest& operator=(const FirewallTest&) = delete;
+
   ~FirewallTest() override = default;
 
  protected:
@@ -39,9 +42,6 @@
       firewall->SetRunInMinijailFailCriterion(
           std::vector<std::string>({kIp6TablesPath}), true, false);
   }
-
- private:
-  DISALLOW_COPY_AND_ASSIGN(FirewallTest);
 };
 
 TEST_F(FirewallTest, Port0Fails) {
diff --git a/patchpanel/helper_process.h b/patchpanel/helper_process.h
index 1df6f4a..14101cc 100644
--- a/patchpanel/helper_process.h
+++ b/patchpanel/helper_process.h
@@ -25,6 +25,9 @@
 class HelperProcess {
  public:
   HelperProcess() = default;
+  HelperProcess(const HelperProcess&) = delete;
+  HelperProcess& operator=(const HelperProcess&) = delete;
+
   virtual ~HelperProcess() = default;
 
   // Re-execs patchpanel with a new argument: "|fd_arg|=N", where N is the
@@ -58,8 +61,6 @@
   std::vector<std::string> argv_;
   std::string fd_arg_;
   std::unique_ptr<MessageDispatcher> msg_dispatcher_;
-
-  DISALLOW_COPY_AND_ASSIGN(HelperProcess);
 };
 
 }  // namespace patchpanel
diff --git a/patchpanel/mac_address_generator.h b/patchpanel/mac_address_generator.h
index 7e6db39..2ac364f 100644
--- a/patchpanel/mac_address_generator.h
+++ b/patchpanel/mac_address_generator.h
@@ -23,6 +23,9 @@
 class BRILLO_EXPORT MacAddressGenerator {
  public:
   MacAddressGenerator() = default;
+  MacAddressGenerator(const MacAddressGenerator&) = delete;
+  MacAddressGenerator& operator=(const MacAddressGenerator&) = delete;
+
   ~MacAddressGenerator() = default;
 
   // Generates a new EUI-48 MAC address and ensures that there are no
@@ -57,8 +60,6 @@
   // "Duplicates" unit test by ~33% (~150 seconds -> ~100 seconds) and it
   // doesn't have a huge impact in production use so that's why we use it here.
   std::unordered_set<MacAddress, MacAddressHasher> addrs_;
-
-  DISALLOW_COPY_AND_ASSIGN(MacAddressGenerator);
 };
 
 }  // namespace patchpanel
diff --git a/patchpanel/manager.h b/patchpanel/manager.h
index c28238c..6fd5e76 100644
--- a/patchpanel/manager.h
+++ b/patchpanel/manager.h
@@ -57,6 +57,9 @@
   Manager(std::unique_ptr<HelperProcess> adb_proxy,
           std::unique_ptr<HelperProcess> mcast_proxy,
           std::unique_ptr<HelperProcess> nd_proxy);
+  Manager(const Manager&) = delete;
+  Manager& operator=(const Manager&) = delete;
+
   ~Manager();
 
   // TrafficForwarder methods.
@@ -218,7 +221,6 @@
   int connected_namespaces_epollfd_;
 
   base::WeakPtrFactory<Manager> weak_factory_{this};
-  DISALLOW_COPY_AND_ASSIGN(Manager);
 };
 
 std::ostream& operator<<(std::ostream& stream,
diff --git a/patchpanel/message_dispatcher.h b/patchpanel/message_dispatcher.h
index c3e29f7..126906f 100644
--- a/patchpanel/message_dispatcher.h
+++ b/patchpanel/message_dispatcher.h
@@ -21,6 +21,8 @@
 class MessageDispatcher {
  public:
   explicit MessageDispatcher(base::ScopedFD fd, bool start = true);
+  MessageDispatcher(const MessageDispatcher&) = delete;
+  MessageDispatcher& operator=(const MessageDispatcher&) = delete;
 
   void Start();
 
@@ -51,7 +53,6 @@
   IpHelperMessage msg_;
 
   base::WeakPtrFactory<MessageDispatcher> weak_factory_{this};
-  DISALLOW_COPY_AND_ASSIGN(MessageDispatcher);
 };
 
 }  // namespace patchpanel
diff --git a/patchpanel/minijailed_process_runner.h b/patchpanel/minijailed_process_runner.h
index 1fe21d8..97a64ba 100644
--- a/patchpanel/minijailed_process_runner.h
+++ b/patchpanel/minijailed_process_runner.h
@@ -36,6 +36,9 @@
   // Provided for testing only.
   MinijailedProcessRunner(brillo::Minijail* mj,
                           std::unique_ptr<SyscallImpl> syscall);
+  MinijailedProcessRunner(const MinijailedProcessRunner&) = delete;
+  MinijailedProcessRunner& operator=(const MinijailedProcessRunner&) = delete;
+
   virtual ~MinijailedProcessRunner() = default;
 
   // Runs brctl.
@@ -111,8 +114,6 @@
   brillo::Minijail* mj_;
 
   std::unique_ptr<SyscallImpl> syscall_;
-
-  DISALLOW_COPY_AND_ASSIGN(MinijailedProcessRunner);
 };
 
 }  // namespace patchpanel
diff --git a/patchpanel/mock_datapath.h b/patchpanel/mock_datapath.h
index ad1171c..d78d791 100644
--- a/patchpanel/mock_datapath.h
+++ b/patchpanel/mock_datapath.h
@@ -20,6 +20,9 @@
  public:
   explicit MockDatapath(MinijailedProcessRunner* runner, Firewall* firewall)
       : Datapath(runner, firewall) {}
+  MockDatapath(const MockDatapath&) = delete;
+  MockDatapath& operator=(const MockDatapath&) = delete;
+
   ~MockDatapath() = default;
 
   MOCK_METHOD0(Start, void());
@@ -68,9 +71,6 @@
   MOCK_METHOD2(RemoveIPv6Forwarding,
                void(const std::string& ifname1, const std::string& ifname2));
   MOCK_METHOD3(AddIPv4Route, bool(uint32_t gw, uint32_t dst, uint32_t netmask));
-
- private:
-  DISALLOW_COPY_AND_ASSIGN(MockDatapath);
 };
 
 }  // namespace patchpanel
diff --git a/patchpanel/mock_firewall.h b/patchpanel/mock_firewall.h
index 1722fda..c935cf7 100644
--- a/patchpanel/mock_firewall.h
+++ b/patchpanel/mock_firewall.h
@@ -18,6 +18,9 @@
 class MockFirewall : public Firewall {
  public:
   MockFirewall() = default;
+  MockFirewall(const MockFirewall&) = delete;
+  MockFirewall& operator=(const MockFirewall&) = delete;
+
   ~MockFirewall() = default;
 
   int SetRunInMinijailFailCriterion(const std::vector<std::string>& keywords,
@@ -69,8 +72,6 @@
   // Given an ip/iptables command, return the command that undoes its effect.
   std::vector<std::string> GetInverseCommand(
       const std::vector<std::string>& command);
-
-  DISALLOW_COPY_AND_ASSIGN(MockFirewall);
 };
 
 }  // namespace patchpanel
diff --git a/patchpanel/multicast_forwarder.h b/patchpanel/multicast_forwarder.h
index 961cfbf..9142a2e 100644
--- a/patchpanel/multicast_forwarder.h
+++ b/patchpanel/multicast_forwarder.h
@@ -39,6 +39,9 @@
                      uint32_t mcast_addr,
                      const std::string& mcast_addr6,
                      uint16_t port);
+  MulticastForwarder(const MulticastForwarder&) = delete;
+  MulticastForwarder& operator=(const MulticastForwarder&) = delete;
+
   virtual ~MulticastForwarder() = default;
 
   // Start forwarding multicast packets between the guest's interface
@@ -109,8 +112,6 @@
 
  private:
   void OnFileCanReadWithoutBlocking(int fd, sa_family_t sa_family);
-
-  DISALLOW_COPY_AND_ASSIGN(MulticastForwarder);
 };
 
 }  // namespace patchpanel
diff --git a/patchpanel/multicast_proxy.h b/patchpanel/multicast_proxy.h
index ef7a294..89ad53d 100644
--- a/patchpanel/multicast_proxy.h
+++ b/patchpanel/multicast_proxy.h
@@ -22,6 +22,9 @@
 class MulticastProxy : public brillo::Daemon {
  public:
   explicit MulticastProxy(base::ScopedFD control_fd);
+  MulticastProxy(const MulticastProxy&) = delete;
+  MulticastProxy& operator=(const MulticastProxy&) = delete;
+
   virtual ~MulticastProxy() = default;
 
  protected:
@@ -39,7 +42,6 @@
   std::map<std::string, std::unique_ptr<BroadcastForwarder>> bcast_fwds_;
 
   base::WeakPtrFactory<MulticastProxy> weak_factory_{this};
-  DISALLOW_COPY_AND_ASSIGN(MulticastProxy);
 };
 
 }  // namespace patchpanel
diff --git a/patchpanel/ndproxy.h b/patchpanel/ndproxy.h
index 3857169..a2d608b 100644
--- a/patchpanel/ndproxy.h
+++ b/patchpanel/ndproxy.h
@@ -41,6 +41,9 @@
   static constexpr ssize_t kTranslateErrorBufferMisaligned = -4;
 
   NDProxy();
+  NDProxy(const NDProxy&) = delete;
+  NDProxy& operator=(const NDProxy&) = delete;
+
   virtual ~NDProxy() = default;
 
   ssize_t TranslateNDFrame(const uint8_t* in_frame,
@@ -150,7 +153,6 @@
   base::WeakPtrFactory<NDProxy> weak_factory_{this};
 
   FRIEND_TEST(NDProxyTest, TranslateFrame);
-  DISALLOW_COPY_AND_ASSIGN(NDProxy);
 };
 
 // A wrapper class for running NDProxy in a daemon process. Control messages and
@@ -158,6 +160,9 @@
 class NDProxyDaemon : public brillo::Daemon {
  public:
   explicit NDProxyDaemon(base::ScopedFD control_fd);
+  NDProxyDaemon(const NDProxyDaemon&) = delete;
+  NDProxyDaemon& operator=(const NDProxyDaemon&) = delete;
+
   virtual ~NDProxyDaemon();
 
  private:
@@ -193,8 +198,6 @@
   NDProxy proxy_;
 
   base::WeakPtrFactory<NDProxyDaemon> weak_factory_{this};
-
-  DISALLOW_COPY_AND_ASSIGN(NDProxyDaemon);
 };
 
 }  // namespace patchpanel
diff --git a/patchpanel/scoped_ns.h b/patchpanel/scoped_ns.h
index f790695..a8f90eb 100644
--- a/patchpanel/scoped_ns.h
+++ b/patchpanel/scoped_ns.h
@@ -14,6 +14,9 @@
 class ScopedNS {
  public:
   explicit ScopedNS(pid_t pid);
+  ScopedNS(const ScopedNS&) = delete;
+  ScopedNS& operator=(const ScopedNS&) = delete;
+
   ~ScopedNS();
 
   // Returns whether or not the object was able to enter the network namespace.
@@ -23,8 +26,6 @@
   bool valid_;
   base::ScopedFD ns_fd_;
   base::ScopedFD self_fd_;
-
-  DISALLOW_COPY_AND_ASSIGN(ScopedNS);
 };
 
 }  // namespace patchpanel
diff --git a/patchpanel/shill_client.h b/patchpanel/shill_client.h
index 3809f7e..edebd7a 100644
--- a/patchpanel/shill_client.h
+++ b/patchpanel/shill_client.h
@@ -80,6 +80,9 @@
       base::Callback<void(const std::string& device, const IPConfig& ipconfig)>;
 
   explicit ShillClient(const scoped_refptr<dbus::Bus>& bus);
+  ShillClient(const ShillClient&) = delete;
+  ShillClient& operator=(const ShillClient&) = delete;
+
   virtual ~ShillClient() = default;
 
   void RegisterDefaultInterfaceChangedHandler(
@@ -159,8 +162,6 @@
   std::unique_ptr<org::chromium::flimflam::ManagerProxy> manager_proxy_;
 
   base::WeakPtrFactory<ShillClient> weak_factory_{this};
-
-  DISALLOW_COPY_AND_ASSIGN(ShillClient);
 };
 
 }  // namespace patchpanel
diff --git a/patchpanel/socket.h b/patchpanel/socket.h
index c4d3cc3..2fd69c3 100644
--- a/patchpanel/socket.h
+++ b/patchpanel/socket.h
@@ -23,6 +23,9 @@
  public:
   Socket(int family, int type);
   explicit Socket(base::ScopedFD fd);
+  Socket(const Socket&) = delete;
+  Socket& operator=(const Socket&) = delete;
+
   virtual ~Socket() = default;
 
   bool Bind(const struct sockaddr* addr, socklen_t addrlen);
@@ -47,8 +50,6 @@
 
  private:
   base::ScopedFD fd_;
-
-  DISALLOW_COPY_AND_ASSIGN(Socket);
 };
 
 BRILLO_EXPORT std::ostream& operator<<(std::ostream& stream,
diff --git a/patchpanel/socket_forwarder.h b/patchpanel/socket_forwarder.h
index 95cc48f..8c6b491 100644
--- a/patchpanel/socket_forwarder.h
+++ b/patchpanel/socket_forwarder.h
@@ -28,6 +28,9 @@
   SocketForwarder(const std::string& name,
                   std::unique_ptr<Socket> sock0,
                   std::unique_ptr<Socket> sock1);
+  SocketForwarder(const SocketForwarder&) = delete;
+  SocketForwarder& operator=(const SocketForwarder&) = delete;
+
   virtual ~SocketForwarder();
 
   // Runs the forwarder. The sockets are closed and released on exit,
@@ -68,8 +71,6 @@
   std::atomic<bool> done_;
 
   base::OnceClosure stop_quit_closure_for_testing_;
-
-  DISALLOW_COPY_AND_ASSIGN(SocketForwarder);
 };
 
 }  // namespace patchpanel
diff --git a/patchpanel/subnet.h b/patchpanel/subnet.h
index f8988b9..733e2da 100644
--- a/patchpanel/subnet.h
+++ b/patchpanel/subnet.h
@@ -29,6 +29,9 @@
   SubnetAddress(uint32_t addr,
                 uint32_t prefix_length,
                 base::Closure release_cb);
+  SubnetAddress(const SubnetAddress&) = delete;
+  SubnetAddress& operator=(const SubnetAddress&) = delete;
+
   ~SubnetAddress();
 
   // Returns this address in network-byte order.
@@ -53,8 +56,6 @@
 
   // Callback to run when this object is destroyed.
   base::Closure release_cb_;
-
-  DISALLOW_COPY_AND_ASSIGN(SubnetAddress);
 };
 
 // Represents an allocated IPv4 subnet.
@@ -65,6 +66,9 @@
   // destructor of this class and can be used to free other resources associated
   // with the subnet.
   Subnet(uint32_t base_addr, uint32_t prefix_length, base::Closure release_cb);
+  Subnet(const Subnet&) = delete;
+  Subnet& operator=(const Subnet&) = delete;
+
   ~Subnet();
 
   // Marks |addr| as allocated. |addr| must be in network-byte order. Returns
@@ -120,8 +124,6 @@
   base::Closure release_cb_;
 
   base::WeakPtrFactory<Subnet> weak_factory_;
-
-  DISALLOW_COPY_AND_ASSIGN(Subnet);
 };
 
 }  // namespace patchpanel
diff --git a/patchpanel/subnet_pool.h b/patchpanel/subnet_pool.h
index 800a984..a3441d0 100644
--- a/patchpanel/subnet_pool.h
+++ b/patchpanel/subnet_pool.h
@@ -39,6 +39,8 @@
 
  private:
   SubnetPool(uint32_t base_addr, uint32_t prefix_length, uint32_t num_subnets);
+  SubnetPool(const SubnetPool&) = delete;
+  SubnetPool& operator=(const SubnetPool&) = delete;
 
   // Called by Subnets on destruction to free a given subnet.
   void Release(uint32_t index);
@@ -50,7 +52,6 @@
   std::bitset<kMaxSubnets + 1> subnets_;
 
   base::WeakPtrFactory<SubnetPool> weak_ptr_factory_{this};
-  DISALLOW_COPY_AND_ASSIGN(SubnetPool);
 };
 
 }  // namespace patchpanel