shill: Replace NULL with nullptr.

BUG=None
TEST=`USE=wimax FEATURES=test emerge-$BOARD shill`

Change-Id: I30ab47ff32dcadad09ae7a2baf4d4123a6ef0d8e
Reviewed-on: https://chromium-review.googlesource.com/220657
Reviewed-by: Ben Chan <benchan@chromium.org>
Tested-by: Ben Chan <benchan@chromium.org>
Commit-Queue: Ben Chan <benchan@chromium.org>
diff --git a/async_connection.cc b/async_connection.cc
index 39130ec..ed5dd3b 100644
--- a/async_connection.cc
+++ b/async_connection.cc
@@ -112,7 +112,7 @@
 }
 
 int AsyncConnection::ConnectTo(const IPAddress &address, int port) {
-  struct sockaddr *sock_addr = NULL;
+  struct sockaddr *sock_addr = nullptr;
   socklen_t addr_len = 0;
   struct sockaddr_in iaddr;
   struct sockaddr_in6 iaddr6;
diff --git a/attribute_list.cc b/attribute_list.cc
index 927e8ce..a70c795 100644
--- a/attribute_list.cc
+++ b/attribute_list.cc
@@ -320,7 +320,7 @@
   map<int, AttributePointer>::const_iterator i;
   i = attributes_.find(id);
   if (i == attributes_.end()) {
-    return NULL;
+    return nullptr;
   }
   return i->second.get();
 }
diff --git a/byte_string.cc b/byte_string.cc
index 1077ffd..3baa17e 100644
--- a/byte_string.cc
+++ b/byte_string.cc
@@ -30,11 +30,11 @@
 }
 
 unsigned char *ByteString::GetData() {
-  return (GetLength() == 0) ? NULL : &*begin_;
+  return (GetLength() == 0) ? nullptr : &*begin_;
 }
 
 const unsigned char *ByteString::GetConstData() const {
-  return (GetLength() == 0) ? NULL : &*begin_;
+  return (GetLength() == 0) ? nullptr : &*begin_;
 }
 
 size_t ByteString::GetLength() const {
@@ -71,7 +71,7 @@
 }
 
 bool ByteString::ConvertToCPUUInt32(uint32_t *val) const {
-  if (val == NULL || GetLength() != sizeof(*val)) {
+  if (val == nullptr || GetLength() != sizeof(*val)) {
     return false;
   }
   memcpy(val, GetConstData(), sizeof(*val));
diff --git a/byte_string_unittest.cc b/byte_string_unittest.cc
index db45e87..6ddef62 100644
--- a/byte_string_unittest.cc
+++ b/byte_string_unittest.cc
@@ -40,9 +40,9 @@
                                  ByteString *mask,
                                  ByteString *expected_result,
                                  size_t count) {
-    ASSERT_NE(reinterpret_cast<ByteString *>(NULL), bs);
-    ASSERT_NE(reinterpret_cast<ByteString *>(NULL), mask);
-    ASSERT_NE(reinterpret_cast<ByteString *>(NULL), expected_result);
+    ASSERT_NE(nullptr, bs);
+    ASSERT_NE(nullptr, mask);
+    ASSERT_NE(nullptr, expected_result);
 
     for (size_t i = 0; i < count; i++) {
       EXPECT_FALSE(bs->BitwiseAnd(*mask));
@@ -57,9 +57,9 @@
                                 ByteString *merge,
                                 ByteString *expected_result,
                                 size_t count) {
-    ASSERT_NE(reinterpret_cast<ByteString *>(NULL), bs);
-    ASSERT_NE(reinterpret_cast<ByteString *>(NULL), merge);
-    ASSERT_NE(reinterpret_cast<ByteString *>(NULL), expected_result);
+    ASSERT_NE(nullptr, bs);
+    ASSERT_NE(nullptr, merge);
+    ASSERT_NE(nullptr, expected_result);
 
     for (size_t i = 0; i < count; i++) {
       EXPECT_FALSE(bs->BitwiseOr(*merge));
@@ -77,7 +77,7 @@
   ByteString bs1(0);
   EXPECT_TRUE(bs1.IsEmpty());
   EXPECT_EQ(0, bs1.GetLength());
-  EXPECT_TRUE(bs1.GetData() == NULL);
+  EXPECT_EQ(nullptr, bs1.GetData());
   EXPECT_FALSE(bs1.ConvertToNetUInt32(&val));
   EXPECT_TRUE(bs1.IsZero());
 }
@@ -87,7 +87,7 @@
   uint32_t val;
 
   EXPECT_FALSE(bs1.IsEmpty());
-  ASSERT_TRUE(bs1.GetData() != NULL);
+  ASSERT_NE(nullptr, bs1.GetData());
   EXPECT_EQ(sizeof(kTest1), bs1.GetLength());
   for (unsigned int i = 0; i < sizeof(kTest1); i++) {
     EXPECT_EQ(bs1.GetData()[i], kTest1[i]);
@@ -98,7 +98,7 @@
   // Build a ByteString (different to bs1), verify that the new ByteString
   // looks as expected, verify that it's different to bs1.
   ByteString bs2(kTest2, sizeof(kTest2));
-  ASSERT_TRUE(bs2.GetData() != NULL);
+  ASSERT_NE(nullptr, bs2.GetData());
   EXPECT_EQ(sizeof(kTest2), bs2.GetLength());
   for (unsigned int i = 0; i < sizeof(kTest2); i++) {
     EXPECT_EQ(bs2.GetData()[i], kTest2[i]);
@@ -110,7 +110,7 @@
   // new ByteString looks as expected, verify that it's different to bs1 and
   // bs2.
   ByteString bs3(kTest3, sizeof(kTest3));
-  ASSERT_TRUE(bs3.GetData() != NULL);
+  ASSERT_NE(nullptr, bs3.GetData());
   EXPECT_EQ(sizeof(kTest3), bs3.GetLength());
   for (unsigned int i = 0; i < sizeof(kTest3); i++) {
     EXPECT_EQ(bs3.GetData()[i], kTest3[i]);
@@ -153,7 +153,7 @@
   uint32_t val;
 
   EXPECT_EQ(4, bs1.GetLength());
-  ASSERT_TRUE(bs1.GetData() != NULL);
+  ASSERT_NE(nullptr, bs1.GetData());
   EXPECT_TRUE(bs1.ConvertToNetUInt32(&val));
   EXPECT_EQ(kTest2Uint32, val);
   EXPECT_FALSE(bs1.IsZero());
@@ -165,7 +165,7 @@
 
   ByteString bs3 = ByteString::CreateFromCPUUInt32(0x1020304);
   EXPECT_EQ(4, bs1.GetLength());
-  ASSERT_TRUE(bs3.GetData() != NULL);
+  ASSERT_NE(nullptr, bs3.GetData());
   EXPECT_TRUE(bs3.ConvertToCPUUInt32(&val));
   EXPECT_EQ(0x1020304, val);
   EXPECT_FALSE(bs3.IsZero());
@@ -183,7 +183,7 @@
   const size_t kSizeExtension = 10;
   bs.Resize(sizeof(kTest2) + kSizeExtension);
   EXPECT_EQ(sizeof(kTest2) + kSizeExtension, bs.GetLength());
-  ASSERT_TRUE(bs.GetData() != NULL);
+  ASSERT_NE(nullptr, bs.GetData());
   EXPECT_EQ(0, memcmp(bs.GetData(), kTest2, sizeof(kTest2)));
   for (size_t i = sizeof(kTest2); i < sizeof(kTest2) + kSizeExtension; ++i) {
     EXPECT_EQ(0, bs.GetData()[i]);
@@ -258,7 +258,7 @@
   bs1.RemovePrefix(sizeof(kTest1));
   EXPECT_TRUE(bs1.IsEmpty());
   EXPECT_EQ(0, bs1.GetLength());
-  EXPECT_TRUE(bs1.GetData() == NULL);
+  EXPECT_EQ(nullptr, bs1.GetData());
   EXPECT_FALSE(bs1.ConvertToNetUInt32(&val));
   EXPECT_TRUE(bs1.IsZero());
 }
@@ -270,7 +270,7 @@
 
   {
     bs1.RemovePrefix(kOffset1);
-    ASSERT_TRUE(bs1.GetData() != NULL);
+    ASSERT_NE(nullptr, bs1.GetData());
     EXPECT_FALSE(bs1.IsEmpty());
     EXPECT_EQ(kNewLength1, bs1.GetLength());
     for (unsigned int i = kOffset1; i < sizeof(kTest1); i++) {
@@ -287,7 +287,7 @@
     const size_t kOffset2 = sizeof(kTest2) - kNewLength2;
     ByteString bs2(kTest2, sizeof(kTest2));
     bs2.RemovePrefix(kOffset2);
-    ASSERT_TRUE(bs2.GetData() != NULL);
+    ASSERT_NE(nullptr, bs2.GetData());
     EXPECT_EQ(kNewLength2, bs2.GetLength());
     for (unsigned int i = kOffset2; i < sizeof(kTest2); i++) {
       EXPECT_EQ(bs2.GetData()[i - kOffset2], kTest2[i]);
@@ -349,7 +349,7 @@
   const size_t kSizeExtension = 10;
   bs.Resize(sizeof(kTest2) + kSizeExtension);
   EXPECT_EQ(sizeof(kTest2) + kSizeExtension, bs.GetLength());
-  ASSERT_TRUE(bs.GetData() != NULL);
+  ASSERT_NE(nullptr, bs.GetData());
   EXPECT_EQ(0, memcmp(bs.GetData(),
                       kTest2 + kOffset,
                       sizeof(kTest2) - kOffset));
diff --git a/connection.cc b/connection.cc
index be3c019..b492234 100644
--- a/connection.cc
+++ b/connection.cc
@@ -36,7 +36,7 @@
       client_disconnect_callback_(disconnect_callback) {}
 
 Connection::Binder::~Binder() {
-  Attach(NULL);
+  Attach(nullptr);
 }
 
 void Connection::Binder::Attach(const ConnectionRefPtr &to_connection) {
@@ -443,7 +443,7 @@
                                       const RoutingTableEntry &entry) {
   SLOG(Connection, 2) << __func__ << "(" << interface_index << ", "
                       << entry.tag << ")" << " @ " << interface_name_;
-  lower_binder_.Attach(NULL);
+  lower_binder_.Attach(nullptr);
   DeviceRefPtr device = device_info_->GetDevice(interface_index);
   if (!device) {
     LOG(ERROR) << "Unable to lookup device for index " << interface_index;
@@ -495,7 +495,7 @@
 
   // Unbinds the lower connection before notifying the binders. This ensures
   // correct behavior in case of circular binding.
-  lower_binder_.Attach(NULL);
+  lower_binder_.Attach(nullptr);
   while (!binders_.empty()) {
     // Pop the binder first and then notify it to ensure that each binder is
     // notified only once.
@@ -532,7 +532,7 @@
                  << carrier->interface_name();
       // If a loop is detected return a NULL value to signal that the carrier
       // connection is unknown.
-      return NULL;
+      return nullptr;
     }
     visited.insert(carrier.get());
     carrier = carrier->GetLowerConnection();
diff --git a/connection.h b/connection.h
index 8b9936a..c767c0d 100644
--- a/connection.h
+++ b/connection.h
@@ -41,11 +41,11 @@
     ~Binder();
 
     // Binds to |to_connection|. Unbinds the previous bound connection, if
-    // any. Pass NULL to just unbind this Binder.
+    // any. Pass nullptr to just unbind this Binder.
     void Attach(const ConnectionRefPtr &to_connection);
 
     const std::string &name() const { return name_; }
-    bool IsBound() const { return connection_ != NULL; }
+    bool IsBound() const { return connection_ != nullptr; }
     ConnectionRefPtr connection() const { return connection_.get(); }
 
    private:
@@ -110,7 +110,7 @@
   void set_tethering(const std::string &tethering) { tethering_ = tethering; }
 
   // Return the lowest connection on which this connection depends. In case of
-  // error, a NULL is returned.
+  // error, a nullptr is returned.
   virtual ConnectionRefPtr GetCarrierConnection();
 
   // Return true if this is an IPv6 connection.
diff --git a/connection_health_checker.cc b/connection_health_checker.cc
index f1dc483..ebd73a8 100644
--- a/connection_health_checker.cc
+++ b/connection_health_checker.cc
@@ -172,7 +172,7 @@
 }
 
 void ConnectionHealthChecker::Stop() {
-  if (tcp_connection_.get() != NULL)
+  if (tcp_connection_.get() != nullptr)
     tcp_connection_->Stop();
   verify_sent_data_callback_.Cancel();
   ClearSocketDescriptor();
@@ -381,7 +381,7 @@
   char ipstr[INET_ADDRSTRLEN];
   const char *res = inet_ntop(AF_INET, &addr_in->sin_addr,
                               ipstr, sizeof(ipstr));
-  if (res == NULL) {
+  if (res == nullptr) {
     SLOG(Connection, 2) << __func__
                         << ": Could not convert IP address to string.";
     return false;
diff --git a/connection_health_checker_unittest.cc b/connection_health_checker_unittest.cc
index c16fc77..d0599b3 100644
--- a/connection_health_checker_unittest.cc
+++ b/connection_health_checker_unittest.cc
@@ -69,11 +69,9 @@
  public:
   ConnectionHealthCheckerTest()
       : interface_name_(kInterfaceName),
-        device_info_(&control_, &dispatcher_,
-                     reinterpret_cast<Metrics*>(NULL),
-                     reinterpret_cast<Manager*>(NULL)),
+        device_info_(&control_, &dispatcher_, nullptr, nullptr),
         connection_(new NiceMock<MockConnection>(&device_info_)),
-        socket_(NULL) {}
+        socket_(nullptr) {}
 
   // Invokes
   int GetSockName(int fd, struct sockaddr *addr_out, socklen_t *sockaddr_size) {
@@ -232,12 +230,12 @@
     EXPECT_EQ(connection_.get(), health_checker_->connection_.get());
     EXPECT_EQ(&dispatcher_, health_checker_->dispatcher_);
     EXPECT_EQ(socket_, health_checker_->socket_.get());
-    EXPECT_FALSE(socket_ == NULL);
+    EXPECT_FALSE(socket_ == nullptr);
     EXPECT_EQ(socket_info_reader_, health_checker_->socket_info_reader_.get());
-    EXPECT_FALSE(socket_info_reader_ == NULL);
+    EXPECT_FALSE(socket_info_reader_ == nullptr);
     EXPECT_FALSE(health_checker_->connection_complete_callback_.is_null());
     EXPECT_EQ(tcp_connection_, health_checker_->tcp_connection_.get());
-    EXPECT_FALSE(tcp_connection_ == NULL);
+    EXPECT_FALSE(tcp_connection_ == nullptr);
     EXPECT_FALSE(health_checker_->health_check_in_progress_);
   }
 
@@ -340,7 +338,7 @@
 
   // health_checker_ has reset tcp_connection_ to a new object.
   // Since it owned tcp_connection_, the object has been destroyed.
-  tcp_connection_ = NULL;
+  tcp_connection_ = nullptr;
 }
 
 TEST_F(ConnectionHealthCheckerTest, GarbageCollectDNSClients) {
diff --git a/connection_tester_unittest.cc b/connection_tester_unittest.cc
index 2f4edf9..fc1d7f7 100644
--- a/connection_tester_unittest.cc
+++ b/connection_tester_unittest.cc
@@ -34,20 +34,14 @@
 class ConnectionTesterTest : public Test {
  public:
   ConnectionTesterTest()
-      : device_info_(new NiceMock<MockDeviceInfo>(
-            &control_,
-            reinterpret_cast<EventDispatcher *>(NULL),
-            reinterpret_cast<Metrics *>(NULL),
-            reinterpret_cast<Manager *>(NULL))),
+      : device_info_(
+            new NiceMock<MockDeviceInfo>(&control_, nullptr, nullptr, nullptr)),
         connection_(new StrictMock<MockConnection>(device_info_.get())),
         connection_tester_(
-            new ConnectionTester(connection_.get(),
-                                 &dispatcher_,
+            new ConnectionTester(connection_.get(), &dispatcher_,
                                  callback_target_.tester_callback())),
-        connectivity_trial_(
-            new StrictMock<MockConnectivityTrial>(
-                connection_,
-                ConnectionTester::kTrialTimeoutSeconds)) { }
+        connectivity_trial_(new StrictMock<MockConnectivityTrial>(
+            connection_, ConnectionTester::kTrialTimeoutSeconds)) {}
 
   virtual void SetUp() {
     EXPECT_CALL(*connection_.get(), IsIPv6())
diff --git a/connection_unittest.cc b/connection_unittest.cc
index 347ca60..94bbef8 100644
--- a/connection_unittest.cc
+++ b/connection_unittest.cc
@@ -60,9 +60,9 @@
   ConnectionTest()
       : device_info_(new StrictMock<MockDeviceInfo>(
             &control_,
-            static_cast<EventDispatcher*>(NULL),
-            static_cast<Metrics*>(NULL),
-            static_cast<Manager*>(NULL))),
+            nullptr,
+            nullptr,
+            nullptr)),
         connection_(new Connection(
             kTestDeviceInterfaceIndex0,
             kTestDeviceName0,
@@ -101,7 +101,7 @@
 
   virtual void TearDown() {
     AddDestructorExpectations();
-    connection_ = NULL;
+    connection_ = nullptr;
   }
 
   void ReplaceSingletons(ConnectionRefPtr connection) {
@@ -265,9 +265,9 @@
 
   scoped_refptr<MockDevice> device(new StrictMock<MockDevice>(
       &control_,
-      reinterpret_cast<EventDispatcher *>(NULL),
-      reinterpret_cast<Metrics *>(NULL),
-      reinterpret_cast<Manager *>(NULL),
+      nullptr,
+      nullptr,
+      nullptr,
       kTestDeviceName0,
       string(),
       kTestDeviceInterfaceIndex0));
@@ -396,9 +396,9 @@
   EXPECT_CALL(resolver_, SetDNSFromLists(empty_list, empty_list));
   scoped_refptr<MockDevice> device(new StrictMock<MockDevice>(
       &control_,
-      reinterpret_cast<EventDispatcher *>(NULL),
-      reinterpret_cast<Metrics *>(NULL),
-      reinterpret_cast<Manager *>(NULL),
+      nullptr,
+      nullptr,
+      nullptr,
       kTestDeviceName0,
       string(),
       kTestDeviceInterfaceIndex0));
@@ -501,9 +501,9 @@
   ConnectionRefPtr connection = GetNewConnection();
   scoped_refptr<MockDevice> device(new StrictMock<MockDevice>(
       &control_,
-      reinterpret_cast<EventDispatcher *>(NULL),
-      reinterpret_cast<Metrics *>(NULL),
-      reinterpret_cast<Manager *>(NULL),
+      nullptr,
+      nullptr,
+      nullptr,
       kTestDeviceName0,
       string(),
       kTestDeviceInterfaceIndex0));
@@ -536,7 +536,7 @@
   EXPECT_CALL(routing_table_, FlushRoutes(kTestDeviceInterfaceIndex1));
   EXPECT_CALL(routing_table_, FlushRoutesWithTag(kTestDeviceInterfaceIndex1));
   EXPECT_CALL(*device_info_, FlushAddresses(kTestDeviceInterfaceIndex1));
-  connection = NULL;
+  connection = nullptr;
 }
 
 TEST_F(ConnectionTest, RequestHostRoute) {
@@ -744,7 +744,7 @@
   binder2.Attach(connection_);
 
   EXPECT_CALL(target3, CallTarget()).Times(0);
-  binder3.Attach(NULL);
+  binder3.Attach(nullptr);
 
   ASSERT_EQ(3, connection_->binders_.size());
   EXPECT_TRUE(connection_->binders_.at(0) == &binder0);
@@ -779,7 +779,7 @@
   EXPECT_TRUE(binder == connection1->binders_.at(0));
 
   // Unbind lower |connection1| and check if it's unbound.
-  binder->Attach(NULL);
+  binder->Attach(nullptr);
   EXPECT_FALSE(binder->IsBound());
   EXPECT_TRUE(connection1->binders_.empty());
 
@@ -791,7 +791,7 @@
   connection2->lower_binder_.Attach(connection1);
   EXPECT_FALSE(connection1->binders_.empty());
   AddDestructorExpectations();
-  connection2 = NULL;
+  connection2 = nullptr;
   EXPECT_TRUE(connection1->binders_.empty());
 
   // Bind lower |connection1| to upper |connection_| and destroy lower
@@ -805,7 +805,7 @@
   EXPECT_CALL(target, CallTarget()).Times(1);
   ASSERT_FALSE(connection_->binders_.empty());
   AddDestructorExpectations();
-  connection1 = NULL;
+  connection1 = nullptr;
   EXPECT_FALSE(binder->IsBound());
   EXPECT_FALSE(test_binder.IsBound());
   EXPECT_TRUE(connection_->binders_.empty());
@@ -824,7 +824,7 @@
 
     AddDestructorExpectations();
     EXPECT_CALL(target, CallTarget()).Times(1);
-    connection = NULL;
+    connection = nullptr;
   }
   {
     // Circular binding of multiple connections should be safe.
@@ -847,12 +847,12 @@
     AddDestructorExpectations();
     EXPECT_CALL(target_a, CallTarget()).Times(1);
     EXPECT_CALL(target_b, CallTarget()).Times(1);
-    connection_b = NULL;
+    connection_b = nullptr;
 
     EXPECT_TRUE(connection_a->binders_.empty());
 
     AddDestructorExpectations();
-    connection_a = NULL;
+    connection_a = nullptr;
   }
   {
     // Test the weak pointer to the bound Connection. This is not a case that
@@ -866,11 +866,11 @@
     connection->binders_.clear();
     AddDestructorExpectations();
     EXPECT_CALL(target, CallTarget()).Times(0);
-    connection = NULL;
+    connection = nullptr;
 
-    // Ensure no crash -- the weak pointer to connection should be NULL.
+    // Ensure no crash -- the weak pointer to connection should be nullptr.
     EXPECT_FALSE(binder.connection());
-    binder.Attach(NULL);
+    binder.Attach(nullptr);
   }
 }
 
@@ -879,9 +879,9 @@
   ConnectionRefPtr connection = GetNewConnection();
   scoped_refptr<MockDevice> device(new StrictMock<MockDevice>(
       &control_,
-      reinterpret_cast<EventDispatcher *>(NULL),
-      reinterpret_cast<Metrics *>(NULL),
-      reinterpret_cast<Manager *>(NULL),
+      nullptr,
+      nullptr,
+      nullptr,
       kTestDeviceName1,
       string(),
       kTestDeviceInterfaceIndex1));
@@ -929,9 +929,9 @@
   EXPECT_TRUE(binder->IsBound());
   EXPECT_EQ(mock_connection.get(), binder->connection().get());
 
-  device->connection_ = NULL;
+  device->connection_ = nullptr;
   AddDestructorExpectations();
-  connection = NULL;
+  connection = nullptr;
 }
 
 TEST_F(ConnectionTest, GetCarrierConnection) {
@@ -952,16 +952,16 @@
 
   // Create a cycle back to |connection1|.
   connection3->lower_binder_.Attach(connection1);
-  EXPECT_EQ(NULL, connection_->GetCarrierConnection().get());
+  EXPECT_EQ(nullptr, connection_->GetCarrierConnection().get());
 
   AddDestructorExpectations();
-  connection3 = NULL;
+  connection3 = nullptr;
 
   AddDestructorExpectations();
-  connection2 = NULL;
+  connection2 = nullptr;
 
   AddDestructorExpectations();
-  connection1 = NULL;
+  connection1 = nullptr;
 }
 
 }  // namespace shill
diff --git a/connectivity_trial_unittest.cc b/connectivity_trial_unittest.cc
index 39c125c..4a33f6e 100644
--- a/connectivity_trial_unittest.cc
+++ b/connectivity_trial_unittest.cc
@@ -54,20 +54,15 @@
 class ConnectivityTrialTest : public Test {
  public:
   ConnectivityTrialTest()
-      : device_info_(new NiceMock<MockDeviceInfo>(
-          &control_,
-          reinterpret_cast<EventDispatcher *>(NULL),
-          reinterpret_cast<Metrics *>(NULL),
-          reinterpret_cast<Manager *>(NULL))),
+      : device_info_(
+            new NiceMock<MockDeviceInfo>(&control_, nullptr, nullptr, nullptr)),
         connection_(new StrictMock<MockConnection>(device_info_.get())),
         connectivity_trial_(new ConnectivityTrial(
-            connection_.get(),
-            &dispatcher_,
-            kTrialTimeout,
+            connection_.get(), &dispatcher_, kTrialTimeout,
             callback_target_.result_callback())),
         interface_name_(kInterfaceName),
         dns_servers_(kDNSServers, kDNSServers + 2),
-        http_request_(NULL) {
+        http_request_(nullptr) {
     current_time_.tv_sec = current_time_.tv_usec = 0;
   }
 
diff --git a/crypto_util_proxy.cc b/crypto_util_proxy.cc
index 776f762..af8d26c 100644
--- a/crypto_util_proxy.cc
+++ b/crypto_util_proxy.cc
@@ -161,9 +161,9 @@
   vector<char *> args;
   args.push_back(const_cast<char *>(kCryptoUtilShimPath));
   args.push_back(const_cast<char *>(command.c_str()));
-  args.push_back(NULL);
+  args.push_back(nullptr);
   if (!minijail_->RunPipesAndDestroy(jail, args, &shim_pid_,
-                                     &shim_stdin_, &shim_stdout_, NULL)) {
+                                     &shim_stdin_, &shim_stdout_, nullptr)) {
     LOG(ERROR) << "Minijail couldn't run our child process";
     return false;
   }
diff --git a/crypto_util_proxy_unittest.cc b/crypto_util_proxy_unittest.cc
index 35928ff..0872622 100644
--- a/crypto_util_proxy_unittest.cc
+++ b/crypto_util_proxy_unittest.cc
@@ -72,7 +72,7 @@
     return false;
   }
 
-  if (arg[2] != NULL) {
+  if (arg[2] != nullptr) {
     return false;
   }
 
@@ -139,7 +139,7 @@
                                               NotNull(),  // pid
                                               NotNull(),  // stdin
                                               NotNull(),  // stdout
-                                              NULL))  // stderr
+                                              nullptr))  // stderr
         .WillOnce(Invoke(this, &CryptoUtilProxyTest::HandleRunPipesAndDestroy));
     // We should always schedule a shim timeout callback.
     EXPECT_CALL(dispatcher_, PostDelayedTask(_, _));
@@ -299,7 +299,7 @@
                                      &CryptoUtilProxyTest::AssertShimDead)));
     ExpectCleanup(Error(Error::kSuccess));
     InputData data;
-    data.buf = NULL;
+    data.buf = nullptr;
     data.len = 0;
     crypto_util_proxy_.HandleShimOutput(&data);
   }
@@ -385,7 +385,7 @@
   // Write 0 bytes in to signify the end of the stream. This should in turn
   // cause our callback to be called.
   data.len = 0;
-  data.buf = NULL;
+  data.buf = nullptr;
   EXPECT_CALL(
       crypto_util_proxy_,
       TestResultHandlerCallback(string(kTestSerializedCommandResponse),
diff --git a/dbus_adaptor.cc b/dbus_adaptor.cc
index 7313b32..3ee7e7d 100644
--- a/dbus_adaptor.cc
+++ b/dbus_adaptor.cc
@@ -84,7 +84,7 @@
     e.Populate(Error::kInternalError);
   }
 
-  if (error != NULL) {
+  if (error != nullptr) {
     e.ToDBusError(error);
   }
 
@@ -209,7 +209,7 @@
   Error e;
   store->ClearProperty(name, &e);
 
-  if (error != NULL) {
+  if (error != nullptr) {
     e.ToDBusError(error);
   }
 
diff --git a/dbus_control.cc b/dbus_control.cc
index 3335b18..9d06754 100644
--- a/dbus_control.cc
+++ b/dbus_control.cc
@@ -25,7 +25,7 @@
 
 template <typename Object, typename AdaptorInterface, typename Adaptor>
 AdaptorInterface *DBusControl::CreateAdaptor(Object *object) {
-  AdaptorInterface *adaptor = NULL;
+  AdaptorInterface *adaptor = nullptr;
   try {
     adaptor = new Adaptor(connection_.get(), object);
   } catch(const DBus::ErrorObjectPathInUse &error) {
@@ -73,7 +73,7 @@
   dispatcher_.reset(new(std::nothrow) DBus::Glib::BusDispatcher());
   CHECK(dispatcher_.get()) << "Failed to create a dbus-dispatcher";
   DBus::default_dispatcher = dispatcher_.get();
-  dispatcher_->attach(NULL);
+  dispatcher_->attach(nullptr);
   connection_.reset(new DBus::Connection(DBus::Connection::SystemBus()));
   if (!connection_->acquire_name(SHILL_INTERFACE)) {
     LOG(FATAL) << "Failed to acquire D-Bus name " << SHILL_INTERFACE << ". "
diff --git a/device.cc b/device.cc
index 18f9534..670b662 100644
--- a/device.cc
+++ b/device.cc
@@ -384,7 +384,7 @@
     // Invalidate the old IPv6 configuration, will receive notifications
     // from kernel for new IPv6 configuration if there is one.
     StopIPv6DNSServerTimer();
-    ip6config_ = NULL;
+    ip6config_ = nullptr;
     UpdateIPConfigsProperty();
   }
   if (link_monitor_) {
@@ -403,19 +403,19 @@
 void Device::DropConnection() {
   SLOG(Device, 2) << __func__;
   DestroyIPConfig();
-  SelectService(NULL);
+  SelectService(nullptr);
 }
 
 void Device::DestroyIPConfig() {
   DisableIPv6();
   if (ipconfig_.get()) {
     ipconfig_->ReleaseIP(IPConfig::kReleaseReasonDisconnect);
-    ipconfig_ = NULL;
+    ipconfig_ = nullptr;
     UpdateIPConfigsProperty();
   }
   if (ip6config_.get()) {
     StopIPv6DNSServerTimer();
-    ip6config_ = NULL;
+    ip6config_ = nullptr;
     UpdateIPConfigsProperty();
   }
   DestroyConnection();
@@ -426,7 +426,7 @@
   if (!manager_->device_info()->GetPrimaryIPv6Address(
           interface_index_, &address)) {
     if (ip6config_) {
-      ip6config_ = NULL;
+      ip6config_ = nullptr;
       UpdateIPConfigsProperty();
     }
     return;
@@ -624,7 +624,7 @@
     string(Device::*get)(Error *error)) {
   store_.RegisterDerivedString(
       name,
-      StringAccessor(new CustomAccessor<Device, string>(this, get, NULL)));
+      StringAccessor(new CustomAccessor<Device, string>(this, get, nullptr)));
 }
 
 void Device::HelpRegisterConstDerivedRpcIdentifiers(
@@ -633,7 +633,7 @@
   store_.RegisterDerivedRpcIdentifiers(
       name,
       RpcIdentifiersAccessor(
-          new CustomAccessor<Device, RpcIdentifiers>(this, get, NULL)));
+          new CustomAccessor<Device, RpcIdentifiers>(this, get, nullptr)));
 }
 
 void Device::HelpRegisterConstDerivedUint64(
@@ -642,7 +642,7 @@
   store_.RegisterDerivedUint64(
       name,
       Uint64Accessor(
-          new CustomAccessor<Device, uint64_t>(this, get, NULL)));
+          new CustomAccessor<Device, uint64_t>(this, get, nullptr)));
 }
 
 void Device::ConnectionTesterCallback() {
@@ -845,9 +845,9 @@
   if (selected_service_.get()) {
     SLOG(Device, 3) << "Clearing connection of service "
                     << selected_service_->unique_name();
-    selected_service_->SetConnection(NULL);
+    selected_service_->SetConnection(nullptr);
   }
-  connection_ = NULL;
+  connection_ = nullptr;
 }
 
 void Device::SelectService(const ServiceRefPtr &service) {
@@ -867,7 +867,7 @@
     }
     // Just in case the Device subclass has not already done so, make
     // sure the previously selected service has its connection removed.
-    selected_service_->SetConnection(NULL);
+    selected_service_->SetConnection(nullptr);
     StopAllActivities();
   }
 
@@ -1489,7 +1489,7 @@
   } else {
     running_ = false;
     DestroyIPConfig();         // breaks a reference cycle
-    SelectService(NULL);       // breaks a reference cycle
+    SelectService(nullptr);    // breaks a reference cycle
     rtnl_handler_->SetInterfaceFlags(interface_index(), 0, IFF_UP);
     SLOG(Device, 3) << "Device " << link_name_ << " ipconfig_ "
                     << (ipconfig_ ? "is set." : "is not set.");
@@ -1505,7 +1505,7 @@
 
 void Device::UpdateIPConfigsProperty() {
   adaptor_->EmitRpcIdentifierArrayChanged(
-      kIPConfigsProperty, AvailableIPConfigs(NULL));
+      kIPConfigsProperty, AvailableIPConfigs(nullptr));
 }
 
 }  // namespace shill
diff --git a/device.h b/device.h
index df2f52d..dbcd260 100644
--- a/device.h
+++ b/device.h
@@ -348,7 +348,7 @@
 
   // Each device must implement this method to do the work needed to
   // enable the device to operate for establishing network connections.
-  // The |error| argument, if not NULL,
+  // The |error| argument, if not nullptr,
   // will refer to an Error that starts out with the value
   // Error::kOperationInitiated. This reflects the assumption that
   // enable (and disable) operations will usually be non-blocking,
diff --git a/device_dbus_adaptor.cc b/device_dbus_adaptor.cc
index 5116d7f..92fb354 100644
--- a/device_dbus_adaptor.cc
+++ b/device_dbus_adaptor.cc
@@ -27,7 +27,7 @@
 }
 
 DeviceDBusAdaptor::~DeviceDBusAdaptor() {
-  device_ = NULL;
+  device_ = nullptr;
 }
 
 const string &DeviceDBusAdaptor::GetRpcIdentifier() {
diff --git a/device_info.cc b/device_info.cc
index 5fb320a..1f772cf 100644
--- a/device_info.cc
+++ b/device_info.cc
@@ -194,7 +194,7 @@
     manager_->DeregisterDevice(device);
     // Release the reference to the device, but maintain the mapping
     // for the index.  That will be cleaned up by an RTNL message.
-    iter->second.device = NULL;
+    iter->second.device = nullptr;
   }
   metrics_->DeregisterDevice(device->interface_index());
 }
@@ -412,7 +412,7 @@
       LOG(WARNING) << "Cellular support is not implemented. "
                    << "Ignore cellular device " << link_name << " at index "
                    << interface_index << ".";
-      return NULL;
+      return nullptr;
 #else
       // Cellular devices are managed by ModemInfo.
       SLOG(Device, 2) << "Cellular link " << link_name
@@ -446,7 +446,7 @@
 #if defined(DISABLE_WIMAX)
       LOG(WARNING) << "WiMax support is not implemented. Ignore WiMax link "
                    << link_name << " at index " << interface_index << ".";
-      return NULL;
+      return nullptr;
 #else
       // WiMax devices are managed by WiMaxProvider.
       SLOG(Device, 2) << "WiMax link " << link_name
@@ -486,7 +486,7 @@
       SLOG(Device, 2) << "Bringing up loopback device " << link_name
                       << " at index " << interface_index;
       rtnl_handler_->SetInterfaceFlags(interface_index, IFF_UP, IFF_UP);
-      return NULL;
+      return nullptr;
     case Technology::kCDCEthernet:
       // CDCEthernet devices are of indeterminate type when they are
       // initially created.  Some time later, tty devices may or may
@@ -498,7 +498,7 @@
       LOG(INFO) << "Delaying creation of device for " << link_name
                 << " at index " << interface_index;
       DelayDeviceCreation(interface_index);
-      return NULL;
+      return nullptr;
     default:
       // We will not manage this device in shill.  Do not create a device
       // object or do anything to change its state.  We create a stub object
@@ -594,7 +594,7 @@
 
 DeviceRefPtr DeviceInfo::GetDevice(int interface_index) const {
   const Info *info = GetInfo(interface_index);
-  return info ? info->device : NULL;
+  return info ? info->device : nullptr;
 }
 
 int DeviceInfo::GetIndex(const string &interface_name) const {
@@ -883,7 +883,7 @@
 const DeviceInfo::Info *DeviceInfo::GetInfo(int interface_index) const {
   map<int, Info>::const_iterator iter = infos_.find(interface_index);
   if (iter == infos_.end()) {
-    return NULL;
+    return nullptr;
   }
   return &iter->second;
 }
diff --git a/device_info_unittest.cc b/device_info_unittest.cc
index 58de8ed..343aee6 100644
--- a/device_info_unittest.cc
+++ b/device_info_unittest.cc
@@ -72,7 +72,7 @@
       int /*fd*/,
       const IOHandler::InputCallback &/*input_callback*/,
       const IOHandler::ErrorCallback &/*error_callback*/) {
-    return NULL;
+    return nullptr;
   }
   MOCK_METHOD2(PostDelayedTask, bool(const base::Closure &task,
                                      int64_t delay_ms));
@@ -322,7 +322,7 @@
   EXPECT_CALL(manager_, DeregisterDevice(_)).Times(1);
   SendMessageToDeviceInfo(*message);
   EXPECT_FALSE(device_info_.GetDevice(kTestDeviceIndex).get());
-  EXPECT_FALSE(device_info_.GetFlags(kTestDeviceIndex, NULL));
+  EXPECT_FALSE(device_info_.GetFlags(kTestDeviceIndex, nullptr));
   EXPECT_EQ(-1, device_info_.GetIndex(kTestDeviceName));
 }
 
@@ -392,7 +392,7 @@
               ContainerEq(expected_technologies));
 
   device_info_.infos_[3].device = device;
-  device_info_.infos_[1].device = NULL;
+  device_info_.infos_[1].device = nullptr;
   technologies = device_info_.GetUninitializedTechnologies();
   EXPECT_THAT(set<string>(technologies.begin(), technologies.end()),
               ContainerEq(expected_technologies));
@@ -494,7 +494,7 @@
 
   // The Ethernet device destructor notifies the manager.
   EXPECT_CALL(manager_, UpdateEnabledTechnologies()).Times(1);
-  device = NULL;
+  device = nullptr;
 }
 
 TEST_F(DeviceInfoTest, CreateDeviceVirtioEthernet) {
@@ -513,7 +513,7 @@
 
   // The Ethernet device destructor notifies the manager.
   EXPECT_CALL(manager_, UpdateEnabledTechnologies()).Times(1);
-  device = NULL;
+  device = nullptr;
 }
 
 MATCHER_P(IsGetInterfaceMessage, index, "") {
@@ -958,7 +958,7 @@
 
 MATCHER_P2(IfreqEquals, ifindex, ifname, "") {
   const struct ifreq *const ifr = static_cast<struct ifreq *>(arg);
-  return (ifr != NULL) &&
+  return (ifr != nullptr) &&
       (ifr->ifr_ifindex == ifindex) &&
       (strcmp(ifname, ifr->ifr_name) == 0);
 }
@@ -1059,7 +1059,7 @@
 
 MATCHER_P2(ArpreqEquals, ifname, peer, "") {
   const struct arpreq *const areq = static_cast<struct arpreq *>(arg);
-  if (areq == NULL) {
+  if (areq == nullptr) {
     return false;
   }
 
@@ -1125,12 +1125,12 @@
       "null0", "addr0", kTestDeviceIndex));
 
   // Device info entry does not exist.
-  EXPECT_FALSE(device_info_.GetPrimaryIPv6Address(kTestDeviceIndex, NULL));
+  EXPECT_FALSE(device_info_.GetPrimaryIPv6Address(kTestDeviceIndex, nullptr));
 
   device_info_.infos_[kTestDeviceIndex].device = device;
 
   // Device info entry contains no addresses.
-  EXPECT_FALSE(device_info_.GetPrimaryIPv6Address(kTestDeviceIndex, NULL));
+  EXPECT_FALSE(device_info_.GetPrimaryIPv6Address(kTestDeviceIndex, nullptr));
 
   IPAddress ipv4_address(IPAddress::kFamilyIPv4);
   EXPECT_TRUE(ipv4_address.SetAddressFromString(kTestIPAddress0));
@@ -1141,7 +1141,7 @@
 
   // We should ignore IPv4 addresses.
   SendMessageToDeviceInfo(*message);
-  EXPECT_FALSE(device_info_.GetPrimaryIPv6Address(kTestDeviceIndex, NULL));
+  EXPECT_FALSE(device_info_.GetPrimaryIPv6Address(kTestDeviceIndex, nullptr));
 
   IPAddress ipv6_address1(IPAddress::kFamilyIPv6);
   EXPECT_TRUE(ipv6_address1.SetAddressFromString(kTestIPAddress1));
@@ -1150,7 +1150,7 @@
 
   // We should ignore non-SCOPE_UNIVERSE messages for IPv6.
   SendMessageToDeviceInfo(*message);
-  EXPECT_FALSE(device_info_.GetPrimaryIPv6Address(kTestDeviceIndex, NULL));
+  EXPECT_FALSE(device_info_.GetPrimaryIPv6Address(kTestDeviceIndex, nullptr));
 
   Mock::VerifyAndClearExpectations(device);
   IPAddress ipv6_address2(IPAddress::kFamilyIPv6);
diff --git a/device_unittest.cc b/device_unittest.cc
index b97b7ab..01b0231 100644
--- a/device_unittest.cc
+++ b/device_unittest.cc
@@ -154,13 +154,13 @@
   DeviceTest()
       : device_(new TestDevice(control_interface(),
                                dispatcher(),
-                               NULL,
+                               nullptr,
                                manager(),
                                kDeviceName,
                                kDeviceAddress,
                                kDeviceInterfaceIndex,
                                Technology::kUnknown)),
-        device_info_(control_interface(), NULL, NULL, NULL),
+        device_info_(control_interface(), nullptr, nullptr, nullptr),
         metrics_(dispatcher()) {
     DHCPProvider::GetInstance()->glib_ = glib();
     DHCPProvider::GetInstance()->control_interface_ = control_interface();
@@ -342,7 +342,7 @@
   ASSERT_TRUE(device_->ipconfig_.get());
   EXPECT_EQ(kDeviceName, device_->ipconfig_->device_name());
   EXPECT_FALSE(device_->ipconfig_->update_callback_.is_null());
-  device_->dhcp_provider_ = NULL;
+  device_->dhcp_provider_ = nullptr;
 }
 
 TEST_F(DeviceTest, EnableIPv6) {
@@ -412,14 +412,14 @@
     .WillOnce(Return(Service::kStateUnknown));
   EXPECT_CALL(*service, SetState(Service::kStateIdle));
   EXPECT_CALL(*service, SetConnection(IsNullRefPtr()));
-  SelectService(NULL);
+  SelectService(nullptr);
 
   // A service in the "Failure" state should not be reset to "Idle"
   SelectService(service);
   EXPECT_CALL(*service, state())
     .WillOnce(Return(Service::kStateFailure));
   EXPECT_CALL(*service, SetConnection(IsNullRefPtr()));
-  SelectService(NULL);
+  SelectService(nullptr);
 }
 
 TEST_F(DeviceTest, LinkMonitorFailure) {
@@ -554,10 +554,10 @@
 
 TEST_F(DeviceTest, IPConfigUpdatedSuccessNoSelectedService) {
   // Make sure shill doesn't crash if a service is disabled immediately
-  // after receiving its IP config (selected_service_ is NULL in this case).
+  // after receiving its IP config (selected_service_ is nullptr in this case).
   scoped_refptr<MockIPConfig> ipconfig = new MockIPConfig(control_interface(),
                                                           kDeviceName);
-  SelectService(NULL);
+  SelectService(nullptr);
   OnIPConfigUpdated(ipconfig.get());
 }
 
@@ -736,7 +736,7 @@
 
 TEST_F(DeviceTest, ResumeWithoutIPConfig) {
   // Just test that we don't crash in this case.
-  ASSERT_EQ(NULL, device_->ipconfig().get());
+  ASSERT_EQ(nullptr, device_->ipconfig().get());
   device_->OnAfterResume();
 }
 
@@ -826,7 +826,7 @@
   EXPECT_CALL(*service, SetState(_));
   EXPECT_CALL(*service, SetConnection(_));
   EXPECT_TRUE(HasLinkMonitor());
-  SelectService(NULL);
+  SelectService(nullptr);
   EXPECT_FALSE(HasLinkMonitor());
 }
 
@@ -893,7 +893,7 @@
   EXPECT_CALL(*service, SetState(_));
   EXPECT_CALL(*service, SetConnection(_));
   EXPECT_CALL(*traffic_monitor, Stop());
-  SelectService(NULL);
+  SelectService(nullptr);
 }
 
 TEST_F(DeviceTest, ShouldUseArpGateway) {
@@ -901,8 +901,8 @@
 }
 
 TEST_F(DeviceTest, PerformTDLSOperation) {
-  EXPECT_EQ("",
-            device_->PerformTDLSOperation("do something", "to someone", NULL));
+  EXPECT_EQ(
+      "", device_->PerformTDLSOperation("do something", "to someone", nullptr));
 }
 
 TEST_F(DeviceTest, IsConnectedViaTether) {
@@ -925,23 +925,23 @@
 }
 
 TEST_F(DeviceTest, AvailableIPConfigs) {
-  EXPECT_EQ(vector<string>(), device_->AvailableIPConfigs(NULL));
+  EXPECT_EQ(vector<string>(), device_->AvailableIPConfigs(nullptr));
   device_->ipconfig_ = new IPConfig(control_interface(), kDeviceName);
   EXPECT_EQ(vector<string> { IPConfigMockAdaptor::kRpcId },
-            device_->AvailableIPConfigs(NULL));
+            device_->AvailableIPConfigs(nullptr));
   device_->ip6config_ = new IPConfig(control_interface(), kDeviceName);
 
   // We don't really care that the RPC IDs for all IPConfig mock adaptors
   // are the same, or their ordering.  We just need to see that there are two
   // of them when both IPv6 and IPv4 IPConfigs are available.
-  EXPECT_EQ(2, device_->AvailableIPConfigs(NULL).size());
+  EXPECT_EQ(2, device_->AvailableIPConfigs(nullptr).size());
 
-  device_->ipconfig_ = NULL;
+  device_->ipconfig_ = nullptr;
   EXPECT_EQ(vector<string> { IPConfigMockAdaptor::kRpcId },
-            device_->AvailableIPConfigs(NULL));
+            device_->AvailableIPConfigs(nullptr));
 
-  device_->ip6config_ = NULL;
-  EXPECT_EQ(vector<string>(), device_->AvailableIPConfigs(NULL));
+  device_->ip6config_ = nullptr;
+  EXPECT_EQ(vector<string>(), device_->AvailableIPConfigs(nullptr));
 }
 
 TEST_F(DeviceTest, OnIPv6AddressChanged) {
@@ -952,7 +952,7 @@
   manager.set_mock_device_info(&device_info_);
   SetManager(&manager);
 
-  // An IPv6 clear while ip6config_ is NULL will not emit a change.
+  // An IPv6 clear while ip6config_ is nullptr will not emit a change.
   EXPECT_CALL(device_info_, GetPrimaryIPv6Address(kDeviceInterfaceIndex, _))
       .WillOnce(Return(false));
   EXPECT_CALL(*GetDeviceMockAdaptor(),
@@ -966,7 +966,7 @@
   const char kAddress0[] = "fe80::1aa9:5ff:abcd:1234";
   ASSERT_TRUE(address0.SetAddressFromString(kAddress0));
 
-  // Add an IPv6 address while ip6config_ is NULL.
+  // Add an IPv6 address while ip6config_ is nullptr.
   EXPECT_CALL(device_info_, GetPrimaryIPv6Address(kDeviceInterfaceIndex, _))
       .WillOnce(DoAll(SetArgPointee<1>(address0), Return(true)));
   EXPECT_CALL(*GetDeviceMockAdaptor(),
@@ -1016,7 +1016,7 @@
   device_->OnIPv6AddressChanged();
   EXPECT_EQ(kAddress1, device_->ip6config_->properties().address);
 
-  // Return the IPv6 address to NULL.
+  // Return the IPv6 address to nullptr.
   EXPECT_CALL(device_info_, GetPrimaryIPv6Address(kDeviceInterfaceIndex, _))
       .WillOnce(Return(false));
   EXPECT_CALL(*GetDeviceMockAdaptor(),
@@ -1069,7 +1069,7 @@
   dns_server_addresses_str.push_back(kAddress1);
   dns_server_addresses_str.push_back(kAddress2);
 
-  // Add IPv6 DNS server addresses while ip6config_ is NULL.
+  // Add IPv6 DNS server addresses while ip6config_ is nullptr.
   EXPECT_CALL(device_info_,
               GetIPv6DnsServerAddresses(kDeviceInterfaceIndex, _, _))
       .WillOnce(DoAll(SetArgPointee<1>(dns_server_addresses),
@@ -1152,7 +1152,7 @@
   Mock::VerifyAndClearExpectations(GetDeviceMockAdaptor());
   Mock::VerifyAndClearExpectations(&device_info_);
 
-  // Return the DNS server addresses to NULL.
+  // Return the DNS server addresses to nullptr.
   EXPECT_CALL(device_info_,
               GetIPv6DnsServerAddresses(kDeviceInterfaceIndex, _, _))
       .WillOnce(Return(false));
@@ -1386,7 +1386,7 @@
   EXPECT_TRUE(StartPortalDetection());
 
   // Drop all references to device_info before it falls out of scope.
-  SetConnection(NULL);
+  SetConnection(nullptr);
   StopPortalDetection();
 }
 
@@ -1417,7 +1417,7 @@
   EXPECT_TRUE(StartPortalDetection());
 
   // Drop all references to device_info before it falls out of scope.
-  SetConnection(NULL);
+  SetConnection(nullptr);
   StopPortalDetection();
 }
 
@@ -1674,7 +1674,7 @@
       .WillOnce(Return(Service::kStateIdle));
   EXPECT_CALL(*service_.get(), SetState(_));
   EXPECT_CALL(*service_.get(), SetConnection(_));
-  SelectService(NULL);
+  SelectService(nullptr);
   ExpectPortalDetectorReset();
 }
 
@@ -1949,7 +1949,7 @@
   tx_byte_count_ = 456;
   DeviceRefPtr device(new TestDevice(control_interface(),
                                      dispatcher(),
-                                     NULL,
+                                     nullptr,
                                      &manager_,
                                      kDeviceName,
                                      kDeviceAddress,
diff --git a/dhcp_config.cc b/dhcp_config.cc
index cd717ce..ecd479d 100644
--- a/dhcp_config.cc
+++ b/dhcp_config.cc
@@ -304,7 +304,7 @@
                                        lease_file_suffix_.c_str());
   }
   args.push_back(const_cast<char *>(interface_arg.c_str()));
-  args.push_back(NULL);
+  args.push_back(nullptr);
 
   struct minijail *jail = minijail_->New();
   minijail_->DropRoot(jail, kDHCPCDUser, kDHCPCDUser);
@@ -347,7 +347,7 @@
   int num_iterations =
       kDHCPCDExitWaitMilliseconds / kDHCPCDExitPollMilliseconds;
   for (int count = 0; count < num_iterations; ++count) {
-    ret = waitpid(pid_, NULL, WNOHANG);
+    ret = waitpid(pid_, nullptr, WNOHANG);
     if (ret == pid_ || ret == -1)
       break;
     usleep(kDHCPCDExitPollMilliseconds * 1000);
diff --git a/dhcp_config_unittest.cc b/dhcp_config_unittest.cc
index 17acf62..de452a8 100644
--- a/dhcp_config_unittest.cc
+++ b/dhcp_config_unittest.cc
@@ -75,8 +75,8 @@
   }
 
   virtual void TearDown() {
-    config_->proxy_factory_ = NULL;
-    config_->minijail_ = NULL;
+    config_->proxy_factory_ = nullptr;
+    config_->minijail_ = nullptr;
   }
 
   void StopInstance() {
@@ -172,7 +172,7 @@
   // We use a non-zero exit status so that we get the log message.
   EXPECT_CALL(log, Log(_, _, ::testing::EndsWith("status 10")));
   DHCPConfig::ChildWatchCallback(kPID, 10, config.get());
-  EXPECT_EQ(NULL, DHCPProvider::GetInstance()->GetConfig(kPID).get());
+  EXPECT_EQ(nullptr, DHCPProvider::GetInstance()->GetConfig(kPID).get());
 
   EXPECT_FALSE(base::PathExists(pid_file_));
   EXPECT_EQ(lease_file_exists, base::PathExists(lease_file_));
@@ -336,7 +336,8 @@
 
   string device_arg = has_lease_suffix ?
       string(kDeviceName) + "=" + string(kLeaseFileSuffix) : kDeviceName;
-  return string(arg[end_offset]) == device_arg && arg[end_offset + 1] == NULL;
+  return string(arg[end_offset]) == device_arg &&
+         arg[end_offset + 1] == nullptr;
 }
 
 TEST_F(DHCPConfigTest, StartWithHostname) {
@@ -593,7 +594,7 @@
   EXPECT_CALL(*proxy_, Release(kDeviceName));
   config_->proxy_.reset(proxy_.release());
   EXPECT_TRUE(config_->ReleaseIP(IPConfig::kReleaseReasonStaticIP));
-  EXPECT_EQ(NULL, config_->proxy_.get());
+  EXPECT_EQ(nullptr, config_->proxy_.get());
   config_->pid_ = 0;
 }
 
diff --git a/dhcp_provider.cc b/dhcp_provider.cc
index 4106de0..0f6b4b3 100644
--- a/dhcp_provider.cc
+++ b/dhcp_provider.cc
@@ -27,10 +27,10 @@
 DHCPProvider::DHCPProvider()
     : proxy_factory_(ProxyFactory::GetInstance()),
       root_("/"),
-      control_interface_(NULL),
-      dispatcher_(NULL),
-      glib_(NULL),
-      metrics_(NULL) {
+      control_interface_(nullptr),
+      dispatcher_(nullptr),
+      glib_(nullptr),
+      metrics_(nullptr) {
   SLOG(DHCP, 2) << __func__;
 }
 
@@ -74,7 +74,7 @@
   SLOG(DHCP, 2) << __func__ << " pid: " << pid;
   PIDConfigMap::const_iterator it = configs_.find(pid);
   if (it == configs_.end()) {
-    return NULL;
+    return nullptr;
   }
   return it->second;
 }
diff --git a/dhcp_provider.h b/dhcp_provider.h
index 0c94787..0a2f2f4 100644
--- a/dhcp_provider.h
+++ b/dhcp_provider.h
@@ -66,7 +66,7 @@
                                         bool arp_gateway);
 
   // Returns the DHCP configuration associated with DHCP client |pid|. Return
-  // NULL if |pid| is not bound to a configuration.
+  // nullptr if |pid| is not bound to a configuration.
   DHCPConfigRefPtr GetConfig(int pid);
 
   // Binds a |pid| to a DHCP |config|. When a DHCP config spawns a new DHCP
diff --git a/diagnostics_reporter.cc b/diagnostics_reporter.cc
index 7c8341d..8d55780 100644
--- a/diagnostics_reporter.cc
+++ b/diagnostics_reporter.cc
@@ -65,7 +65,7 @@
   if (IsReportingEnabled()) {
     args.push_back(const_cast<char *>("--upload"));
   }
-  args.push_back(NULL);
+  args.push_back(nullptr);
   pid_t pid = 0;
   struct minijail *jail = minijail_->New();
   minijail_->DropRoot(jail, kNetDiagsUploadUser, kNetDiagsUploadUser);
diff --git a/dns_client.cc b/dns_client.cc
index 7f94e61..70c87e1 100644
--- a/dns_client.cc
+++ b/dns_client.cc
@@ -48,7 +48,7 @@
 
 // Private to the implementation of resolver so callers don't include ares.h
 struct DNSClientState {
-  DNSClientState() : channel(NULL), start_time{} {}
+  DNSClientState() : channel(nullptr), start_time{} {}
 
   ares_channel channel;
   map<ares_socket_t, std::shared_ptr<IOHandler>> read_handlers;
@@ -222,12 +222,12 @@
                              weak_ptr_factory_.GetWeakPtr()));
 
   if (status == ARES_SUCCESS &&
-      hostent != NULL &&
+      hostent != nullptr &&
       hostent->h_addrtype == address_.family() &&
       static_cast<size_t>(hostent->h_length) ==
       IPAddress::GetAddressLength(address_.family()) &&
-      hostent->h_addr_list != NULL &&
-      hostent->h_addr_list[0] != NULL) {
+      hostent->h_addr_list != nullptr &&
+      hostent->h_addr_list[0] != nullptr) {
     address_ = IPAddress(address_.family(),
                          ByteString(reinterpret_cast<unsigned char *>(
                              hostent->h_addr_list[0]), hostent->h_length));
diff --git a/dns_client_unittest.cc b/dns_client_unittest.cc
index f72f74b..1fca831 100644
--- a/dns_client_unittest.cc
+++ b/dns_client_unittest.cc
@@ -45,7 +45,7 @@
 const char kBadServer[] = "10.9xx8.7";
 const char kNetworkInterface[] = "eth0";
 char kReturnAddressList0[] = { static_cast<char>(224), 0, 0, 1 };
-char *kReturnAddressList[] = { kReturnAddressList0, NULL };
+char *kReturnAddressList[] = { kReturnAddressList0, nullptr };
 char kFakeAresChannelData = 0;
 const ares_channel kAresChannel =
     reinterpret_cast<ares_channel>(&kFakeAresChannelData);
diff --git a/dns_server_tester_unittest.cc b/dns_server_tester_unittest.cc
index 9c6eb3a..e68d660 100644
--- a/dns_server_tester_unittest.cc
+++ b/dns_server_tester_unittest.cc
@@ -48,11 +48,8 @@
 class DNSServerTesterTest : public Test {
  public:
   DNSServerTesterTest()
-      : device_info_(new NiceMock<MockDeviceInfo>(
-          &control_,
-          reinterpret_cast<EventDispatcher *>(NULL),
-          reinterpret_cast<Metrics *>(NULL),
-          reinterpret_cast<Manager *>(NULL))),
+      : device_info_(
+            new NiceMock<MockDeviceInfo>(&control_, nullptr, nullptr, nullptr)),
         connection_(new StrictMock<MockConnection>(device_info_.get())),
         interface_name_(kInterfaceName),
         dns_servers_(kDNSServers, kDNSServers + 2) {}
diff --git a/eap_credentials.cc b/eap_credentials.cc
index dd29479..81eec20 100644
--- a/eap_credentials.cc
+++ b/eap_credentials.cc
@@ -164,14 +164,14 @@
   HelpRegisterWriteOnlyDerivedString(store,
                                      kEapPasswordProperty,
                                      &EapCredentials::SetEapPassword,
-                                     NULL,
+                                     nullptr,
                                      &password_);
   store->RegisterString(kEapPinProperty, &pin_);
   store->RegisterString(kEapPrivateKeyProperty, &private_key_);
   HelpRegisterWriteOnlyDerivedString(store,
                                      kEapPrivateKeyPasswordProperty,
                                      &EapCredentials::SetEapPrivateKeyPassword,
-                                     NULL,
+                                     nullptr,
                                      &private_key_password_);
 
   // Non-authentication properties.
@@ -262,7 +262,7 @@
   storage->GetString(id, kStorageEapKeyID, &key_id_);
   string key_management;
   storage->GetString(id, kStorageEapKeyManagement, &key_management);
-  SetKeyManagement(key_management, NULL);
+  SetKeyManagement(key_management, nullptr);
   storage->GetCryptedString(id, kStorageEapPassword, &password_);
   storage->GetString(id, kStorageEapPIN, &pin_);
   storage->GetString(id, kStorageEapPrivateKey, &private_key_);
diff --git a/eap_credentials_unittest.cc b/eap_credentials_unittest.cc
index e544431..f25be8c 100644
--- a/eap_credentials_unittest.cc
+++ b/eap_credentials_unittest.cc
@@ -446,7 +446,7 @@
   SetPrivateKey("foo");
   SetPin("foo");
   SetUseSystemCAs(false);
-  eap_.SetKeyManagement("foo", NULL);
+  eap_.SetKeyManagement("foo", nullptr);
   EXPECT_FALSE(IsReset());
   EXPECT_FALSE(GetKeyManagement().empty());
   eap_.Reset();
@@ -456,15 +456,15 @@
 
 TEST_F(EapCredentialsTest, SetKeyManagement) {
   const string kKeyManagement0("foo");
-  eap_.SetKeyManagement(kKeyManagement0, NULL);
+  eap_.SetKeyManagement(kKeyManagement0, nullptr);
   EXPECT_EQ(kKeyManagement0, GetKeyManagement());
 
   const string kKeyManagement1("bar");
-  eap_.SetKeyManagement(kKeyManagement1, NULL);
+  eap_.SetKeyManagement(kKeyManagement1, nullptr);
   EXPECT_EQ(kKeyManagement1, GetKeyManagement());
 
   // We should not be able to set the key management to an empty string.
-  eap_.SetKeyManagement("", NULL);
+  eap_.SetKeyManagement("", nullptr);
   EXPECT_EQ(kKeyManagement1, GetKeyManagement());
 }
 
diff --git a/ephemeral_profile.cc b/ephemeral_profile.cc
index 6a353b9..41fe9bf 100644
--- a/ephemeral_profile.cc
+++ b/ephemeral_profile.cc
@@ -39,7 +39,7 @@
 
 bool EphemeralProfile::AbandonService(const ServiceRefPtr &service) {
   if (service->profile() == this)
-    service->SetProfile(NULL);
+    service->SetProfile(nullptr);
   SLOG(Profile, 2) << "Removing service " << service->unique_name()
                    << " from ephemeral profile.";
   return true;
diff --git a/external_task.cc b/external_task.cc
index 4ea88d4..194928e 100644
--- a/external_task.cc
+++ b/external_task.cc
@@ -65,7 +65,7 @@
   for (const auto &option : arguments) {
     process_args.push_back(const_cast<char *>(option.c_str()));
   }
-  process_args.push_back(NULL);
+  process_args.push_back(nullptr);
 
   vector<char *> process_env;
   vector<string> env_vars(local_rpc_task->GetEnvironment());
@@ -76,19 +76,19 @@
     // See above regarding const_cast.
     process_env.push_back(const_cast<char *>(env_var.c_str()));
   }
-  process_env.push_back(NULL);
+  process_env.push_back(nullptr);
 
   GSpawnChildSetupFunc child_setup_func =
-      terminate_with_parent ? SetupTermination : NULL;
+      terminate_with_parent ? SetupTermination : nullptr;
 
-  if (!glib_->SpawnAsync(NULL,
+  if (!glib_->SpawnAsync(nullptr,
                          process_args.data(),
                          process_env.data(),
                          G_SPAWN_DO_NOT_REAP_CHILD,
                          child_setup_func,
-                         NULL,
+                         nullptr,
                          &pid_,
-                         NULL)) {
+                         nullptr)) {
     Error::PopulateAndLog(error, Error::kInternalError,
                           string("Unable to spawn: ") + process_args[0]);
     return false;
diff --git a/external_task_unittest.cc b/external_task_unittest.cc
index 208b39a..caee723 100644
--- a/external_task_unittest.cc
+++ b/external_task_unittest.cc
@@ -129,7 +129,7 @@
 
 TestRPCTask::~TestRPCTask() {
   test_->set_test_rpc_task_destroyed(true);
-  test_ = NULL;
+  test_ = nullptr;
 }
 
 }  // namespace
@@ -176,7 +176,7 @@
       }
       ++arg_local;
     }
-    if (*arg_local == NULL) {
+    if (*arg_local == nullptr) {
       *result_listener << "missing value " << expected_value << "\n";
       arg_local = arg;
       while (*arg_local) {
diff --git a/file_reader.cc b/file_reader.cc
index 7440253..6b841ee 100644
--- a/file_reader.cc
+++ b/file_reader.cc
@@ -23,14 +23,14 @@
 
 bool FileReader::Open(const FilePath &file_path) {
   file_.reset(base::OpenFile(file_path, "rb"));
-  return file_.get() != NULL;
+  return file_.get() != nullptr;
 }
 
 bool FileReader::ReadLine(string *line) {
   CHECK(line) << "Invalid argument";
 
   FILE *fp = file_.get();
-  if (fp == NULL)
+  if (!fp)
     return false;
 
   line->clear();
diff --git a/generic_netlink_message.cc b/generic_netlink_message.cc
index 793ff64..e1e9a4d 100644
--- a/generic_netlink_message.cc
+++ b/generic_netlink_message.cc
@@ -112,7 +112,7 @@
   nlattr *tb[CTRL_ATTR_MAX + 1];
   nla_parse(tb, CTRL_ATTR_MAX,
             reinterpret_cast<nlattr *>(message.GetData()), message.GetLength(),
-            NULL);
+            nullptr);
 
   for (int i = 0; i < CTRL_ATTR_MAX + 1; ++i) {
     if (tb[i]) {
@@ -142,7 +142,7 @@
     const nlmsghdr *const_msg) {
   if (!const_msg) {
     LOG(ERROR) << "NULL |const_msg| parameter";
-    return NULL;
+    return nullptr;
   }
   // Casting away constness since, while nlmsg_data doesn't change its
   // parameter, it also doesn't declare its paramenter as const.
@@ -160,7 +160,7 @@
       return new UnknownControlMessage(gnlh->cmd);
       break;
   }
-  return NULL;
+  return nullptr;
 }
 
 }  // namespace shill.
diff --git a/glib_io_input_handler.cc b/glib_io_input_handler.cc
index 6e12d36..ff7350a 100644
--- a/glib_io_input_handler.cc
+++ b/glib_io_input_handler.cc
@@ -87,14 +87,15 @@
   // To avoid blocking in g_io_channel_read_chars() due to its internal buffer,
   // set the channel to unbuffered, which in turns requires encoding to be NULL.
   // This assumes raw binary data are read from |fd| via the channel.
-  CHECK_EQ(G_IO_STATUS_NORMAL, g_io_channel_set_encoding(channel_, NULL, NULL));
+  CHECK_EQ(G_IO_STATUS_NORMAL,
+           g_io_channel_set_encoding(channel_, nullptr, nullptr));
   g_io_channel_set_buffered(channel_, FALSE);
   g_io_channel_set_close_on_unref(channel_, TRUE);
 }
 
 GlibIOInputHandler::~GlibIOInputHandler() {
   g_source_remove(source_id_);
-  g_io_channel_shutdown(channel_, TRUE, NULL);
+  g_io_channel_shutdown(channel_, TRUE, nullptr);
   g_io_channel_unref(channel_);
 }
 
diff --git a/glib_io_ready_handler.cc b/glib_io_ready_handler.cc
index cdd456d..668ec6a 100644
--- a/glib_io_ready_handler.cc
+++ b/glib_io_ready_handler.cc
@@ -34,7 +34,7 @@
 GlibIOReadyHandler::GlibIOReadyHandler(int fd,
                                        IOHandler::ReadyMode mode,
                                        const Callback<void(int)> &callback)
-    : channel_(NULL),
+    : channel_(nullptr),
       callback_(callback),
       source_id_(G_MAXUINT) {
   if (mode == kModeInput) {
diff --git a/http_proxy.cc b/http_proxy.cc
index 8f9aad3..b933d96 100644
--- a/http_proxy.cc
+++ b/http_proxy.cc
@@ -69,10 +69,10 @@
                                   weak_ptr_factory_.GetWeakPtr())),
       write_server_callback_(Bind(&HTTPProxy::WriteToServer,
                                   weak_ptr_factory_.GetWeakPtr())),
-      dispatcher_(NULL),
+      dispatcher_(nullptr),
       proxy_port_(-1),
       proxy_socket_(-1),
-      sockets_(NULL),
+      sockets_(nullptr),
       client_socket_(-1),
       server_port_(kDefaultServerPort),
       server_socket_(-1),
@@ -145,13 +145,13 @@
   StopClient();
 
   accept_handler_.reset();
-  dispatcher_ = NULL;
+  dispatcher_ = nullptr;
   dns_client_.reset();
   proxy_port_ = -1;
   server_async_connection_.reset();
   sockets_->Close(proxy_socket_);
   proxy_socket_ = -1;
-  sockets_ = NULL;
+  sockets_ = nullptr;
   state_ = kStateIdle;
 }
 
@@ -161,7 +161,7 @@
 void HTTPProxy::AcceptClient(int fd) {
   SLOG(HTTPProxy, 3) << "In " << __func__;
 
-  int client_fd = sockets_->Accept(fd, NULL, NULL);
+  int client_fd = sockets_->Accept(fd, nullptr, nullptr);
   if (client_fd < 0) {
     PLOG(ERROR) << "Client accept failed";
     return;
diff --git a/http_proxy_unittest.cc b/http_proxy_unittest.cc
index b3f00b7..a55d093 100644
--- a/http_proxy_unittest.cc
+++ b/http_proxy_unittest.cc
@@ -96,16 +96,13 @@
  public:
   HTTPProxyTest()
       : interface_name_(kInterfaceName),
-        server_async_connection_(NULL),
+        server_async_connection_(nullptr),
         dns_servers_(kDNSServers, kDNSServers + 2),
-        dns_client_(NULL),
-        device_info_(new NiceMock<MockDeviceInfo>(
-            &control_,
-            reinterpret_cast<EventDispatcher*>(NULL),
-            reinterpret_cast<Metrics*>(NULL),
-            reinterpret_cast<Manager*>(NULL))),
+        dns_client_(nullptr),
+        device_info_(
+            new NiceMock<MockDeviceInfo>(&control_, nullptr, nullptr, nullptr)),
         connection_(new StrictMock<MockConnection>(device_info_.get())),
-        proxy_(connection_) { }
+        proxy_(connection_) {}
 
  protected:
   virtual void SetUp() {
@@ -404,8 +401,8 @@
   void StopProxy() {
     ExpectStop();
     proxy_.Stop();
-    server_async_connection_ = NULL;
-    dns_client_ = NULL;
+    server_async_connection_ = nullptr;
+    dns_client_ = nullptr;
     ExpectReset();
   }
   void WriteToClient(int fd) {
diff --git a/http_request_unittest.cc b/http_request_unittest.cc
index 0942356..848b754 100644
--- a/http_request_unittest.cc
+++ b/http_request_unittest.cc
@@ -80,12 +80,9 @@
         server_async_connection_(new StrictMock<MockAsyncConnection>()),
         dns_servers_(kDNSServers, kDNSServers + 2),
         dns_client_(new StrictMock<MockDNSClient>()),
-        device_info_(new NiceMock<MockDeviceInfo>(
-            &control_,
-            reinterpret_cast<EventDispatcher*>(NULL),
-            reinterpret_cast<Metrics*>(NULL),
-            reinterpret_cast<Manager*>(NULL))),
-        connection_(new StrictMock<MockConnection>(device_info_.get())) { }
+        device_info_(
+            new NiceMock<MockDeviceInfo>(&control_, nullptr, nullptr, nullptr)),
+        connection_(new StrictMock<MockConnection>(device_info_.get())) {}
 
  protected:
   class CallbackTarget {
diff --git a/io_handler.h b/io_handler.h
index 0677860..4410d96 100644
--- a/io_handler.h
+++ b/io_handler.h
@@ -10,7 +10,7 @@
 class Error;
 
 struct InputData {
-  InputData() : buf(NULL), len(0) {}
+  InputData() : buf(nullptr), len(0) {}
   InputData(unsigned char *in_buf, size_t in_len) : buf(in_buf), len(in_len) {}
 
   unsigned char *buf;
diff --git a/ipconfig_dbus_adaptor.cc b/ipconfig_dbus_adaptor.cc
index 0a43a05..70733cd 100644
--- a/ipconfig_dbus_adaptor.cc
+++ b/ipconfig_dbus_adaptor.cc
@@ -36,7 +36,7 @@
 }
 
 IPConfigDBusAdaptor::~IPConfigDBusAdaptor() {
-  ipconfig_ = NULL;
+  ipconfig_ = nullptr;
 }
 
 void IPConfigDBusAdaptor::EmitBoolChanged(const string &name, bool value) {
diff --git a/ipconfig_unittest.cc b/ipconfig_unittest.cc
index debaba7..31b5248 100644
--- a/ipconfig_unittest.cc
+++ b/ipconfig_unittest.cc
@@ -35,7 +35,7 @@
  public:
   IPConfigTest() : ipconfig_(new IPConfig(&control_, kDeviceName)) {}
   void DropRef(const IPConfigRefPtr &/*ipconfig*/) {
-    ipconfig_ = NULL;
+    ipconfig_ = nullptr;
   }
 
   MOCK_METHOD1(OnIPConfigUpdated, void(const IPConfigRefPtr &ipconfig));
@@ -166,7 +166,7 @@
   EXPECT_CALL(*this, OnIPConfigFailed(ipconfig_)).Times(0);
   EXPECT_CALL(*this, OnIPConfigRefreshed(ipconfig_));
   EXPECT_CALL(*this, OnIPConfigExpired(ipconfig_)).Times(0);
-  ipconfig_->Refresh(NULL);
+  ipconfig_->Refresh(nullptr);
   Mock::VerifyAndClearExpectations(this);
 
   EXPECT_CALL(*this, OnIPConfigUpdated(ipconfig_)).Times(0);
diff --git a/key_file_store.cc b/key_file_store.cc
index 160e18c..970cefe 100644
--- a/key_file_store.cc
+++ b/key_file_store.cc
@@ -30,7 +30,7 @@
 KeyFileStore::KeyFileStore(GLib *glib)
     : glib_(glib),
       crypto_(glib),
-      key_file_(NULL) {}
+      key_file_(nullptr) {}
 
 KeyFileStore::~KeyFileStore() {
   ReleaseKeyFile();
@@ -39,7 +39,7 @@
 void KeyFileStore::ReleaseKeyFile() {
   if (key_file_) {
     glib_->KeyFileFree(key_file_);
-    key_file_ = NULL;
+    key_file_ = nullptr;
   }
 }
 
@@ -57,7 +57,7 @@
     LOG(INFO) << "Creating a new key file at " << path_.value();
     return true;
   }
-  GError *error = NULL;
+  GError *error = nullptr;
   if (glib_->KeyFileLoadFromFile(
           key_file_,
           path_.value().c_str(),
@@ -80,7 +80,7 @@
 
 bool KeyFileStore::Flush() {
   CHECK(key_file_);
-  GError *error = NULL;
+  GError *error = nullptr;
   gsize length = 0;
   gchar *data = glib_->KeyFileToData(key_file_, &length, &error);
 
@@ -139,7 +139,7 @@
   set<string> groups = GetGroups();
   set<string> groups_with_key;
   for (const auto &group : groups) {
-    if (glib_->KeyFileHasKey(key_file_, group.c_str(), key.c_str(), NULL)) {
+    if (glib_->KeyFileHasKey(key_file_, group.c_str(), key.c_str(), nullptr)) {
       groups_with_key.insert(group);
     }
   }
@@ -165,7 +165,7 @@
 
 bool KeyFileStore::DeleteKey(const string &group, const string &key) {
   CHECK(key_file_);
-  GError *error = NULL;
+  GError *error = nullptr;
   glib_->KeyFileRemoveKey(key_file_, group.c_str(), key.c_str(), &error);
   if (error && error->code != G_KEY_FILE_ERROR_KEY_NOT_FOUND) {
     LOG(ERROR) << "Failed to delete (" << group << ":" << key << "): "
@@ -177,7 +177,7 @@
 
 bool KeyFileStore::DeleteGroup(const string &group) {
   CHECK(key_file_);
-  GError *error = NULL;
+  GError *error = nullptr;
   glib_->KeyFileRemoveGroup(key_file_, group.c_str(), &error);
   if (error && error->code != G_KEY_FILE_ERROR_GROUP_NOT_FOUND) {
     LOG(ERROR) << "Failed to delete group " << group << ": "
@@ -188,8 +188,8 @@
 }
 
 bool KeyFileStore::SetHeader(const string &header) {
-  GError *error = NULL;
-  glib_->KeyFileSetComment(key_file_, NULL, NULL, header.c_str(), &error);
+  GError *error = nullptr;
+  glib_->KeyFileSetComment(key_file_, nullptr, nullptr, header.c_str(), &error);
   if (error) {
     LOG(ERROR) << "Failed to to set header: "
                << glib_->ConvertErrorToMessage(error);
@@ -202,7 +202,7 @@
                              const string &key,
                              string *value) const {
   CHECK(key_file_);
-  GError *error = NULL;
+  GError *error = nullptr;
   gchar *data =
       glib_->KeyFileGetString(key_file_, group.c_str(), key.c_str(), &error);
   if (!data) {
@@ -230,7 +230,7 @@
                            const string &key,
                            bool *value) const {
   CHECK(key_file_);
-  GError *error = NULL;
+  GError *error = nullptr;
   gboolean data =
       glib_->KeyFileGetBoolean(key_file_, group.c_str(), key.c_str(), &error);
   if (error) {
@@ -257,7 +257,7 @@
 bool KeyFileStore::GetInt(
     const string &group, const string &key, int *value) const {
   CHECK(key_file_);
-  GError *error = NULL;
+  GError *error = nullptr;
   gint data =
       glib_->KeyFileGetInteger(key_file_, group.c_str(), key.c_str(), &error);
   if (error) {
@@ -315,7 +315,7 @@
                                  vector<string> *value) const {
   CHECK(key_file_);
   gsize length = 0;
-  GError *error = NULL;
+  GError *error = nullptr;
   gchar **data = glib_->KeyFileGetStringList(key_file_,
                                              group.c_str(),
                                              key.c_str(),
diff --git a/key_file_store_unittest.cc b/key_file_store_unittest.cc
index 831cf05..6945d7b 100644
--- a/key_file_store_unittest.cc
+++ b/key_file_store_unittest.cc
@@ -322,7 +322,7 @@
   EXPECT_EQ(kValue, value);
   EXPECT_FALSE(store_.GetString("something-else", kKey, &value));
   EXPECT_FALSE(store_.GetString(kGroup, "bar", &value));
-  EXPECT_TRUE(store_.GetString(kGroup, kKey, NULL));
+  EXPECT_TRUE(store_.GetString(kGroup, kKey, nullptr));
   ASSERT_TRUE(store_.Close());
 }
 
@@ -370,7 +370,7 @@
     EXPECT_FALSE(store_.GetBool(kGroup, "unknown", &value));
     EXPECT_FALSE(store_.GetBool("unknown", kKeyTrue, &value));
   }
-  EXPECT_TRUE(store_.GetBool(kGroup, kKeyFalse, NULL));
+  EXPECT_TRUE(store_.GetBool(kGroup, kKeyFalse, nullptr));
   ASSERT_TRUE(store_.Close());
 }
 
@@ -422,7 +422,7 @@
     EXPECT_FALSE(store_.GetInt(kGroup, "invalid", &value));
     EXPECT_FALSE(store_.GetInt("invalid", kKeyPos, &value));
   }
-  EXPECT_TRUE(store_.GetInt(kGroup, kKeyPos, NULL));
+  EXPECT_TRUE(store_.GetInt(kGroup, kKeyPos, nullptr));
   ASSERT_TRUE(store_.Close());
 }
 
@@ -471,7 +471,7 @@
     EXPECT_FALSE(store_.GetUint64(kGroup, "invalid", &value));
     EXPECT_FALSE(store_.GetUint64("invalid", kKeyGood, &value));
   }
-  EXPECT_TRUE(store_.GetUint64(kGroup, kKeyGood, NULL));
+  EXPECT_TRUE(store_.GetUint64(kGroup, kKeyGood, nullptr));
   ASSERT_TRUE(store_.Close());
 }
 
@@ -542,7 +542,7 @@
 
   EXPECT_FALSE(store_.GetStringList("unknown-string-lists", kKeyEmpty, &value));
   EXPECT_FALSE(store_.GetStringList(kGroup, "some-key", &value));
-  EXPECT_TRUE(store_.GetStringList(kGroup, kKeyValues, NULL));
+  EXPECT_TRUE(store_.GetStringList(kGroup, kKeyValues, nullptr));
   ASSERT_TRUE(store_.Close());
 }
 
@@ -615,7 +615,7 @@
   EXPECT_EQ(kPlainText, value);
   EXPECT_FALSE(store_.GetCryptedString("something-else", kKey, &value));
   EXPECT_FALSE(store_.GetCryptedString(kGroup, "non-secret", &value));
-  EXPECT_TRUE(store_.GetCryptedString(kGroup, kKey, NULL));
+  EXPECT_TRUE(store_.GetCryptedString(kGroup, kKey, nullptr));
   ASSERT_TRUE(store_.Close());
 }
 
diff --git a/link_monitor_unittest.cc b/link_monitor_unittest.cc
index 4c2fa4a..70de8e8 100644
--- a/link_monitor_unittest.cc
+++ b/link_monitor_unittest.cc
@@ -109,14 +109,10 @@
  public:
   LinkMonitorTest()
       : metrics_(&dispatcher_),
-        device_info_(
-            &control_,
-            reinterpret_cast<EventDispatcher*>(NULL),
-            reinterpret_cast<Metrics*>(NULL),
-            reinterpret_cast<Manager*>(NULL)),
+        device_info_(&control_, nullptr, nullptr, nullptr),
         connection_(new StrictMock<MockConnection>(&device_info_)),
         monitor_(connection_, &dispatcher_, &metrics_, &device_info_),
-        client_(NULL),
+        client_(nullptr),
         next_client_(new StrictMock<MockArpClient>()),
         gateway_ip_(IPAddress::kFamilyIPv4),
         local_ip_(IPAddress::kFamilyIPv4),
diff --git a/manager.cc b/manager.cc
index b09921f..d6c0d3c 100644
--- a/manager.cc
+++ b/manager.cc
@@ -131,7 +131,7 @@
       health_checker_remote_ips_(new IPAddressStore()) {
   HelpRegisterDerivedString(kActiveProfileProperty,
                             &Manager::GetActiveProfileRpcIdentifier,
-                            NULL);
+                            nullptr);
   store_.RegisterBool(kArpGatewayProperty, &props_.arp_gateway);
   HelpRegisterConstDerivedStrings(kAvailableTechnologiesProperty,
                                   &Manager::AvailableTechnologies);
@@ -144,7 +144,7 @@
   store_.RegisterString(kCountryProperty, &props_.country);
   HelpRegisterDerivedString(kDefaultTechnologyProperty,
                             &Manager::DefaultTechnology,
-                            NULL);
+                            nullptr);
   HelpRegisterConstDerivedRpcIdentifier(
       kDefaultServiceProperty, &Manager::GetDefaultServiceRpcIdentifier);
   HelpRegisterConstDerivedRpcIdentifiers(kDevicesProperty,
@@ -170,7 +170,7 @@
   store_.RegisterString(kHostNameProperty, &props_.host_name);
   HelpRegisterDerivedString(kStateProperty,
                             &Manager::CalculateState,
-                            NULL);
+                            nullptr);
   HelpRegisterConstDerivedRpcIdentifiers(kServicesProperty,
                                          &Manager::EnumerateAvailableServices);
   HelpRegisterConstDerivedRpcIdentifiers(kServiceCompleteListProperty,
@@ -287,15 +287,15 @@
   // The default profile may fail to initialize if it's corrupted.
   // If so, recreate the default profile.
   if (!default_profile->InitStorage(
-      glib_, Profile::kCreateOrOpenExisting, NULL))
+      glib_, Profile::kCreateOrOpenExisting, nullptr))
     CHECK(default_profile->InitStorage(glib_, Profile::kCreateNew,
-                                       NULL));
+                                       nullptr));
   // In case we created a new profile, initialize its default values,
   // and then save. This is required for properties such as
   // PortalDetector::kDefaultCheckPortalList to be initialized correctly.
   LoadProperties(default_profile);
   default_profile->Save();
-  default_profile = NULL;  // PushProfileInternal will re-create.
+  default_profile = nullptr;  // PushProfileInternal will re-create.
 
   // Read list of user profiles. This must be done before pushing the
   // default profile, because modifying the profile stack updates the
@@ -403,7 +403,7 @@
                                            storage_path_,
                                            ident.identifier,
                                            props_));
-    if (!default_profile->InitStorage(glib_, Profile::kOpenExisting, NULL)) {
+    if (!default_profile->InitStorage(glib_, Profile::kOpenExisting, nullptr)) {
       LOG(ERROR) << "Failed to open default profile.";
       // Try to continue anyway, so that we can be useful in cases
       // where the disk is full.
@@ -677,7 +677,7 @@
     error->Populate(Error::kNotFound, error_string);
   }
   SLOG(Manager, 2) << error_string;
-  return NULL;
+  return nullptr;
 }
 
 ServiceRefPtr Manager::GetServiceWithGUID(
@@ -695,14 +695,14 @@
     error->Populate(Error::kNotFound, error_string);
   }
   SLOG(Manager, 2) << error_string;
-  return NULL;
+  return nullptr;
 }
 
 ServiceRefPtr Manager::GetDefaultService() const {
   SLOG(Manager, 2) << __func__;
   if (services_.empty() || !services_[0]->connection().get()) {
     SLOG(Manager, 2) << "In " << __func__ << ": No default connection exists.";
-    return NULL;
+    return nullptr;
   }
   return services_[0];
 }
@@ -727,7 +727,7 @@
 }
 
 bool Manager::IsPortalDetectionEnabled(Technology::Identifier tech) {
-  return IsTechnologyInList(GetCheckPortalList(NULL), tech);
+  return IsTechnologyInList(GetCheckPortalList(nullptr), tech);
 }
 
 void Manager::SetStartupPortalList(const string &portal_list) {
@@ -777,7 +777,7 @@
       return device;
     }
   }
-  return NULL;
+  return nullptr;
 }
 
 const ProfileRefPtr &Manager::ActiveProfile() const {
@@ -809,7 +809,7 @@
       return profile;
     }
   }
-  return NULL;
+  return nullptr;
 }
 
 void Manager::SetProfileForService(const ServiceRefPtr &to_set,
@@ -842,7 +842,7 @@
                                            bool enabled_state,
                                            Error *error,
                                            const ResultCallback &callback) {
-  CHECK(error != NULL);
+  CHECK(error);
   DCHECK(error->IsOngoing());
   Technology::Identifier id = Technology::IdentifierFromName(technology_name);
   if (id == Technology::kUnknown) {
@@ -993,7 +993,7 @@
           << "Service " << (*it)->unique_name()
           << " still has a connection (in call to " << __func__ << ")";
       (*it)->Unload();
-      (*it)->SetProfile(NULL);
+      (*it)->SetProfile(nullptr);
       services_.erase(it);
       SortServices();
       return;
@@ -1007,7 +1007,7 @@
   }
 
   DCHECK(!(**service_iterator)->connection());
-  (**service_iterator)->SetProfile(NULL);
+  (**service_iterator)->SetProfile(nullptr);
   *service_iterator = services_.erase(*service_iterator);
 
   return true;
@@ -1071,7 +1071,7 @@
 
 void Manager::LoadProperties(const scoped_refptr<DefaultProfile> &profile) {
   profile->LoadManagerProperties(&props_);
-  SetIgnoredDNSSearchPaths(props_.ignored_dns_search_paths, NULL);
+  SetIgnoredDNSSearchPaths(props_.ignored_dns_search_paths, nullptr);
 }
 
 void Manager::AddTerminationAction(const string &name,
@@ -1237,7 +1237,7 @@
 }
 
 void Manager::EmitDefaultService() {
-  RpcIdentifier rpc_identifier = GetDefaultServiceRpcIdentifier(NULL);
+  RpcIdentifier rpc_identifier = GetDefaultServiceRpcIdentifier(nullptr);
   if (rpc_identifier != default_service_rpc_identifier_) {
     adaptor_->EmitRpcIdentifierChanged(kDefaultServiceProperty, rpc_identifier);
     default_service_rpc_identifier_ = rpc_identifier;
@@ -1300,7 +1300,7 @@
     if (name == service->unique_name())
       return service;
   }
-  return NULL;
+  return nullptr;
 }
 
 void Manager::HelpRegisterConstDerivedRpcIdentifier(
@@ -1309,7 +1309,7 @@
   store_.RegisterDerivedRpcIdentifier(
       name,
       RpcIdentifierAccessor(
-          new CustomAccessor<Manager, RpcIdentifier>(this, get, NULL)));
+          new CustomAccessor<Manager, RpcIdentifier>(this, get, nullptr)));
 }
 
 void Manager::HelpRegisterConstDerivedRpcIdentifiers(
@@ -1318,7 +1318,7 @@
   store_.RegisterDerivedRpcIdentifiers(
       name,
       RpcIdentifiersAccessor(
-          new CustomAccessor<Manager, RpcIdentifiers>(this, get, NULL)));
+          new CustomAccessor<Manager, RpcIdentifiers>(this, get, nullptr)));
 }
 
 void Manager::HelpRegisterDerivedString(
@@ -1334,8 +1334,8 @@
     const string &name,
     Strings(Manager::*get)(Error *)) {
   store_.RegisterDerivedStrings(
-      name,
-      StringsAccessor(new CustomAccessor<Manager, Strings>(this, get, NULL)));
+      name, StringsAccessor(
+                new CustomAccessor<Manager, Strings>(this, get, nullptr)));
 }
 
 void Manager::HelpRegisterDerivedBool(
@@ -1344,7 +1344,7 @@
     bool(Manager::*set)(const bool&, Error *)) {
   store_.RegisterDerivedBool(
       name,
-      BoolAccessor(new CustomAccessor<Manager, bool>(this, get, set, NULL)));
+      BoolAccessor(new CustomAccessor<Manager, bool>(this, get, set, nullptr)));
 }
 
 void Manager::SortServices() {
@@ -1390,17 +1390,17 @@
                   << default_service->unique_name();
       }
     } else {
-      default_service = NULL;
+      default_service = nullptr;
     }
   }
 
   Error error;
   adaptor_->EmitRpcIdentifierArrayChanged(kServiceCompleteListProperty,
-                                          EnumerateCompleteServices(NULL));
+                                          EnumerateCompleteServices(nullptr));
   adaptor_->EmitRpcIdentifierArrayChanged(kServicesProperty,
-                                          EnumerateAvailableServices(NULL));
+                                          EnumerateAvailableServices(nullptr));
   adaptor_->EmitRpcIdentifierArrayChanged(kServiceWatchListProperty,
-                                          EnumerateWatchedServices(NULL));
+                                          EnumerateWatchedServices(nullptr));
   adaptor_->EmitStringsChanged(kConnectedTechnologiesProperty,
                                ConnectedTechnologies(&error));
   adaptor_->EmitStringChanged(kDefaultTechnologyProperty,
@@ -1480,7 +1480,7 @@
     SLOG(Manager, 4) << "Sorted service list for AutoConnect: ";
     for (size_t i = 0; i < services_.size(); ++i) {
       ServiceRefPtr service = services_[i];
-      const char *compare_reason = NULL;
+      const char *compare_reason = nullptr;
       if (i + 1 < services_.size()) {
         const bool kCompareConnectivityState = true;
         Service::Compare(
@@ -1573,7 +1573,7 @@
     SLOG(Manager, 4) << "Sorted service list for ConnectToBestServicesTask: ";
     for (size_t i = 0; i < services_copy.size(); ++i) {
       ServiceRefPtr service = services_copy[i];
-      const char *compare_reason = NULL;
+      const char *compare_reason = nullptr;
       if (i + 1 < services_copy.size()) {
         if (!service->connectable()) {
           // Due to service sort order, it is guaranteed that no services beyond
@@ -1742,7 +1742,7 @@
 RpcIdentifiers Manager::EnumerateWatchedServices(Error */*error*/) {
   RpcIdentifiers service_rpc_ids;
   for (const auto &service : services_) {
-    if (service->IsVisible() && service->IsActive(NULL)) {
+    if (service->IsVisible() && service->IsActive(nullptr)) {
       service_rpc_ids.push_back(service->GetRpcIdentifier());
     }
   }
@@ -1809,7 +1809,7 @@
   if (args.ContainsString(kGuidProperty)) {
     SLOG(Manager, 2) << __func__ << ": searching by GUID";
     ServiceRefPtr service =
-        GetServiceWithGUID(args.GetString(kGuidProperty), NULL);
+        GetServiceWithGUID(args.GetString(kGuidProperty), nullptr);
     if (service) {
       return service;
     }
@@ -1817,7 +1817,7 @@
 
   if (!args.ContainsString(kTypeProperty)) {
     Error::PopulateAndLog(error, Error::kInvalidArguments, kErrorTypeRequired);
-    return NULL;
+    return nullptr;
   }
 
   string type = args.GetString(kTypeProperty);
@@ -1825,7 +1825,7 @@
   if (!ContainsKey(providers_, technology)) {
     Error::PopulateAndLog(error, Error::kNotSupported,
                           kErrorUnsupportedServiceType);
-    return NULL;
+    return nullptr;
   }
 
   SLOG(Manager, 2) << __func__ << ": getting " << type << " Service";
@@ -1843,14 +1843,14 @@
     if (!profile) {
       Error::PopulateAndLog(error, Error::kInvalidArguments,
                             "Invalid profile name " + profile_rpcid);
-      return NULL;
+      return nullptr;
     }
   }
 
   ServiceRefPtr service = GetServiceInner(args, error);
   if (error->IsFailure() || !service) {
     LOG(ERROR) << "GetService failed; returning upstream error.";
-    return NULL;
+    return nullptr;
   }
 
   // First pull in any stored configuration associated with the service.
@@ -1878,7 +1878,7 @@
   if (!profile->UpdateService(service)) {
     Error::PopulateAndLog(error, Error::kInternalError,
                           "Unable to save service to profile");
-    return NULL;
+    return nullptr;
   }
 
   if (HasService(service)) {
@@ -1907,7 +1907,7 @@
     const string &profile_rpcid, const KeyValueStore &args, Error *error) {
   if (!args.ContainsString(kTypeProperty)) {
     Error::PopulateAndLog(error, Error::kInvalidArguments, kErrorTypeRequired);
-    return NULL;
+    return nullptr;
   }
 
   string type = args.GetString(kTypeProperty);
@@ -1916,7 +1916,7 @@
   if (!ContainsKey(providers_, technology)) {
     Error::PopulateAndLog(error, Error::kNotSupported,
                           kErrorUnsupportedServiceType);
-    return NULL;
+    return nullptr;
   }
 
   ProviderInterface *provider = providers_[technology];
@@ -1925,24 +1925,24 @@
   if (!profile) {
     Error::PopulateAndLog(error, Error::kNotFound,
                           "Profile specified was not found");
-    return NULL;
+    return nullptr;
   }
   if (args.LookupString(kProfileProperty, profile_rpcid) != profile_rpcid) {
     Error::PopulateAndLog(error, Error::kInvalidArguments,
                           "Profile argument does not match that in "
                           "the configuration arguments");
-    return NULL;
+    return nullptr;
   }
 
   ServiceRefPtr service;
   if (args.ContainsString(kGuidProperty)) {
     SLOG(Manager, 2) << __func__ << ": searching by GUID";
-    service = GetServiceWithGUID(args.GetString(kGuidProperty), NULL);
+    service = GetServiceWithGUID(args.GetString(kGuidProperty), nullptr);
     if (service && service->technology() != technology) {
       Error::PopulateAndLog(error, Error::kNotSupported,
                             StringPrintf("This GUID matches a non-%s service",
                                          type.c_str()));
-      return NULL;
+      return nullptr;
     }
   }
 
@@ -1983,7 +1983,7 @@
   if (!service || !error->IsSuccess()) {
     // Service::CreateTemporaryService() failed, and has set the error
     // appropriately.
-    return NULL;
+    return nullptr;
   }
 
   // The profile may already have configuration for this service.
@@ -1994,7 +1994,7 @@
   // Although we have succeeded, this service will not exist, so its
   // path is of no use to the caller.
   DCHECK(service->HasOneRef());
-  return NULL;
+  return nullptr;
 }
 
 void Manager::SetupServiceInProfile(ServiceRefPtr service,
@@ -2014,7 +2014,7 @@
     }
   }
   error->Populate(Error::kNotFound, "Matching service was not found");
-  return NULL;
+  return nullptr;
 }
 
 void Manager::AddWakeOnPacketConnection(const string &ip_endpoint,
diff --git a/manager_dbus_adaptor.cc b/manager_dbus_adaptor.cc
index aba8076..9a66e9e 100644
--- a/manager_dbus_adaptor.cc
+++ b/manager_dbus_adaptor.cc
@@ -34,7 +34,7 @@
 }
 
 ManagerDBusAdaptor::~ManagerDBusAdaptor() {
-  manager_ = NULL;
+  manager_ = nullptr;
 }
 
 void ManagerDBusAdaptor::UpdateRunning() {}
@@ -113,7 +113,7 @@
 
 string ManagerDBusAdaptor::GetState(DBus::Error &/*error*/) {  // NOLINT
   SLOG(DBus, 2) << __func__;
-  return manager_->CalculateState(NULL);
+  return manager_->CalculateState(nullptr);
 }
 
 DBus::Path ManagerDBusAdaptor::CreateProfile(const string &name,
diff --git a/manager_unittest.cc b/manager_unittest.cc
index 766ab32..c3a4596 100644
--- a/manager_unittest.cc
+++ b/manager_unittest.cc
@@ -86,17 +86,16 @@
 class ManagerTest : public PropertyStoreTest {
  public:
   ManagerTest()
-      : power_manager_(new MockPowerManager(NULL, &proxy_factory_)),
-        device_info_(new NiceMock<MockDeviceInfo>(
-            control_interface(),
-            reinterpret_cast<EventDispatcher*>(NULL),
-            reinterpret_cast<Metrics*>(NULL),
-            reinterpret_cast<Manager*>(NULL))),
+      : power_manager_(new MockPowerManager(nullptr, &proxy_factory_)),
+        device_info_(new NiceMock<MockDeviceInfo>(control_interface(),
+                                                  nullptr,
+                                                  nullptr,
+                                                  nullptr)),
         manager_adaptor_(new NiceMock<ManagerMockAdaptor>()),
         ethernet_eap_provider_(new NiceMock<MockEthernetEapProvider>()),
         wifi_provider_(new NiceMock<MockWiFiProvider>()),
-        crypto_util_proxy_(new NiceMock<MockCryptoUtilProxy>(dispatcher(),
-                                                             glib())) {
+        crypto_util_proxy_(
+            new NiceMock<MockCryptoUtilProxy>(dispatcher(), glib())) {
     ON_CALL(proxy_factory_, CreatePowerManagerProxy(_))
         .WillByDefault(ReturnNull());
 
@@ -187,7 +186,7 @@
     scoped_ptr<KeyFileStore> storage(new KeyFileStore(glib));
     storage->set_path(final_path);
     if (!storage->Open())
-      return NULL;
+      return nullptr;
     Profile *profile(new Profile(control_interface(),
                                  metrics(),
                                  manager,
@@ -278,7 +277,7 @@
   }
 
   RpcIdentifier GetDefaultServiceRpcIdentifier() {
-    return manager()->GetDefaultServiceRpcIdentifier(NULL);
+    return manager()->GetDefaultServiceRpcIdentifier(nullptr);
   }
 
   void SetResolver(Resolver *resolver) {
@@ -300,7 +299,7 @@
   WiFiServiceRefPtr ReleaseTempMockService() {
     // Take a reference to hold during this function.
     WiFiServiceRefPtr temp_service = temp_mock_service_;
-    temp_mock_service_ = NULL;
+    temp_mock_service_ = nullptr;
     return temp_service;
   }
 
@@ -323,7 +322,7 @@
    public:
     static const char kActionName[];
 
-    TerminationActionTest() : manager_(NULL) {}
+    TerminationActionTest() : manager_(nullptr) {}
     virtual ~TerminationActionTest() {}
 
     MOCK_METHOD1(Done, void(const Error &error));
@@ -389,11 +388,11 @@
   }
 
   vector<string> EnumerateAvailableServices() {
-    return manager()->EnumerateAvailableServices(NULL);
+    return manager()->EnumerateAvailableServices(nullptr);
   }
 
   vector<string> EnumerateWatchedServices() {
-    return manager()->EnumerateWatchedServices(NULL);
+    return manager()->EnumerateWatchedServices(nullptr);
   }
 
   MockServiceRefPtr MakeAutoConnectableService() {
@@ -563,8 +562,8 @@
   EXPECT_TRUE(ContainsKey(ids, mock_service->GetRpcIdentifier()));
   EXPECT_TRUE(ContainsKey(ids, mock_service2->GetRpcIdentifier()));
 
-  EXPECT_TRUE(manager.FindService(service1_name).get() != NULL);
-  EXPECT_TRUE(manager.FindService(service2_name).get() != NULL);
+  EXPECT_NE(nullptr, manager.FindService(service1_name).get());
+  EXPECT_NE(nullptr, manager.FindService(service2_name).get());
 
   manager.set_power_manager(power_manager_.release());
   manager.Stop();
@@ -744,7 +743,7 @@
 
   // Force destruction of the original Profile, to ensure that the Service
   // is kept alive and populated with data.
-  profile = NULL;
+  profile = nullptr;
   ASSERT_TRUE(manager.ActiveProfile()->ContainsService(s2));
   manager.set_power_manager(power_manager_.release());
   manager.Stop();
@@ -1308,7 +1307,7 @@
                                 metrics(),
                                 manager()));
 
-  EXPECT_CALL(*metrics(), NotifyDefaultServiceChanged(NULL))
+  EXPECT_CALL(*metrics(), NotifyDefaultServiceChanged(nullptr))
       .Times(4);  // Once for each registration.
 
   string entry_name("entry_name");
@@ -1399,7 +1398,7 @@
                                 metrics(),
                                 manager()));
 
-  EXPECT_CALL(*metrics(), NotifyDefaultServiceChanged(NULL))
+  EXPECT_CALL(*metrics(), NotifyDefaultServiceChanged(nullptr))
       .Times(5);  // Once for each registration, and one after profile pop.
 
   manager()->RegisterService(s_will_remove0);
@@ -1801,7 +1800,7 @@
   Error error;
   manager()->ConfigureService(args, &error);
   EXPECT_TRUE(error.IsSuccess());
-  service->set_profile(NULL);  // Breaks refcounting loop.
+  service->set_profile(nullptr);  // Breaks refcounting loop.
 }
 
 // If we configure a service that is already a member of the specified
@@ -1849,7 +1848,7 @@
   Error error;
   manager()->ConfigureService(args, &error);
   EXPECT_TRUE(error.IsSuccess());
-  service->set_profile(NULL);  // Breaks refcounting loop.
+  service->set_profile(nullptr);  // Breaks refcounting loop.
 }
 
 // An unregistered service should remain unregistered, but its contents should
@@ -1911,7 +1910,7 @@
       manager()->ConfigureServiceForProfile("", args, &error);
   EXPECT_EQ(Error::kInvalidArguments, error.type());
   EXPECT_EQ("must specify service type", error.message());
-  EXPECT_EQ(NULL, service.get());
+  EXPECT_EQ(nullptr, service.get());
 }
 
 TEST_F(ManagerTest, ConfigureServiceForProfileWithWrongType) {
@@ -1922,7 +1921,7 @@
       manager()->ConfigureServiceForProfile("", args, &error);
   EXPECT_EQ(Error::kNotSupported, error.type());
   EXPECT_EQ("service type is unsupported", error.message());
-  EXPECT_EQ(NULL, service.get());
+  EXPECT_EQ(nullptr, service.get());
 }
 
 TEST_F(ManagerTest, ConfigureServiceForProfileWithMissingProfile) {
@@ -1933,7 +1932,7 @@
       manager()->ConfigureServiceForProfile("/profile/foo", args, &error);
   EXPECT_EQ(Error::kNotFound, error.type());
   EXPECT_EQ("Profile specified was not found", error.message());
-  EXPECT_EQ(NULL, service.get());
+  EXPECT_EQ(nullptr, service.get());
 }
 
 TEST_F(ManagerTest, ConfigureServiceForProfileWithProfileMismatch) {
@@ -1951,7 +1950,7 @@
   EXPECT_EQ(Error::kInvalidArguments, error.type());
   EXPECT_EQ("Profile argument does not match that in "
             "the configuration arguments", error.message());
-  EXPECT_EQ(NULL, service.get());
+  EXPECT_EQ(nullptr, service.get());
 }
 
 TEST_F(ManagerTest,
@@ -1972,7 +1971,7 @@
       manager()->ConfigureServiceForProfile(kProfileName0, args, &error);
   // Since we didn't set the error in the GetService expectation above...
   EXPECT_TRUE(error.IsSuccess());
-  EXPECT_EQ(NULL, service.get());
+  EXPECT_EQ(nullptr, service.get());
 }
 
 TEST_F(ManagerTest, ConfigureServiceForProfileCreateNewService) {
@@ -2005,7 +2004,7 @@
       manager()->ConfigureServiceForProfile(kProfileName0, args, &error);
   EXPECT_TRUE(error.IsSuccess());
   EXPECT_EQ(mock_service.get(), service.get());
-  mock_service->set_profile(NULL);  // Breaks reference cycle.
+  mock_service->set_profile(nullptr);  // Breaks reference cycle.
 }
 
 TEST_F(ManagerTest, ConfigureServiceForProfileMatchingServiceByGUID) {
@@ -2015,7 +2014,7 @@
                                 metrics(),
                                 manager()));
   const string kGUID = "a guid";
-  mock_service->SetGuid(kGUID, NULL);
+  mock_service->SetGuid(kGUID, nullptr);
   manager()->RegisterService(mock_service);
   ServiceRefPtr mock_service_generic(mock_service.get());
 
@@ -2042,7 +2041,7 @@
     Error error;
     ServiceRefPtr service =
         manager()->ConfigureServiceForProfile(kProfileName, args, &error);
-    EXPECT_EQ(NULL, service.get());
+    EXPECT_EQ(nullptr, service.get());
     EXPECT_EQ(Error::kNotSupported, error.type());
     EXPECT_EQ("This GUID matches a non-wifi service", error.message());
   }
@@ -2058,7 +2057,7 @@
     EXPECT_EQ(mock_service.get(), service.get());
     EXPECT_EQ(profile.get(), service->profile().get());
   }
-  mock_service->set_profile(NULL);  // Breaks reference cycle.
+  mock_service->set_profile(nullptr);  // Breaks reference cycle.
 }
 
 TEST_F(ManagerTest, ConfigureServiceForProfileMatchingServiceAndProfile) {
@@ -2094,7 +2093,7 @@
   EXPECT_TRUE(error.IsSuccess());
   EXPECT_EQ(mock_service.get(), service.get());
   EXPECT_EQ(profile.get(), service->profile().get());
-  mock_service->set_profile(NULL);  // Breaks reference cycle.
+  mock_service->set_profile(nullptr);  // Breaks reference cycle.
 }
 
 TEST_F(ManagerTest, ConfigureServiceForProfileMatchingServiceEphemeralProfile) {
@@ -2129,7 +2128,7 @@
   EXPECT_TRUE(error.IsSuccess());
   EXPECT_EQ(mock_service.get(), service.get());
   EXPECT_EQ(profile.get(), service->profile().get());
-  mock_service->set_profile(NULL);  // Breaks reference cycle.
+  mock_service->set_profile(nullptr);  // Breaks reference cycle.
 }
 
 TEST_F(ManagerTest, ConfigureServiceForProfileMatchingServicePrecedingProfile) {
@@ -2173,7 +2172,7 @@
       manager()->ConfigureServiceForProfile(kProfileName1, args, &error);
   EXPECT_TRUE(error.IsSuccess());
   EXPECT_EQ(mock_service.get(), service.get());
-  mock_service->set_profile(NULL);  // Breaks reference cycle.
+  mock_service->set_profile(nullptr);  // Breaks reference cycle.
 }
 
 TEST_F(ManagerTest,
@@ -2234,7 +2233,7 @@
   ServiceRefPtr service =
       manager()->ConfigureServiceForProfile(kProfileName0, args, &error);
   EXPECT_TRUE(error.IsSuccess());
-  EXPECT_EQ(NULL, service.get());
+  EXPECT_EQ(nullptr, service.get());
   EXPECT_EQ(profile1.get(), matching_service->profile().get());
 }
 
@@ -2381,7 +2380,7 @@
   EXPECT_TRUE(ServiceOrderIs(mock_service2, mock_service10));
 
   // Priority.
-  mock_service2->SetPriority(1, NULL);
+  mock_service2->SetPriority(1, nullptr);
   manager()->UpdateService(mock_service2);
   EXPECT_TRUE(ServiceOrderIs(mock_service2, mock_service10));
 
@@ -2546,9 +2545,9 @@
       new NiceMock<MockConnection>(device_info_.get()));
 
   // A single registered Service, without a connection.  The
-  // DefaultService should be NULL.  If a change notification is
+  // DefaultService should be nullptr.  If a change notification is
   // generated, it should reference kNullPath.
-  EXPECT_CALL(mock_metrics, NotifyDefaultServiceChanged(NULL));
+  EXPECT_CALL(mock_metrics, NotifyDefaultServiceChanged(nullptr));
   EXPECT_CALL(*manager_adaptor_,
               EmitRpcIdentifierChanged(kDefaultServiceProperty,
                                        DBusAdaptor::kNullPath))
@@ -2559,7 +2558,7 @@
   // Adding another Service, also without a connection, does not
   // change DefaultService.  Furthermore, we do not send a change
   // notification for DefaultService.
-  EXPECT_CALL(mock_metrics, NotifyDefaultServiceChanged(NULL));
+  EXPECT_CALL(mock_metrics, NotifyDefaultServiceChanged(nullptr));
   EXPECT_CALL(*manager_adaptor_,
               EmitRpcIdentifierChanged(kDefaultServiceProperty, _))
       .Times(0);
@@ -2568,7 +2567,7 @@
 
   // An explicit sort doesn't change anything, and does not emit a
   // change notification for DefaultService.
-  EXPECT_CALL(mock_metrics, NotifyDefaultServiceChanged(NULL));
+  EXPECT_CALL(mock_metrics, NotifyDefaultServiceChanged(nullptr));
   EXPECT_CALL(*manager_adaptor_,
               EmitRpcIdentifierChanged(kDefaultServiceProperty, _))
       .Times(0);
@@ -2578,8 +2577,8 @@
   // Re-ordering the unconnected Services doesn't change
   // DefaultService, and (hence) does not emit a change notification
   // for DefaultService.
-  mock_service1->SetPriority(1, NULL);
-  EXPECT_CALL(mock_metrics, NotifyDefaultServiceChanged(NULL));
+  mock_service1->SetPriority(1, nullptr);
+  EXPECT_CALL(mock_metrics, NotifyDefaultServiceChanged(nullptr));
   EXPECT_CALL(*manager_adaptor_,
               EmitRpcIdentifierChanged(kDefaultServiceProperty, _))
       .Times(0);
@@ -2589,8 +2588,8 @@
   // Re-ordering the unconnected Services doesn't change
   // DefaultService, and (hence) does not emit a change notification
   // for DefaultService.
-  mock_service1->SetPriority(0, NULL);
-  EXPECT_CALL(mock_metrics, NotifyDefaultServiceChanged(NULL));
+  mock_service1->SetPriority(0, nullptr);
+  EXPECT_CALL(mock_metrics, NotifyDefaultServiceChanged(nullptr));
   EXPECT_CALL(*manager_adaptor_,
               EmitRpcIdentifierChanged(kDefaultServiceProperty, _))
       .Times(0);
@@ -2619,7 +2618,7 @@
 
   // Changing the ordering causes the DefaultService to change, and
   // appropriate notifications are sent.
-  mock_service1->SetPriority(1, NULL);
+  mock_service1->SetPriority(1, nullptr);
   EXPECT_CALL(*mock_connection0.get(), SetIsDefault(false));
   EXPECT_CALL(*mock_connection1.get(), SetIsDefault(true));
   EXPECT_CALL(service_watcher, OnDefaultServiceChanged(_));
@@ -2641,22 +2640,22 @@
   EXPECT_CALL(mock_metrics, NotifyDefaultServiceChanged(mock_service0.get()));
   EXPECT_CALL(*manager_adaptor_,
               EmitRpcIdentifierChanged(kDefaultServiceProperty, _));
-  mock_service1->set_mock_connection(NULL);  // So DeregisterService works.
+  mock_service1->set_mock_connection(nullptr);  // So DeregisterService works.
   manager()->DeregisterService(mock_service1);
   CompleteServiceSort();
 
   // Deregistering the only Service causes the DefaultService to become
-  // NULL.  Appropriate notifications are sent.
-  EXPECT_CALL(mock_metrics, NotifyDefaultServiceChanged(NULL));
+  // nullptr.  Appropriate notifications are sent.
+  EXPECT_CALL(mock_metrics, NotifyDefaultServiceChanged(nullptr));
   EXPECT_CALL(*manager_adaptor_,
               EmitRpcIdentifierChanged(kDefaultServiceProperty, _));
-  mock_service0->set_mock_connection(NULL);  // So DeregisterService works.
+  mock_service0->set_mock_connection(nullptr);  // So DeregisterService works.
   manager()->DeregisterService(mock_service0);
   CompleteServiceSort();
 
   // An explicit sort doesn't change anything, and does not generate
   // an external notification.
-  EXPECT_CALL(mock_metrics, NotifyDefaultServiceChanged(NULL));
+  EXPECT_CALL(mock_metrics, NotifyDefaultServiceChanged(nullptr));
   EXPECT_CALL(*manager_adaptor_,
               EmitRpcIdentifierChanged(kDefaultServiceProperty, _)).Times(0);
   manager()->SortServicesTask();
@@ -2675,7 +2674,7 @@
   ServiceRefPtr service = mock_service;
   ServiceRefPtr null_service;
 
-  EXPECT_CALL(mock_metrics, NotifyDefaultServiceChanged(NULL));
+  EXPECT_CALL(mock_metrics, NotifyDefaultServiceChanged(nullptr));
   manager()->NotifyDefaultServiceChanged(null_service);
 
   ServiceWatcher service_watcher1;
@@ -2693,7 +2692,7 @@
 
   EXPECT_CALL(service_watcher1, OnDefaultServiceChanged(null_service));
   EXPECT_CALL(service_watcher2, OnDefaultServiceChanged(null_service));
-  EXPECT_CALL(mock_metrics, NotifyDefaultServiceChanged(NULL));
+  EXPECT_CALL(mock_metrics, NotifyDefaultServiceChanged(nullptr));
   manager()->NotifyDefaultServiceChanged(null_service);
 
   EXPECT_CALL(service_watcher1, OnDefaultServiceChanged(service));
@@ -2954,7 +2953,7 @@
   EXPECT_TRUE(mock_service->retain_auto_connect());
   EXPECT_TRUE(mock_service->auto_connect());
   // This releases the ref on the mock profile.
-  mock_service->set_profile(NULL);
+  mock_service->set_profile(nullptr);
 }
 
 TEST_F(ManagerTest, SaveSuccessfulService) {
@@ -3031,9 +3030,9 @@
 
 TEST_F(ManagerTest, AutoConnectOnUpdate) {
   MockServiceRefPtr service1 = MakeAutoConnectableService();
-  service1->SetPriority(1, NULL);
+  service1->SetPriority(1, nullptr);
   MockServiceRefPtr service2 = MakeAutoConnectableService();
-  service2->SetPriority(2, NULL);
+  service2->SetPriority(2, nullptr);
   manager()->RegisterService(service1);
   manager()->RegisterService(service2);
   dispatcher()->DispatchPendingEvents();
@@ -3051,9 +3050,9 @@
 
 TEST_F(ManagerTest, AutoConnectOnDeregister) {
   MockServiceRefPtr service1 = MakeAutoConnectableService();
-  service1->SetPriority(1, NULL);
+  service1->SetPriority(1, nullptr);
   MockServiceRefPtr service2 = MakeAutoConnectableService();
-  service2->SetPriority(2, NULL);
+  service2->SetPriority(2, nullptr);
   manager()->RegisterService(service1);
   manager()->RegisterService(service2);
   dispatcher()->DispatchPendingEvents();
@@ -3182,7 +3181,7 @@
   manager()->RegisterDevice(mock_devices_[1]);
   manager()->RegisterDevice(mock_devices_[2]);
 
-  manager()->RecheckPortal(NULL);
+  manager()->RecheckPortal(nullptr);
 }
 
 TEST_F(ManagerTest, RecheckPortalOnService) {
@@ -3228,7 +3227,7 @@
   EXPECT_EQ(mock_service.get(), manager()->GetDefaultService().get());
   EXPECT_EQ(mock_service->GetRpcIdentifier(), GetDefaultServiceRpcIdentifier());
 
-  mock_service->set_mock_connection(NULL);
+  mock_service->set_mock_connection(nullptr);
   manager()->DeregisterService(mock_service);
 }
 
@@ -3273,8 +3272,8 @@
     EXPECT_FALSE(service);
   }
 
-  mock_service0->SetGuid(kGUID0, NULL);
-  mock_service1->SetGuid(kGUID1, NULL);
+  mock_service0->SetGuid(kGUID0, nullptr);
+  mock_service1->SetGuid(kGUID1, nullptr);
 
   {
     Error error;
@@ -3299,7 +3298,7 @@
 
 TEST_F(ManagerTest, CalculateStateOffline) {
   EXPECT_FALSE(manager()->IsConnected());
-  EXPECT_EQ("offline", manager()->CalculateState(NULL));
+  EXPECT_EQ("offline", manager()->CalculateState(nullptr));
 
   MockMetrics mock_metrics(dispatcher());
   SetMetrics(&mock_metrics);
@@ -3326,7 +3325,7 @@
   manager()->RegisterService(mock_service1);
 
   EXPECT_FALSE(manager()->IsConnected());
-  EXPECT_EQ("offline", manager()->CalculateState(NULL));
+  EXPECT_EQ("offline", manager()->CalculateState(nullptr));
 
   manager()->DeregisterService(mock_service0);
   manager()->DeregisterService(mock_service1);
@@ -3363,7 +3362,7 @@
   CompleteServiceSort();
 
   EXPECT_TRUE(manager()->IsConnected());
-  EXPECT_EQ("online", manager()->CalculateState(NULL));
+  EXPECT_EQ("online", manager()->CalculateState(nullptr));
 
   manager()->DeregisterService(mock_service0);
   manager()->DeregisterService(mock_service1);
@@ -3400,7 +3399,7 @@
   RefreshConnectionState();
   Mock::VerifyAndClearExpectations(manager_adaptor_);
 
-  mock_service->set_mock_connection(NULL);
+  mock_service->set_mock_connection(nullptr);
   manager()->DeregisterService(mock_service);
 }
 
@@ -3409,7 +3408,7 @@
   const string kProfileValue("wifi,vpn");
   manager()->props_.check_portal_list = kProfileValue;
 
-  EXPECT_EQ(kProfileValue, manager()->GetCheckPortalList(NULL));
+  EXPECT_EQ(kProfileValue, manager()->GetCheckPortalList(nullptr));
   EXPECT_TRUE(manager()->IsPortalDetectionEnabled(Technology::kWifi));
   EXPECT_FALSE(manager()->IsPortalDetectionEnabled(Technology::kCellular));
 
@@ -3420,7 +3419,7 @@
   EXPECT_EQ(kProfileValue, manager()->props_.check_portal_list);
 
   // However we should read back a different list.
-  EXPECT_EQ(kStartupValue, manager()->GetCheckPortalList(NULL));
+  EXPECT_EQ(kStartupValue, manager()->GetCheckPortalList(nullptr));
   EXPECT_FALSE(manager()->IsPortalDetectionEnabled(Technology::kWifi));
   EXPECT_TRUE(manager()->IsPortalDetectionEnabled(Technology::kCellular));
 
@@ -3433,7 +3432,7 @@
       kRuntimeValue,
       &error);
   ASSERT_TRUE(error.IsSuccess());
-  EXPECT_EQ(kRuntimeValue, manager()->GetCheckPortalList(NULL));
+  EXPECT_EQ(kRuntimeValue, manager()->GetCheckPortalList(nullptr));
   EXPECT_EQ(kRuntimeValue, manager()->props_.check_portal_list);
   EXPECT_FALSE(manager()->IsPortalDetectionEnabled(Technology::kCellular));
   EXPECT_TRUE(manager()->IsPortalDetectionEnabled(Technology::kPPP));
@@ -3568,19 +3567,19 @@
   const string kIgnored0 = "chromium.org";
   ignored_paths.push_back(kIgnored0);
   EXPECT_CALL(*resolver.get(), set_ignored_search_list(ignored_paths));
-  SetIgnoredDNSSearchPaths(kIgnored0, NULL);
+  SetIgnoredDNSSearchPaths(kIgnored0, nullptr);
   EXPECT_EQ(kIgnored0, GetIgnoredDNSSearchPaths());
 
   const string kIgnored1 = "google.com";
   const string kIgnoredSum = kIgnored0 + "," + kIgnored1;
   ignored_paths.push_back(kIgnored1);
   EXPECT_CALL(*resolver.get(), set_ignored_search_list(ignored_paths));
-  SetIgnoredDNSSearchPaths(kIgnoredSum, NULL);
+  SetIgnoredDNSSearchPaths(kIgnoredSum, nullptr);
   EXPECT_EQ(kIgnoredSum, GetIgnoredDNSSearchPaths());
 
   ignored_paths.clear();
   EXPECT_CALL(*resolver.get(), set_ignored_search_list(ignored_paths));
-  SetIgnoredDNSSearchPaths("", NULL);
+  SetIgnoredDNSSearchPaths("", nullptr);
   EXPECT_EQ("", GetIgnoredDNSSearchPaths());
 
   SetResolver(Resolver::GetInstance());
@@ -3810,7 +3809,7 @@
   EXPECT_CALL(*wimax_service.get(), Connect(_, _)).Times(0);  // Is connected.
   EXPECT_CALL(*vpn_service.get(), Connect(_, _)).Times(0);  // Not autoconnect.
 
-  manager()->ConnectToBestServices(NULL);
+  manager()->ConnectToBestServices(nullptr);
   dispatcher()->DispatchPendingEvents();
 
   // After this operation, since the Connect calls above are mocked and
@@ -3964,7 +3963,7 @@
   EXPECT_CALL(*eth_device.get(), StartConnectivityTest())
       .WillOnce(Return(true));
   EXPECT_CALL(*vpn_device.get(), StartConnectivityTest()).Times(0);
-  manager()->CreateConnectivityReport(NULL);
+  manager()->CreateConnectivityReport(nullptr);
   dispatcher()->DispatchPendingEvents();
 }
 
diff --git a/metrics.cc b/metrics.cc
index 6dd17a8..c57dd3a 100644
--- a/metrics.cc
+++ b/metrics.cc
@@ -634,10 +634,11 @@
   // Ignore changes that are not online/offline transitions; e.g.
   // switching between wired and wireless.  TimeToDrop measures
   // time online regardless of how we are connected.
-  if ((service == NULL && !was_online_) || (service != NULL && was_online_))
+  if ((service == nullptr && !was_online_) ||
+      (service != nullptr && was_online_))
     return;
 
-  if (service == NULL) {
+  if (service == nullptr) {
     time_to_drop_timer_->GetElapsedTime(&elapsed_seconds);
     SendToUMA(kMetricTimeToDropSeconds,
               elapsed_seconds.InSeconds(),
@@ -648,7 +649,7 @@
     time_to_drop_timer_->Start();
   }
 
-  was_online_ = (service != NULL);
+  was_online_ = (service != nullptr);
 }
 
 void Metrics::NotifyServiceStateChanged(const Service &service,
@@ -911,7 +912,7 @@
   SLOG(Metrics, 2) << __func__ << ": interface index: " << interface_index
                                << ", technology: " << technology;
   DeviceMetrics *device_metrics = GetDeviceMetrics(interface_index);
-  if (device_metrics == NULL)
+  if (device_metrics == nullptr)
     return false;
   // Make sure the device technologies match.
   return (technology == device_metrics->technology);
@@ -921,7 +922,7 @@
   SLOG(Metrics, 2) << __func__ << ": interface index: " << interface_index;
 
   DeviceMetrics *device_metrics = GetDeviceMetrics(interface_index);
-  if (device_metrics != NULL) {
+  if (device_metrics != nullptr) {
     NotifyDeviceRemovedEvent(device_metrics->technology);
   }
 
@@ -930,7 +931,7 @@
 
 void Metrics::NotifyDeviceInitialized(int interface_index) {
   DeviceMetrics *device_metrics = GetDeviceMetrics(interface_index);
-  if (device_metrics == NULL)
+  if (device_metrics == nullptr)
     return;
   if (!device_metrics->initialization_timer->Stop())
     return;
@@ -939,14 +940,14 @@
 
 void Metrics::NotifyDeviceEnableStarted(int interface_index) {
   DeviceMetrics *device_metrics = GetDeviceMetrics(interface_index);
-  if (device_metrics == NULL)
+  if (device_metrics == nullptr)
     return;
   device_metrics->enable_timer->Start();
 }
 
 void Metrics::NotifyDeviceEnableFinished(int interface_index) {
   DeviceMetrics *device_metrics = GetDeviceMetrics(interface_index);
-  if (device_metrics == NULL)
+  if (device_metrics == nullptr)
     return;
   if (!device_metrics->enable_timer->Stop())
       return;
@@ -955,14 +956,14 @@
 
 void Metrics::NotifyDeviceDisableStarted(int interface_index) {
   DeviceMetrics *device_metrics = GetDeviceMetrics(interface_index);
-  if (device_metrics == NULL)
+  if (device_metrics == nullptr)
     return;
   device_metrics->disable_timer->Start();
 }
 
 void Metrics::NotifyDeviceDisableFinished(int interface_index) {
   DeviceMetrics *device_metrics = GetDeviceMetrics(interface_index);
-  if (device_metrics == NULL)
+  if (device_metrics == nullptr)
     return;
   if (!device_metrics->disable_timer->Stop())
     return;
@@ -971,7 +972,7 @@
 
 void Metrics::NotifyDeviceScanStarted(int interface_index) {
   DeviceMetrics *device_metrics = GetDeviceMetrics(interface_index);
-  if (device_metrics == NULL)
+  if (device_metrics == nullptr)
     return;
   device_metrics->scan_timer->Start();
   device_metrics->scan_connect_timer->Start();
@@ -979,7 +980,7 @@
 
 void Metrics::NotifyDeviceScanFinished(int interface_index) {
   DeviceMetrics *device_metrics = GetDeviceMetrics(interface_index);
-  if (device_metrics == NULL)
+  if (device_metrics == nullptr)
     return;
   if (!device_metrics->scan_timer->Stop())
     return;
@@ -995,7 +996,7 @@
 
 void Metrics::ResetScanTimer(int interface_index) {
   DeviceMetrics *device_metrics = GetDeviceMetrics(interface_index);
-  if (device_metrics == NULL)
+  if (device_metrics == nullptr)
     return;
   device_metrics->scan_timer->Reset();
 }
@@ -1003,7 +1004,7 @@
 void Metrics::NotifyDeviceConnectStarted(int interface_index,
                                          bool is_auto_connecting) {
   DeviceMetrics *device_metrics = GetDeviceMetrics(interface_index);
-  if (device_metrics == NULL)
+  if (device_metrics == nullptr)
     return;
   device_metrics->connect_timer->Start();
 
@@ -1018,7 +1019,7 @@
 
 void Metrics::NotifyDeviceConnectFinished(int interface_index) {
   DeviceMetrics *device_metrics = GetDeviceMetrics(interface_index);
-  if (device_metrics == NULL)
+  if (device_metrics == nullptr)
     return;
   if (!device_metrics->connect_timer->Stop())
     return;
@@ -1047,7 +1048,7 @@
 
 void Metrics::ResetConnectTimer(int interface_index) {
   DeviceMetrics *device_metrics = GetDeviceMetrics(interface_index);
-  if (device_metrics == NULL)
+  if (device_metrics == nullptr)
     return;
   device_metrics->connect_timer->Reset();
   device_metrics->scan_connect_timer->Reset();
@@ -1431,7 +1432,7 @@
   if (it == devices_metrics_.end()) {
     SLOG(Metrics, 2) << __func__ << ": device " << interface_index
                      << " not found";
-    return NULL;
+    return nullptr;
   }
   return it->second.get();
 }
diff --git a/metrics_unittest.cc b/metrics_unittest.cc
index fcdbf31..e1e31c3 100644
--- a/metrics_unittest.cc
+++ b/metrics_unittest.cc
@@ -334,7 +334,7 @@
                                   Metrics::kMetricTimeToDropSecondsMin,
                                   Metrics::kMetricTimeToDropSecondsMax,
                                   Metrics::kTimerHistogramNumBuckets));
-  metrics_.NotifyDefaultServiceChanged(NULL);
+  metrics_.NotifyDefaultServiceChanged(nullptr);
 }
 
 TEST_F(MetricsTest, Disconnect) {
diff --git a/mock_async_connection.cc b/mock_async_connection.cc
index da6e1f9..7d0cdb5 100644
--- a/mock_async_connection.cc
+++ b/mock_async_connection.cc
@@ -9,7 +9,8 @@
 namespace shill {
 
 MockAsyncConnection::MockAsyncConnection()
-    : AsyncConnection("", NULL, NULL, base::Callback<void(bool, int)>()) {}
+    : AsyncConnection("", nullptr, nullptr, base::Callback<void(bool, int)>()) {
+}
 
 MockAsyncConnection::~MockAsyncConnection() {}
 
diff --git a/mock_connectivity_trial.cc b/mock_connectivity_trial.cc
index 7a0d3e1..5edd025 100644
--- a/mock_connectivity_trial.cc
+++ b/mock_connectivity_trial.cc
@@ -11,7 +11,7 @@
 MockConnectivityTrial::MockConnectivityTrial(ConnectionRefPtr connection,
                                              int trial_timeout_seconds)
     : ConnectivityTrial(connection,
-                        NULL,
+                        nullptr,
                         trial_timeout_seconds,
                         base::Callback<void(ConnectivityTrial::Result)>()) {}
 
diff --git a/mock_dhcp_config.cc b/mock_dhcp_config.cc
index 8e4ca9a..d29a73b 100644
--- a/mock_dhcp_config.cc
+++ b/mock_dhcp_config.cc
@@ -11,14 +11,14 @@
 MockDHCPConfig::MockDHCPConfig(ControlInterface *control_interface,
                                const string &device_name)
     : DHCPConfig(control_interface,
-                 NULL,
-                 NULL,
+                 nullptr,
+                 nullptr,
                  device_name,
                  string(),
                  string(),
                  false,
-                 NULL,
-                 NULL) {}
+                 nullptr,
+                 nullptr) {}
 
 MockDHCPConfig::~MockDHCPConfig() {}
 
diff --git a/mock_dns_client.cc b/mock_dns_client.cc
index 2993800..dd28069 100644
--- a/mock_dns_client.cc
+++ b/mock_dns_client.cc
@@ -15,7 +15,7 @@
 namespace shill {
 
 MockDNSClient::MockDNSClient()
-    : DNSClient(IPAddress::kFamilyIPv4, "", vector<string>(), 0, NULL,
+    : DNSClient(IPAddress::kFamilyIPv4, "", vector<string>(), 0, nullptr,
                 ClientCallback()) {}
 
 MockDNSClient::~MockDNSClient() {}
diff --git a/mock_dns_server_tester.cc b/mock_dns_server_tester.cc
index 681a2f1..9f5232b 100644
--- a/mock_dns_server_tester.cc
+++ b/mock_dns_server_tester.cc
@@ -12,7 +12,7 @@
 
 MockDNSServerTester::MockDNSServerTester(ConnectionRefPtr connection)
     : DNSServerTester(connection,
-                      NULL,
+                      nullptr,
                       std::vector<std::string>(),
                       false,
                       base::Callback<void(const DNSServerTester::Status)>()) {}
diff --git a/mock_eap_listener.cc b/mock_eap_listener.cc
index e738c29..adf30cb 100644
--- a/mock_eap_listener.cc
+++ b/mock_eap_listener.cc
@@ -6,7 +6,7 @@
 
 namespace shill {
 
-MockEapListener::MockEapListener() : EapListener(NULL, 0) {}
+MockEapListener::MockEapListener() : EapListener(nullptr, 0) {}
 
 MockEapListener::~MockEapListener() {}
 
diff --git a/mock_ethernet_service.cc b/mock_ethernet_service.cc
index f39ef6d..638d8aa 100644
--- a/mock_ethernet_service.cc
+++ b/mock_ethernet_service.cc
@@ -10,7 +10,7 @@
 
 MockEthernetService::MockEthernetService(ControlInterface *control_interface,
                                          Metrics *metrics)
-    : EthernetService(control_interface, NULL, metrics, NULL,
+    : EthernetService(control_interface, nullptr, metrics, nullptr,
                       EthernetRefPtr()) {}
 
 MockEthernetService::~MockEthernetService() {}
diff --git a/mock_http_request.cc b/mock_http_request.cc
index 75dd5d6..28abffe 100644
--- a/mock_http_request.cc
+++ b/mock_http_request.cc
@@ -9,9 +9,7 @@
 namespace shill {
 
 MockHTTPRequest::MockHTTPRequest(ConnectionRefPtr connection)
-    : HTTPRequest(connection,
-                  reinterpret_cast<EventDispatcher *>(NULL),
-                  reinterpret_cast<Sockets *>(NULL)) {}
+    : HTTPRequest(connection, nullptr, nullptr) {}
 
 MockHTTPRequest::~MockHTTPRequest() {}
 
diff --git a/mock_link_monitor.cc b/mock_link_monitor.cc
index a7fa80c..368a880 100644
--- a/mock_link_monitor.cc
+++ b/mock_link_monitor.cc
@@ -9,7 +9,7 @@
 namespace shill {
 
 MockLinkMonitor::MockLinkMonitor()
-    : LinkMonitor(NULL, NULL, NULL, NULL, FailureCallback(),
+    : LinkMonitor(nullptr, nullptr, nullptr, nullptr, FailureCallback(),
                   GatewayChangeCallback()) {}
 
 MockLinkMonitor::~MockLinkMonitor() {}
diff --git a/mock_log.cc b/mock_log.cc
index e1d5586..3679c1e 100644
--- a/mock_log.cc
+++ b/mock_log.cc
@@ -14,7 +14,7 @@
 
 namespace shill {
 
-ScopedMockLog *ScopedMockLog::instance_ = NULL;
+ScopedMockLog *ScopedMockLog::instance_ = nullptr;
 
 ScopedMockLog::ScopedMockLog() {
   previous_handler_ = ::logging::GetLogMessageHandler();
@@ -24,7 +24,7 @@
 
 ScopedMockLog::~ScopedMockLog() {
   ::logging::SetLogMessageHandler(previous_handler_);
-  instance_ = NULL;
+  instance_ = nullptr;
 }
 
 // static
@@ -50,7 +50,7 @@
   instance_->Log(severity, file, message);
 
   // Invoke the previously installed message handler if there was one.
-  if (instance_->previous_handler_ != NULL) {
+  if (instance_->previous_handler_) {
     return (*instance_->previous_handler_)(severity, file, line,
                                            message_start, full_message);
   }
diff --git a/mock_manager.cc b/mock_manager.cc
index 1dbfdc8..907dc6d 100644
--- a/mock_manager.cc
+++ b/mock_manager.cc
@@ -15,7 +15,7 @@
                          Metrics *metrics,
                          GLib *glib)
     : Manager(control_interface, dispatcher, metrics, glib, "", "", ""),
-      mock_device_info_(NULL) {
+      mock_device_info_(nullptr) {
   EXPECT_CALL(*this, device_info())
       .WillRepeatedly(Invoke(this, &MockManager::mock_device_info));
 }
diff --git a/mock_portal_detector.cc b/mock_portal_detector.cc
index 6c2131f..3e0ffdf 100644
--- a/mock_portal_detector.cc
+++ b/mock_portal_detector.cc
@@ -11,7 +11,7 @@
 
 MockPortalDetector::MockPortalDetector(ConnectionRefPtr connection)
     : PortalDetector(connection,
-                     NULL,
+                     nullptr,
                      base::Callback<void(const PortalDetector::Result&)>()) {}
 
 MockPortalDetector::~MockPortalDetector() {}
diff --git a/mock_traffic_monitor.cc b/mock_traffic_monitor.cc
index c8bcbec..286e01f 100644
--- a/mock_traffic_monitor.cc
+++ b/mock_traffic_monitor.cc
@@ -8,7 +8,7 @@
 
 namespace shill {
 
-MockTrafficMonitor::MockTrafficMonitor() : TrafficMonitor(NULL, NULL) {}
+MockTrafficMonitor::MockTrafficMonitor() : TrafficMonitor(nullptr, nullptr) {}
 
 MockTrafficMonitor::~MockTrafficMonitor() {}
 
diff --git a/netlink_attribute.cc b/netlink_attribute.cc
index 0b16b36..8220e65 100644
--- a/netlink_attribute.cc
+++ b/netlink_attribute.cc
@@ -666,7 +666,7 @@
 
 ByteString NetlinkFlagAttribute::Encode() const {
   if (has_a_value_ && value_) {
-    return NetlinkAttribute::EncodeGeneric(NULL, 0);
+    return NetlinkAttribute::EncodeGeneric(nullptr, 0);
   }
   return ByteString();  // Encoding of nothing implies 'false'.
 }
diff --git a/netlink_manager.cc b/netlink_manager.cc
index 1c20685..fa0dce3 100644
--- a/netlink_manager.cc
+++ b/netlink_manager.cc
@@ -166,7 +166,7 @@
   family_id(NetlinkMessage::kIllegalMessageType) {}
 
 NetlinkManager::NetlinkManager()
-    : dispatcher_(NULL),
+    : dispatcher_(nullptr),
       weak_ptr_factory_(this),
       dispatcher_callback_(Bind(&NetlinkManager::OnRawNlMessageReceived,
                                 weak_ptr_factory_.GetWeakPtr())),
@@ -183,7 +183,7 @@
   message_handlers_.clear();
   message_types_.clear();
   if (full) {
-    dispatcher_ = NULL;
+    dispatcher_ = nullptr;
     sock_.reset();
   }
 }
@@ -361,8 +361,8 @@
     timersub(&end_time, &now, &wait_duration);
     int result = sock_->sockets()->Select(file_descriptor() + 1,
                                           &read_fds,
-                                          NULL,
-                                          NULL,
+                                          nullptr,
+                                          nullptr,
                                           &wait_duration);
     if (result < 0) {
       PLOG(ERROR) << "Select failed";
@@ -479,7 +479,7 @@
       // A timeout isn't always unexpected so this is not a warning.
       SLOG(WiFi, 3) << "Removing timed-out handler for sequence number "
                     << handler_it->first;
-      handler_it->second->HandleError(kTimeoutWaitingForResponse, NULL);
+      handler_it->second->HandleError(kTimeoutWaitingForResponse, nullptr);
       handler_it = message_handlers_.erase(handler_it);
     } else {
       ++handler_it;
@@ -580,7 +580,7 @@
   const uint32_t sequence_number = msg->nlmsg_seq;
 
   scoped_ptr<NetlinkMessage> message(message_factory_.CreateMessage(msg));
-  if (message == NULL) {
+  if (message == nullptr) {
     SLOG(WiFi, 3) << "NL Message " << sequence_number << " <===";
     SLOG(WiFi, 3) << __func__ << "(msg:NULL)";
     return;  // Skip current message, continue parsing buffer.
@@ -621,9 +621,9 @@
     if (!message_handlers_[sequence_number]->HandleMessage(*message)) {
       LOG(ERROR) << "Couldn't call message handler for " << sequence_number;
       // Call the error handler but, since we don't have an |ErrorAckMessage|,
-      // we'll have to pass a NULL pointer.
+      // we'll have to pass a nullptr.
       message_handlers_[sequence_number]->HandleError(kUnexpectedResponseType,
-                                                      NULL);
+                                                      nullptr);
     }
     if ((message->flags() & NLM_F_MULTI) &&
         (message->message_type() != NLMSG_DONE)) {
diff --git a/netlink_manager_unittest.cc b/netlink_manager_unittest.cc
index 04199f4..d527b64 100644
--- a/netlink_manager_unittest.cc
+++ b/netlink_manager_unittest.cc
@@ -722,8 +722,9 @@
       ack_handler.on_netlink_message(),
       auxilliary_handler.on_netlink_message()));
   received_message->nlmsg_seq = netlink_socket_->GetLastSequenceNumber();
-  EXPECT_CALL(auxilliary_handler,
-              OnErrorHandler(NetlinkManager::kTimeoutWaitingForResponse, NULL));
+  EXPECT_CALL(
+      auxilliary_handler,
+      OnErrorHandler(NetlinkManager::kTimeoutWaitingForResponse, nullptr));
   EXPECT_TRUE(netlink_manager_->SendNl80211Message(&get_reg_message,
                                                    null_message_handler,
                                                    null_ack_handler,
diff --git a/netlink_message.cc b/netlink_message.cc
index 9494790..c944d75 100644
--- a/netlink_message.cc
+++ b/netlink_message.cc
@@ -263,7 +263,7 @@
     const nlmsghdr *const_msg) const {
   if (!const_msg) {
     LOG(ERROR) << "NULL |const_msg| parameter";
-    return NULL;
+    return nullptr;
   }
 
   scoped_ptr<NetlinkMessage> message;
@@ -296,7 +296,7 @@
 
   if (!message->InitFromNlmsg(const_msg)) {
     LOG(ERROR) << "Message did not initialize properly";
-    return NULL;
+    return nullptr;
   }
 
   return message.release();
diff --git a/netlink_message_unittest.cc b/netlink_message_unittest.cc
index 5223536..87bcca7 100644
--- a/netlink_message_unittest.cc
+++ b/netlink_message_unittest.cc
@@ -435,7 +435,7 @@
       message_factory_.CreateMessage(const_cast<nlmsghdr *>(
           reinterpret_cast<const nlmsghdr *>(kNL80211_CMD_TRIGGER_SCAN))));
 
-  EXPECT_NE(reinterpret_cast<NetlinkMessage *>(NULL), netlink_message);
+  EXPECT_NE(nullptr, netlink_message);
   EXPECT_EQ(kNl80211FamilyId, netlink_message->message_type());
   // The following is legal if the message_type is kNl80211FamilyId.
   scoped_ptr<Nl80211Message> message(dynamic_cast<Nl80211Message *>(
@@ -487,7 +487,7 @@
       message_factory_.CreateMessage(const_cast<nlmsghdr *>(
           reinterpret_cast<const nlmsghdr *>(kNL80211_CMD_NEW_SCAN_RESULTS))));
 
-  EXPECT_NE(reinterpret_cast<NetlinkMessage *>(NULL), netlink_message);
+  EXPECT_NE(nullptr, netlink_message);
   EXPECT_EQ(kNl80211FamilyId, netlink_message->message_type());
   // The following is legal if the message_type is kNl80211FamilyId.
   scoped_ptr<Nl80211Message> message(dynamic_cast<Nl80211Message *>(
@@ -539,7 +539,7 @@
       message_factory_.CreateMessage(const_cast<nlmsghdr *>(
           reinterpret_cast<const nlmsghdr *>(kNL80211_CMD_NEW_STATION))));
 
-  EXPECT_NE(reinterpret_cast<NetlinkMessage *>(NULL), netlink_message);
+  EXPECT_NE(nullptr, netlink_message);
   EXPECT_EQ(kNl80211FamilyId, netlink_message->message_type());
   // The following is legal if the message_type is kNl80211FamilyId.
   scoped_ptr<Nl80211Message> message(dynamic_cast<Nl80211Message *>(
@@ -579,7 +579,7 @@
       message_factory_.CreateMessage(const_cast<nlmsghdr *>(
           reinterpret_cast<const nlmsghdr *>(kNL80211_CMD_AUTHENTICATE))));
 
-  EXPECT_NE(reinterpret_cast<NetlinkMessage *>(NULL), netlink_message);
+  EXPECT_NE(nullptr, netlink_message);
   EXPECT_EQ(kNl80211FamilyId, netlink_message->message_type());
   // The following is legal if the message_type is kNl80211FamilyId.
   scoped_ptr<Nl80211Message> message(dynamic_cast<Nl80211Message *>(
@@ -617,7 +617,7 @@
       message_factory_.CreateMessage(const_cast<nlmsghdr *>(
           reinterpret_cast<const nlmsghdr *>(kNL80211_CMD_ASSOCIATE))));
 
-  EXPECT_NE(reinterpret_cast<NetlinkMessage *>(NULL), netlink_message);
+  EXPECT_NE(nullptr, netlink_message);
   EXPECT_EQ(kNl80211FamilyId, netlink_message->message_type());
   // The following is legal if the message_type is kNl80211FamilyId.
   scoped_ptr<Nl80211Message> message(dynamic_cast<Nl80211Message *>(
@@ -655,7 +655,7 @@
       message_factory_.CreateMessage(const_cast<nlmsghdr *>(
           reinterpret_cast<const nlmsghdr *>(kNL80211_CMD_CONNECT))));
 
-  EXPECT_NE(reinterpret_cast<NetlinkMessage *>(NULL), netlink_message);
+  EXPECT_NE(nullptr, netlink_message);
   EXPECT_EQ(kNl80211FamilyId, netlink_message->message_type());
   // The following is legal if the message_type is kNl80211FamilyId.
   scoped_ptr<Nl80211Message> message(dynamic_cast<Nl80211Message *>(
@@ -751,7 +751,7 @@
       message_factory_.CreateMessage(const_cast<nlmsghdr *>(
           reinterpret_cast<const nlmsghdr *>(kNL80211_CMD_DEAUTHENTICATE))));
 
-  EXPECT_NE(reinterpret_cast<NetlinkMessage *>(NULL), netlink_message);
+  EXPECT_NE(nullptr, netlink_message);
   EXPECT_EQ(kNl80211FamilyId, netlink_message->message_type());
   // The following is legal if the message_type is kNl80211FamilyId.
   scoped_ptr<Nl80211Message> message(dynamic_cast<Nl80211Message *>(
@@ -789,7 +789,7 @@
       message_factory_.CreateMessage(const_cast<nlmsghdr *>(
           reinterpret_cast<const nlmsghdr *>(kNL80211_CMD_DISCONNECT))));
 
-  EXPECT_NE(reinterpret_cast<NetlinkMessage *>(NULL), netlink_message);
+  EXPECT_NE(nullptr, netlink_message);
   EXPECT_EQ(kNl80211FamilyId, netlink_message->message_type());
   // The following is legal if the message_type is kNl80211FamilyId.
   scoped_ptr<Nl80211Message> message(dynamic_cast<Nl80211Message *>(
@@ -826,7 +826,7 @@
       message_factory_.CreateMessage(const_cast<nlmsghdr *>(
           reinterpret_cast<const nlmsghdr *>(kNL80211_CMD_NOTIFY_CQM))));
 
-  EXPECT_NE(reinterpret_cast<NetlinkMessage *>(NULL), netlink_message);
+  EXPECT_NE(nullptr, netlink_message);
   EXPECT_EQ(kNl80211FamilyId, netlink_message->message_type());
   // The following is legal if the message_type is kNl80211FamilyId.
   scoped_ptr<Nl80211Message> message(dynamic_cast<Nl80211Message *>(
@@ -873,7 +873,7 @@
       message_factory_.CreateMessage(const_cast<nlmsghdr *>(
           reinterpret_cast<const nlmsghdr *>(kNL80211_CMD_DISASSOCIATE))));
 
-  EXPECT_NE(reinterpret_cast<NetlinkMessage *>(NULL), netlink_message);
+  EXPECT_NE(nullptr, netlink_message);
   EXPECT_EQ(kNl80211FamilyId, netlink_message->message_type());
   // The following is legal if the message_type is kNl80211FamilyId.
   scoped_ptr<Nl80211Message> message(dynamic_cast<Nl80211Message *>(
@@ -918,7 +918,7 @@
   scoped_ptr<NetlinkMessage> netlink_message(
       message_factory_.CreateMessage(
           reinterpret_cast<const nlmsghdr *>(kNL80211_CMD_UNKNOWN)));
-  ASSERT_NE(reinterpret_cast<NetlinkMessage *>(NULL), netlink_message.get());
+  ASSERT_NE(nullptr, netlink_message.get());
   EXPECT_EQ(kNl80211FamilyId, netlink_message->message_type());
   // The following is legal if the message_type is kNl80211FamilyId.
   scoped_ptr<Nl80211Message> message(dynamic_cast<Nl80211Message *>(
diff --git a/netlink_socket.cc b/netlink_socket.cc
index 2660227..4e3c1b3 100644
--- a/netlink_socket.cc
+++ b/netlink_socket.cc
@@ -82,8 +82,8 @@
       dummy_read.GetData(),
       dummy_read.GetLength(),
       MSG_TRUNC | MSG_PEEK,
-      NULL,
-      NULL);
+      nullptr,
+      nullptr);
   if (result < 0) {
     PLOG(ERROR) << "Socket recvfrom failed.";
     return false;
@@ -96,8 +96,8 @@
       message->GetData(),
       message->GetLength(),
       0,
-      NULL,
-      NULL);
+      nullptr,
+      nullptr);
   if (result < 0) {
     PLOG(ERROR) << "Second socket recvfrom failed.";
     return false;
diff --git a/nl80211_message.cc b/nl80211_message.cc
index 2194ab2..5a87f89 100644
--- a/nl80211_message.cc
+++ b/nl80211_message.cc
@@ -60,8 +60,8 @@
 const uint8_t Nl80211Frame::kFrameTypeMask = 0xfc;
 
 const char Nl80211Message::kMessageTypeString[] = "nl80211";
-map<uint16_t, string> *Nl80211Message::reason_code_string_ = NULL;
-map<uint16_t, string> *Nl80211Message::status_code_string_ = NULL;
+map<uint16_t, string> *Nl80211Message::reason_code_string_ = nullptr;
+map<uint16_t, string> *Nl80211Message::status_code_string_ = nullptr;
 uint16_t Nl80211Message::nl80211_message_type_ = kIllegalMessageType;
 
 // static
@@ -94,7 +94,7 @@
   nlattr *tb[NL80211_ATTR_MAX + 1];
   nla_parse(tb, NL80211_ATTR_MAX,
             reinterpret_cast<nlattr *>(message.GetData()), message.GetLength(),
-            NULL);
+            nullptr);
 
   for (int i = 0; i < NL80211_ATTR_MAX + 1; ++i) {
     if (tb[i]) {
@@ -586,7 +586,7 @@
 NetlinkMessage *Nl80211Message::CreateMessage(const nlmsghdr *const_msg) {
   if (!const_msg) {
     LOG(ERROR) << "NULL |const_msg| parameter";
-    return NULL;
+    return nullptr;
   }
   // Casting away constness since, while nlmsg_data doesn't change its
   // parameter, it also doesn't declare its paramenter as const.
@@ -662,7 +662,7 @@
       return new UnknownNl80211Message(gnlh->cmd);
       break;
   }
-  return NULL;
+  return nullptr;
 }
 
 //
diff --git a/portal_detector_unittest.cc b/portal_detector_unittest.cc
index 998788c..ccc2eff 100644
--- a/portal_detector_unittest.cc
+++ b/portal_detector_unittest.cc
@@ -57,20 +57,14 @@
 class PortalDetectorTest : public Test {
  public:
   PortalDetectorTest()
-      : device_info_(new NiceMock<MockDeviceInfo>(
-          &control_,
-          reinterpret_cast<EventDispatcher *>(NULL),
-          reinterpret_cast<Metrics *>(NULL),
-          reinterpret_cast<Manager *>(NULL))),
+      : device_info_(
+            new NiceMock<MockDeviceInfo>(&control_, nullptr, nullptr, nullptr)),
         connection_(new StrictMock<MockConnection>(device_info_.get())),
-        portal_detector_(new PortalDetector(
-            connection_.get(),
-            &dispatcher_,
-            callback_target_.result_callback())),
-        connectivity_trial_(
-            new StrictMock<MockConnectivityTrial>(
-                connection_,
-                PortalDetector::kRequestTimeoutSeconds)),
+        portal_detector_(
+            new PortalDetector(connection_.get(), &dispatcher_,
+                               callback_target_.result_callback())),
+        connectivity_trial_(new StrictMock<MockConnectivityTrial>(
+            connection_, PortalDetector::kRequestTimeoutSeconds)),
         interface_name_(kInterfaceName),
         dns_servers_(kDNSServers, kDNSServers + 2) {
     current_time_.tv_sec = current_time_.tv_usec = 0;
diff --git a/power_manager_unittest.cc b/power_manager_unittest.cc
index 0f01950..50c57c8 100644
--- a/power_manager_unittest.cc
+++ b/power_manager_unittest.cc
@@ -40,7 +40,7 @@
 class FakeProxyFactory : public ProxyFactory {
  public:
   FakeProxyFactory()
-      : delegate_(NULL),
+      : delegate_(nullptr),
         power_manager_proxy_raw_(new MockPowerManagerProxy),
         dbus_service_proxy_raw_(new MockDBusServiceProxy),
         power_manager_proxy_(power_manager_proxy_raw_),
diff --git a/profile.cc b/profile.cc
index c487ed8..63bcee1 100644
--- a/profile.cc
+++ b/profile.cc
@@ -168,7 +168,7 @@
 
 bool Profile::AbandonService(const ServiceRefPtr &service) {
   if (service->profile() == this)
-    service->SetProfile(NULL);
+    service->SetProfile(nullptr);
   return storage_->DeleteGroup(service->GetStorageIdentifier()) &&
       storage_->Flush();
 }
@@ -380,8 +380,8 @@
     const string &name,
     Strings(Profile::*get)(Error *)) {
   store_.RegisterDerivedStrings(
-      name,
-      StringsAccessor(new CustomAccessor<Profile, Strings>(this, get, NULL)));
+      name, StringsAccessor(
+                new CustomAccessor<Profile, Strings>(this, get, nullptr)));
 }
 
 }  // namespace shill
diff --git a/profile_dbus_adaptor.cc b/profile_dbus_adaptor.cc
index 6e9cea4..91a5a0c 100644
--- a/profile_dbus_adaptor.cc
+++ b/profile_dbus_adaptor.cc
@@ -31,7 +31,7 @@
 }
 
 ProfileDBusAdaptor::~ProfileDBusAdaptor() {
-  profile_ = NULL;
+  profile_ = nullptr;
 }
 
 void ProfileDBusAdaptor::EmitBoolChanged(const string &name, bool value) {
diff --git a/profile_dbus_property_exporter.cc b/profile_dbus_property_exporter.cc
index 2d8595c..7e032f1 100644
--- a/profile_dbus_property_exporter.cc
+++ b/profile_dbus_property_exporter.cc
@@ -95,7 +95,7 @@
     SetString(properties, kSecurityProperty, security);
   }
 
-  LoadEapServiceProperties(properties, NULL);
+  LoadEapServiceProperties(properties, nullptr);
 
   return true;
 }
diff --git a/profile_unittest.cc b/profile_unittest.cc
index 2dfcffc..205bd50 100644
--- a/profile_unittest.cc
+++ b/profile_unittest.cc
@@ -38,7 +38,7 @@
 
 class ProfileTest : public PropertyStoreTest {
  public:
-  ProfileTest() : mock_metrics_(new MockMetrics(NULL)) {
+  ProfileTest() : mock_metrics_(new MockMetrics(nullptr)) {
     Profile::Identifier id("rather", "irrelevant");
     profile_ =
         new Profile(control_interface(), metrics(), manager(), id, "", false);
@@ -258,7 +258,7 @@
                                               metrics(),
                                               manager()));
   // Change prioirty from default.
-  service1->SetPriority(service1->priority() + 1, NULL);
+  service1->SetPriority(service1->priority() + 1, nullptr);
   ASSERT_TRUE(profile_->AdoptService(service1));
   ASSERT_TRUE(profile_->ContainsService(service1));
 
@@ -463,7 +463,7 @@
 }
 
 TEST_F(ProfileTest, UpdateDevice) {
-  EXPECT_FALSE(profile_->UpdateDevice(NULL));
+  EXPECT_FALSE(profile_->UpdateDevice(nullptr));
 }
 
 }  // namespace shill
diff --git a/property_accessor.h b/property_accessor.h
index 697fcca..5da3184 100644
--- a/property_accessor.h
+++ b/property_accessor.h
@@ -160,7 +160,7 @@
   CustomAccessor(C *target,
                  T(C::*getter)(Error *error),
                  bool(C::*setter)(const T &value, Error *error))
-      : CustomAccessor(target, getter, setter, NULL) {}
+      : CustomAccessor(target, getter, setter, nullptr) {}
   ~CustomAccessor() override {}
 
   void Clear(Error *error) {
diff --git a/property_accessor_unittest.cc b/property_accessor_unittest.cc
index 3f0e2e3..34f7b82 100644
--- a/property_accessor_unittest.cc
+++ b/property_accessor_unittest.cc
@@ -322,7 +322,7 @@
     Error error;
     CustomAccessor<StringWrapper, string> accessor(&wrapper,
                                                    &StringWrapper::Get,
-                                                   NULL);
+                                                   nullptr);
     EXPECT_EQ(wrapper.value_, accessor.Get(&error));
 
     const string expected_string = "what";
@@ -339,7 +339,7 @@
     Error error;
     CustomAccessor<StringWrapper, string> accessor(&wrapper,
                                                    &StringWrapper::Get,
-                                                   NULL);
+                                                   nullptr);
     accessor.Clear(&error);
     ASSERT_FALSE(error.IsSuccess());
   }
@@ -348,7 +348,7 @@
     Error error;
     CustomAccessor<StringWrapper, string> accessor(&wrapper,
                                                    &StringWrapper::Get,
-                                                   NULL,
+                                                   nullptr,
                                                    &StringWrapper::Clear);
     wrapper.value_ = "empty this";
     accessor.Clear(&error);
@@ -364,7 +364,7 @@
     Error error;
     const string default_value = "default value";
     CustomWriteOnlyAccessor<StringWrapper, string> accessor(
-        &wrapper, &StringWrapper::Set, NULL, &default_value);
+        &wrapper, &StringWrapper::Set, nullptr, &default_value);
     wrapper.value_ = "can't read this";
     EXPECT_EQ(string(), accessor.Get(&error));
     EXPECT_TRUE(error.IsFailure());
@@ -376,7 +376,7 @@
     const string default_value = "default value";
     const string expected_string = "what";
     CustomWriteOnlyAccessor<StringWrapper, string> accessor(
-        &wrapper, &StringWrapper::Set, NULL, &default_value);
+        &wrapper, &StringWrapper::Set, nullptr, &default_value);
     EXPECT_TRUE(accessor.Set(expected_string, &error));
     EXPECT_TRUE(error.IsSuccess());
     EXPECT_EQ(expected_string, wrapper.value_);
@@ -391,7 +391,7 @@
     Error error;
     const string default_value = "default value";
     CustomWriteOnlyAccessor<StringWrapper, string> accessor(
-        &wrapper, &StringWrapper::Set, NULL, &default_value);
+        &wrapper, &StringWrapper::Set, nullptr, &default_value);
     accessor.Set("new value", &error);
     EXPECT_EQ("new value", wrapper.value_);
     accessor.Clear(&error);
@@ -406,7 +406,7 @@
     // Test reading.
     Error error;
     CustomWriteOnlyAccessor<StringWrapper, string> accessor(
-        &wrapper, &StringWrapper::Set, &StringWrapper::Clear, NULL);
+        &wrapper, &StringWrapper::Set, &StringWrapper::Clear, nullptr);
     wrapper.value_ = "can't read this";
     EXPECT_EQ(string(), accessor.Get(&error));
     EXPECT_TRUE(error.IsFailure());
@@ -417,7 +417,7 @@
     Error error;
     const string expected_string = "what";
     CustomWriteOnlyAccessor<StringWrapper, string> accessor(
-        &wrapper, &StringWrapper::Set, &StringWrapper::Clear, NULL);
+        &wrapper, &StringWrapper::Set, &StringWrapper::Clear, nullptr);
     EXPECT_TRUE(accessor.Set(expected_string, &error));
     EXPECT_TRUE(error.IsSuccess());
     EXPECT_EQ(expected_string, wrapper.value_);
@@ -431,7 +431,7 @@
     // Test clearing.
     Error error;
     CustomWriteOnlyAccessor<StringWrapper, string> accessor(
-        &wrapper, &StringWrapper::Set, &StringWrapper::Clear, NULL);
+        &wrapper, &StringWrapper::Set, &StringWrapper::Clear, nullptr);
     EXPECT_TRUE(accessor.Set("new value", &error));
     EXPECT_EQ("new value", wrapper.value_);
     accessor.Clear(&error);
diff --git a/property_store_unittest.cc b/property_store_unittest.cc
index 0c9f8f4..f0bb0f1 100644
--- a/property_store_unittest.cc
+++ b/property_store_unittest.cc
@@ -316,7 +316,7 @@
     EXPECT_TRUE(it.AtEnd());
 
     Error errors[2];
-    EXPECT_FALSE(store.GetBoolProperty(keys[0], NULL, &errors[0]));
+    EXPECT_FALSE(store.GetBoolProperty(keys[0], nullptr, &errors[0]));
     EXPECT_EQ(Error::kPermissionDenied, errors[0].type());
     bool test_value;
     EXPECT_TRUE(store.GetBoolProperty(keys[1], &test_value, &errors[1]));
@@ -337,7 +337,7 @@
     EXPECT_TRUE(it.AtEnd());
 
     Error errors[2];
-    EXPECT_FALSE(store.GetInt16Property(keys[0], NULL, &errors[0]));
+    EXPECT_FALSE(store.GetInt16Property(keys[0], nullptr, &errors[0]));
     EXPECT_EQ(Error::kPermissionDenied, errors[0].type());
     int16_t test_value;
     EXPECT_TRUE(store.GetInt16Property(keys[1], &test_value, &errors[1]));
@@ -358,7 +358,7 @@
     EXPECT_TRUE(it.AtEnd());
 
     Error errors[2];
-    EXPECT_FALSE(store.GetInt32Property(keys[0], NULL, &errors[0]));
+    EXPECT_FALSE(store.GetInt32Property(keys[0], nullptr, &errors[0]));
     EXPECT_EQ(Error::kPermissionDenied, errors[0].type());
     int32_t test_value;
     EXPECT_TRUE(store.GetInt32Property(keys[1], &test_value, &errors[1]));
@@ -379,7 +379,7 @@
     EXPECT_TRUE(it.AtEnd());
 
     Error errors[2];
-    EXPECT_FALSE(store.GetStringProperty(keys[0], NULL, &errors[0]));
+    EXPECT_FALSE(store.GetStringProperty(keys[0], nullptr, &errors[0]));
     EXPECT_EQ(Error::kPermissionDenied, errors[0].type());
     string test_value;
     EXPECT_TRUE(store.GetStringProperty(keys[1], &test_value, &errors[1]));
@@ -403,7 +403,7 @@
     EXPECT_TRUE(it.AtEnd());
 
     Error errors[2];
-    EXPECT_FALSE(store.GetStringmapProperty(keys[0], NULL, &errors[0]));
+    EXPECT_FALSE(store.GetStringmapProperty(keys[0], nullptr, &errors[0]));
     EXPECT_EQ(Error::kPermissionDenied, errors[0].type());
     Stringmap test_value;
     EXPECT_TRUE(store.GetStringmapProperty(keys[1], &test_value, &errors[1]));
@@ -431,7 +431,7 @@
     EXPECT_TRUE(it.AtEnd());
 
     Error errors[2];
-    EXPECT_FALSE(store.GetStringmapsProperty(keys[0], NULL, &errors[0]));
+    EXPECT_FALSE(store.GetStringmapsProperty(keys[0], nullptr, &errors[0]));
     EXPECT_EQ(Error::kPermissionDenied, errors[0].type());
     Stringmaps test_value;
     EXPECT_TRUE(store.GetStringmapsProperty(keys[1], &test_value, &errors[1]));
@@ -458,7 +458,7 @@
     EXPECT_TRUE(it.AtEnd());
 
     Error errors[2];
-    EXPECT_FALSE(store.GetStringsProperty(keys[0], NULL, &errors[0]));
+    EXPECT_FALSE(store.GetStringsProperty(keys[0], nullptr, &errors[0]));
     EXPECT_EQ(Error::kPermissionDenied, errors[0].type());
     Strings test_value;
     EXPECT_TRUE(store.GetStringsProperty(keys[1], &test_value, &errors[1]));
@@ -479,7 +479,7 @@
     EXPECT_TRUE(it.AtEnd());
 
     Error errors[2];
-    EXPECT_FALSE(store.GetUint8Property(keys[0], NULL, &errors[0]));
+    EXPECT_FALSE(store.GetUint8Property(keys[0], nullptr, &errors[0]));
     EXPECT_EQ(Error::kPermissionDenied, errors[0].type());
     uint8_t test_value;
     EXPECT_TRUE(store.GetUint8Property(keys[1], &test_value, &errors[1]));
@@ -501,7 +501,7 @@
     EXPECT_TRUE(it.AtEnd());
 
     Error errors[2];
-    EXPECT_FALSE(store.GetUint16Property(keys[0], NULL, &errors[0]));
+    EXPECT_FALSE(store.GetUint16Property(keys[0], nullptr, &errors[0]));
     EXPECT_EQ(Error::kPermissionDenied, errors[0].type());
     uint16_t test_value;
     EXPECT_TRUE(store.GetUint16Property(keys[1], &test_value, &errors[1]));
diff --git a/protobuf_lite_streams.cc b/protobuf_lite_streams.cc
index 60bdb12..70462b3 100644
--- a/protobuf_lite_streams.cc
+++ b/protobuf_lite_streams.cc
@@ -22,7 +22,7 @@
   if (fd == -1) {
     PLOG(ERROR) << __func__ << ": "
                 << "Could not load protobuf file [" << file_path << "] ";
-    return NULL;
+    return nullptr;
   }
 
   auto *file_stream(new ProtobufLiteCopyingFileInputStream(fd));
diff --git a/protobuf_lite_streams.h b/protobuf_lite_streams.h
index 9e8f1a8..f36be5e 100644
--- a/protobuf_lite_streams.h
+++ b/protobuf_lite_streams.h
@@ -17,7 +17,7 @@
 // Attempts to create a |google::protobuf::io::CopyingInputStreamAdaptor| using
 // a |shill::ProtobufLiteCopyingFileInputStream|. Returns a new instance on
 // success. The caller owns the new instance, and must free it when done.
-// Returns NULL on failure.
+// Returns nullptr on failure.
 google::protobuf::io::CopyingInputStreamAdaptor *
 protobuf_lite_file_input_stream(const std::string &file_path);
 
diff --git a/result_aggregator.cc b/result_aggregator.cc
index cbfe251..5d55857 100644
--- a/result_aggregator.cc
+++ b/result_aggregator.cc
@@ -10,7 +10,7 @@
 namespace shill {
 
 ResultAggregator::ResultAggregator(const ResultCallback &callback)
-    : ResultAggregator(callback, NULL, -1) {}
+    : ResultAggregator(callback, nullptr, -1) {}
 
 ResultAggregator::ResultAggregator(const ResultCallback &callback,
                                    EventDispatcher *dispatcher,
diff --git a/result_aggregator_unittest.cc b/result_aggregator_unittest.cc
index 6846864..77b24ab 100644
--- a/result_aggregator_unittest.cc
+++ b/result_aggregator_unittest.cc
@@ -32,7 +32,7 @@
   virtual ~ResultAggregatorTest() {}
 
   virtual void TearDown() {
-    aggregator_ = NULL;  // Ensure ReportResult is invoked before our dtor.
+    aggregator_ = nullptr;  // Ensure ReportResult is invoked before our dtor.
   }
 
   MOCK_METHOD1(ReportResult, void(const Error &));
diff --git a/routing_table_unittest.cc b/routing_table_unittest.cc
index 2f45966..2382711 100644
--- a/routing_table_unittest.cc
+++ b/routing_table_unittest.cc
@@ -42,7 +42,7 @@
       int /*fd*/,
       const IOHandler::InputCallback &/*input_callback*/,
       const IOHandler::ErrorCallback &/*error_callback*/) {
-    return NULL;
+    return nullptr;
   }
 };
 
diff --git a/rpc_task_dbus_adaptor.cc b/rpc_task_dbus_adaptor.cc
index a3c5d0a..b9ec651 100644
--- a/rpc_task_dbus_adaptor.cc
+++ b/rpc_task_dbus_adaptor.cc
@@ -23,7 +23,7 @@
       connection_name_(conn->unique_name()) {}
 
 RPCTaskDBusAdaptor::~RPCTaskDBusAdaptor() {
-  task_ = NULL;
+  task_ = nullptr;
 }
 
 const string &RPCTaskDBusAdaptor::GetRpcIdentifier() {
diff --git a/rtnl_handler.cc b/rtnl_handler.cc
index e59120c..9fe497a 100644
--- a/rtnl_handler.cc
+++ b/rtnl_handler.cc
@@ -44,7 +44,7 @@
 }  // namespace
 
 RTNLHandler::RTNLHandler()
-    : sockets_(NULL),
+    : sockets_(nullptr),
       in_request_(false),
       rtnl_socket_(-1),
       request_flags_(0),
@@ -111,7 +111,7 @@
   rtnl_handler_.reset();
   sockets_->Close(rtnl_socket_);
   in_request_ = false;
-  sockets_ = NULL;
+  sockets_ = nullptr;
   request_flags_ = 0;
   SLOG(RTNL, 2) << "RTNLHandler stopped";
 }
diff --git a/rtnl_handler_unittest.cc b/rtnl_handler_unittest.cc
index 2d5b1f8..dfd9b0b 100644
--- a/rtnl_handler_unittest.cc
+++ b/rtnl_handler_unittest.cc
@@ -52,7 +52,7 @@
       int /*fd*/,
       const IOHandler::InputCallback &/*input_callback*/,
       const IOHandler::ErrorCallback &/*error_callback*/) {
-    return NULL;
+    return nullptr;
   }
 };
 
@@ -68,7 +68,7 @@
 
   virtual void TearDown() {
     RTNLHandler::GetInstance()->Stop();
-    SetSockets(NULL);
+    SetSockets(nullptr);
   }
 
   MOCK_METHOD1(HandlerCallback, void(const RTNLMessage &));
diff --git a/rtnl_message.cc b/rtnl_message.cc
index 36142ee..e0c1124 100644
--- a/rtnl_message.cc
+++ b/rtnl_message.cc
@@ -87,7 +87,7 @@
     return false;
   }
 
-  rtattr *attr_data = NULL;
+  rtattr *attr_data = nullptr;
   int attr_length = 0;
 
   switch (hdr->hdr.nlmsg_type) {
diff --git a/scan_session_unittest.cc b/scan_session_unittest.cc
index 5e4de99..894a11e 100644
--- a/scan_session_unittest.cc
+++ b/scan_session_unittest.cc
@@ -90,7 +90,7 @@
                                         kArbitraryMaximum,
                                         Bind(&ScanSessionTest::OnScanError,
                                              weak_ptr_factory_.GetWeakPtr()),
-                                        NULL));
+                                        nullptr));
   }
 
   virtual std::vector<uint16_t> GetScanFrequencies(float scan_fraction,
diff --git a/service.cc b/service.cc
index fb50265..1f39cf7 100644
--- a/service.cc
+++ b/service.cc
@@ -197,7 +197,8 @@
                                  &Service::GetHTTPProxyPort);
   HelpRegisterConstDerivedRpcIdentifier(kIPConfigProperty,
                                         &Service::GetIPConfigRpcIdentifier);
-  HelpRegisterDerivedBool(kIsActiveProperty, &Service::IsActive, NULL, NULL);
+  HelpRegisterDerivedBool(kIsActiveProperty, &Service::IsActive, nullptr,
+                          nullptr);
   // kModeProperty: Registered in WiFiService
 
   HelpRegisterDerivedString(kNameProperty,
@@ -223,11 +224,11 @@
                                  &Service::GetTethering);
   HelpRegisterDerivedString(kTypeProperty,
                             &Service::CalculateTechnology,
-                            NULL);
+                            nullptr);
   // kSecurityProperty: Registered in WiFiService
   HelpRegisterDerivedString(kStateProperty,
                             &Service::CalculateState,
-                            NULL);
+                            nullptr);
   store_.RegisterConstUint8(kSignalStrengthProperty, &strength_);
   store_.RegisterString(kUIDataProperty, &ui_data_);
   HelpRegisterConstDerivedStrings(kDiagnosticsDisconnectsProperty,
@@ -240,8 +241,8 @@
 
   HelpRegisterObservedDerivedBool(kVisibleProperty,
                                   &Service::GetVisibleProperty,
-                                  NULL,
-                                  NULL);
+                                  nullptr,
+                                  nullptr);
 
   store_.RegisterConstString(kPortalDetectionFailedPhaseProperty,
                              &portal_detection_failure_phase_);
@@ -265,7 +266,7 @@
 }
 
 void Service::AutoConnect() {
-  const char *reason = NULL;
+  const char *reason = nullptr;
   if (IsAutoConnectable(&reason)) {
     Error error;
     LOG(INFO) << "Auto-connecting to service " << unique_name_;
@@ -434,7 +435,7 @@
 void Service::SetFailure(ConnectFailure failure) {
   failure_ = failure;
   SaveFailure();
-  failed_time_ = time(NULL);
+  failed_time_ = time(nullptr);
   UpdateErrorProperty();
   SetState(kStateFailure);
 }
@@ -447,7 +448,7 @@
   failure_ = failure;
   SaveFailure();
   UpdateErrorProperty();
-  failed_time_ = time(NULL);
+  failed_time_ = time(nullptr);
 }
 
 string Service::GetRpcIdentifier() const {
@@ -911,7 +912,7 @@
   }
   int period = 0;
   size_t threshold = 0;
-  deque<Timestamp> *events = NULL;
+  deque<Timestamp> *events = nullptr;
   // Sometimes services transition to Idle before going into a failed state so
   // take into account the last non-idle state.
   ConnectState state = state_ == kStateIdle ? previous_state_ : state_;
@@ -1364,7 +1365,7 @@
 
 void Service::SetEAPKeyManagement(const string &key_management) {
   CHECK(mutable_eap());
-  mutable_eap()->SetKeyManagement(key_management, NULL);
+  mutable_eap()->SetKeyManagement(key_management, nullptr);
 }
 
 bool Service::GetAutoConnect(Error */*error*/) {
diff --git a/service.h b/service.h
index 34f8df8..acbca74 100644
--- a/service.h
+++ b/service.h
@@ -429,7 +429,7 @@
   const ProfileRefPtr &profile() const;
 
   // Sets the profile property of this service. Broadcasts the new value if it's
-  // not NULL. If the new value is NULL, the service will either be set to
+  // not nullptr. If the new value is nullptr, the service will either be set to
   // another profile afterwards or it will not be visible and not monitored
   // anymore.
   void SetProfile(const ProfileRefPtr &p);
diff --git a/service_dbus_adaptor.cc b/service_dbus_adaptor.cc
index 82c69b1..8b2720f 100644
--- a/service_dbus_adaptor.cc
+++ b/service_dbus_adaptor.cc
@@ -24,7 +24,7 @@
     : DBusAdaptor(conn, kPath + service->unique_name()), service_(service) {}
 
 ServiceDBusAdaptor::~ServiceDBusAdaptor() {
-  service_ = NULL;
+  service_ = nullptr;
 }
 
 void ServiceDBusAdaptor::UpdateConnected() {}
diff --git a/service_property_change_test.cc b/service_property_change_test.cc
index 42d2b2a..c2d9f6c 100644
--- a/service_property_change_test.cc
+++ b/service_property_change_test.cc
@@ -52,7 +52,7 @@
   Mock::VerifyAndClearExpectations(adaptor);
 
   // Depending on our caller, AutoConnect may be true.
-  service->ClearAutoConnect(NULL);
+  service->ClearAutoConnect(nullptr);
   EXPECT_FALSE(service->auto_connect());
   EXPECT_CALL(*adaptor, EmitBoolChanged(kAutoConnectProperty, _));
   service->SetAutoConnect(true);
@@ -149,9 +149,7 @@
   {
     Error error;
     scoped_refptr<MockProfile> profile(
-        new NiceMock<MockProfile>(static_cast<ControlInterface *>(NULL),
-                                  static_cast<Metrics *>(NULL),
-                                  static_cast<Manager *>(NULL)));
+        new NiceMock<MockProfile>(nullptr, nullptr, nullptr));
     service->set_profile(profile);
     EXPECT_FALSE(service->SetProfileRpcId(profile->GetRpcIdentifier(),
                                            &error));
diff --git a/service_unittest.cc b/service_unittest.cc
index d7a07bc..d1bb632 100644
--- a/service_unittest.cc
+++ b/service_unittest.cc
@@ -74,7 +74,7 @@
                                        metrics(),
                                        &mock_manager_)),
         storage_id_(ServiceUnderTest::kStorageId),
-        power_manager_(new MockPowerManager(NULL, &proxy_factory_)),
+        power_manager_(new MockPowerManager(nullptr, &proxy_factory_)),
         eap_(new MockEapCredentials()) {
     ON_CALL(proxy_factory_, CreatePowerManagerProxy(_))
         .WillByDefault(ReturnNull());
@@ -773,7 +773,7 @@
   EXPECT_CALL(*mock_profile, UpdateService(IsRefPtrTo(service_)));
   service_->SetState(Service::kStateConnected);
   EXPECT_TRUE(service_->has_ever_connected_);
-  service_->set_profile(NULL);  // Break reference cycle.
+  service_->set_profile(nullptr);  // Break reference cycle.
 
   // Similar to the above, but emulate an emphemeral profile, which
   // has no storage. We can't update the service in the profile, but
@@ -782,11 +782,10 @@
   service_->set_profile(mock_profile);
   service_->has_ever_connected_ = false;
   EXPECT_CALL(mock_manager_, UpdateService(IsRefPtrTo(service_)));
-  EXPECT_CALL(*mock_profile, GetConstStorage()).
-      WillOnce(Return(static_cast<StoreInterface *>(NULL)));
+  EXPECT_CALL(*mock_profile, GetConstStorage()).WillOnce(Return(nullptr));
   service_->SetState(Service::kStateConnected);
   EXPECT_TRUE(service_->has_ever_connected_);
-  service_->set_profile(NULL);  // Break reference cycle.
+  service_->set_profile(nullptr);  // Break reference cycle.
 }
 
 TEST_F(ServiceTest, PortalDetectionFailure) {
@@ -921,7 +920,7 @@
 }
 
 TEST_F(ServiceTest, IsAutoConnectable) {
-  const char *reason = NULL;
+  const char *reason = nullptr;
   service_->SetConnectable(true);
 
   // Services with non-primary connectivity technologies should not auto-connect
@@ -1106,7 +1105,7 @@
 TEST_F(ServiceTest, ConfigureStringProperty) {
   const string kGuid0 = "guid_zero";
   const string kGuid1 = "guid_one";
-  service_->SetGuid(kGuid0, NULL);
+  service_->SetGuid(kGuid0, nullptr);
   ASSERT_EQ(kGuid0, service_->guid());
   KeyValueStore args;
   args.SetString(kGuidProperty, kGuid1);
@@ -1151,7 +1150,7 @@
 TEST_F(ServiceTest, ConfigureIntProperty) {
   const int kPriority0 = 100;
   const int kPriority1 = 200;
-  service_->SetPriority(kPriority0, NULL);
+  service_->SetPriority(kPriority0, nullptr);
   ASSERT_EQ(kPriority0, service_->priority());
   KeyValueStore args;
   args.SetInt(kPriorityProperty, kPriority1);
@@ -1188,10 +1187,10 @@
   service_->SetAutoConnect(false);
   const string kGUID0 = "guid_zero";
   const string kGUID1 = "guid_one";
-  service_->SetGuid(kGUID0, NULL);
+  service_->SetGuid(kGUID0, nullptr);
   const uint32_t kPriority0 = 100;
   const uint32_t kPriority1 = 200;
-  service_->SetPriority(kPriority0, NULL);
+  service_->SetPriority(kPriority0, nullptr);
   const vector<string> kStrings0{ "string0", "string1" };
   const vector<string> kStrings1{ "string2", "string3" };
   service_->set_strings(kStrings0);
@@ -1239,7 +1238,7 @@
 }
 
 TEST_F(ServiceTest, IsRemembered) {
-  service_->set_profile(NULL);
+  service_->set_profile(nullptr);
   EXPECT_CALL(mock_manager_, IsServiceEphemeral(_)).Times(0);
   EXPECT_FALSE(service_->IsRemembered());
 
@@ -1254,7 +1253,7 @@
 }
 
 TEST_F(ServiceTest, IsDependentOn) {
-  EXPECT_FALSE(service_->IsDependentOn(NULL));
+  EXPECT_FALSE(service_->IsDependentOn(nullptr));
 
   scoped_ptr<MockDeviceInfo> mock_device_info(
       new NiceMock<MockDeviceInfo>(control_interface(), dispatcher(), metrics(),
@@ -1269,7 +1268,7 @@
       .WillRepeatedly(Return(mock_connection1));
   EXPECT_CALL(*mock_connection1, GetLowerConnection())
       .WillRepeatedly(Return(ConnectionRefPtr()));
-  EXPECT_FALSE(service_->IsDependentOn(NULL));
+  EXPECT_FALSE(service_->IsDependentOn(nullptr));
 
   scoped_refptr<ServiceUnderTest> service1 =
       new ServiceUnderTest(control_interface(),
@@ -1285,24 +1284,23 @@
   EXPECT_TRUE(service_->IsDependentOn(service1));
 
   service_->connection_ = mock_connection1;
-  service1->connection_ = NULL;
+  service1->connection_ = nullptr;
   EXPECT_FALSE(service_->IsDependentOn(service1));
 
-  service_->connection_ = NULL;
+  service_->connection_ = nullptr;
 }
 
 TEST_F(ServiceTest, OnPropertyChanged) {
   scoped_refptr<MockProfile> profile(
       new StrictMock<MockProfile>(control_interface(), metrics(), manager()));
-  service_->set_profile(NULL);
+  service_->set_profile(nullptr);
   // Expect no crash.
   service_->OnPropertyChanged("");
 
   // Expect no call to Update if the profile has no storage.
   service_->set_profile(profile);
   EXPECT_CALL(*profile, UpdateService(_)).Times(0);
-  EXPECT_CALL(*profile, GetConstStorage())
-      .WillOnce(Return(reinterpret_cast<StoreInterface *>(NULL)));
+  EXPECT_CALL(*profile, GetConstStorage()).WillOnce(Return(nullptr));
   service_->OnPropertyChanged("");
 
   // Expect call to Update if the profile has storage.
@@ -1427,7 +1425,7 @@
 
   string property(GetParam().reader().get_string());
   Error error;
-  EXPECT_FALSE(service_->store().GetStringProperty(property, NULL, &error));
+  EXPECT_FALSE(service_->store().GetStringProperty(property, nullptr, &error));
   EXPECT_EQ(Error::kPermissionDenied, error.type());
 }
 
@@ -1473,8 +1471,8 @@
   }
 
   // Assure orderly destruction of the Connection before DeviceInfo.
-  service_->connection_ = NULL;
-  mock_connection = NULL;
+  service_->connection_ = nullptr;
+  mock_connection = nullptr;
   mock_device_info.reset();
 }
 
@@ -1747,7 +1745,7 @@
   EXPECT_CALL(diagnostics_reporter_, OnConnectivityEvent()).Times(0);
   for (int i = 0; i < 2; i++) {
     int now = 0;
-    deque<Timestamp> *events = NULL;
+    deque<Timestamp> *events = nullptr;
     if (i == 0) {
       SetStateField(Service::kStateConnected);
       now = GetDisconnectsMonitorSeconds() + 1;
@@ -1871,7 +1869,7 @@
   EXPECT_TRUE(error.IsSuccess());
   EXPECT_FALSE(service_->auto_connect());
   EXPECT_TRUE(service_->retain_auto_connect());
-  EXPECT_FALSE(GetAutoConnect(NULL));
+  EXPECT_FALSE(GetAutoConnect(nullptr));
   Mock::VerifyAndClearExpectations(&mock_manager_);
 
   // Clear the |retain_auto_connect_| flag for the next test.
@@ -1883,7 +1881,7 @@
   SetAutoConnectFull(true, &error);
   EXPECT_TRUE(error.IsSuccess());
   EXPECT_TRUE(service_->auto_connect());
-  EXPECT_TRUE(GetAutoConnect(NULL));
+  EXPECT_TRUE(GetAutoConnect(nullptr));
   EXPECT_TRUE(service_->retain_auto_connect());
   Mock::VerifyAndClearExpectations(&mock_manager_);
 
@@ -1897,7 +1895,7 @@
   SetAutoConnectFull(true, &error);
   EXPECT_TRUE(error.IsSuccess());
   EXPECT_TRUE(service_->auto_connect());
-  EXPECT_TRUE(GetAutoConnect(NULL));
+  EXPECT_TRUE(GetAutoConnect(nullptr));
   EXPECT_TRUE(service_->retain_auto_connect());
   Mock::VerifyAndClearExpectations(&mock_manager_);
 
@@ -1911,7 +1909,7 @@
   SetAutoConnectFull(false, &error);
   EXPECT_TRUE(error.IsSuccess());
   EXPECT_FALSE(service_->auto_connect());
-  EXPECT_FALSE(GetAutoConnect(NULL));
+  EXPECT_FALSE(GetAutoConnect(nullptr));
   EXPECT_TRUE(service_->retain_auto_connect());
   Mock::VerifyAndClearExpectations(&mock_manager_);
 }
@@ -1950,28 +1948,28 @@
   ClearAutoConnect(&error);
   EXPECT_TRUE(error.IsSuccess());
   EXPECT_FALSE(service_->retain_auto_connect());
-  EXPECT_FALSE(GetAutoConnect(NULL));
+  EXPECT_FALSE(GetAutoConnect(nullptr));
   Mock::VerifyAndClearExpectations(&mock_manager_);
 
   // false -> false
   SetAutoConnectFull(false, &error);
-  EXPECT_FALSE(GetAutoConnect(NULL));
+  EXPECT_FALSE(GetAutoConnect(nullptr));
   EXPECT_TRUE(service_->retain_auto_connect());
   EXPECT_CALL(mock_manager_, UpdateService(_)).Times(0);
   ClearAutoConnect(&error);
   EXPECT_TRUE(error.IsSuccess());
   EXPECT_FALSE(service_->retain_auto_connect());
-  EXPECT_FALSE(GetAutoConnect(NULL));
+  EXPECT_FALSE(GetAutoConnect(nullptr));
   Mock::VerifyAndClearExpectations(&mock_manager_);
 
   // true -> false
   SetAutoConnectFull(true, &error);
   EXPECT_TRUE(error.IsSuccess());
-  EXPECT_TRUE(GetAutoConnect(NULL));
+  EXPECT_TRUE(GetAutoConnect(nullptr));
   EXPECT_CALL(mock_manager_, UpdateService(_)).Times(1);
   ClearAutoConnect(&error);
   EXPECT_FALSE(service_->retain_auto_connect());
-  EXPECT_FALSE(GetAutoConnect(NULL));
+  EXPECT_FALSE(GetAutoConnect(nullptr));
   Mock::VerifyAndClearExpectations(&mock_manager_);
 }
 
diff --git a/shill_main.cc b/shill_main.cc
index 8e509f5..ab88af8 100644
--- a/shill_main.cc
+++ b/shill_main.cc
@@ -81,14 +81,14 @@
     logger_command_line.push_back(const_cast<char *>("daemon.err"));
     logger_command_line.push_back(const_cast<char *>("--tag"));
     logger_command_line.push_back(daemon_name);
-    logger_command_line.push_back(NULL);
+    logger_command_line.push_back(nullptr);
 
     chromeos::Minijail *minijail = chromeos::Minijail::GetInstance();
     struct minijail *jail = minijail->New();
     minijail->DropRoot(jail, kLoggerUser, kLoggerUser);
 
-    if (!minijail->RunPipeAndDestroy(jail, logger_command_line,
-                                     NULL, &logger_stdin_fd)) {
+    if (!minijail->RunPipeAndDestroy(jail, logger_command_line, nullptr,
+                                     &logger_stdin_fd)) {
       LOG(ERROR) << "Unable to spawn logger. "
                  << "Writes to stderr will be discarded.";
       return;
diff --git a/shill_time.cc b/shill_time.cc
index baa4b23..1e9bd5c 100644
--- a/shill_time.cc
+++ b/shill_time.cc
@@ -88,7 +88,7 @@
 
   GetTimeMonotonic(&now_monotonic);
   GetTimeBoottime(&now_boottime);
-  GetTimeOfDay(&now_wall_clock, NULL);
+  GetTimeOfDay(&now_wall_clock, nullptr);
   localtime_r(&now_wall_clock.tv_sec, &local_time);
   wall_clock_string = FormatTime(local_time, now_wall_clock.tv_usec);
 
@@ -119,7 +119,7 @@
 }
 
 time_t Time::GetSecondsSinceEpoch() const {
-  return time(NULL);
+  return time(nullptr);
 }
 
 }  // namespace shill
diff --git a/static_ip_parameters.cc b/static_ip_parameters.cc
index 1734c29..9f342ba 100644
--- a/static_ip_parameters.cc
+++ b/static_ip_parameters.cc
@@ -122,7 +122,7 @@
       kSavedIPConfigProperty,
       KeyValueStoreAccessor(
           new CustomAccessor<StaticIPParameters, KeyValueStore>(
-              this, &StaticIPParameters::GetSavedIPConfig, NULL)));
+              this, &StaticIPParameters::GetSavedIPConfig, nullptr)));
   store->RegisterDerivedKeyValueStore(
       kStaticIPConfigProperty,
       KeyValueStoreAccessor(
diff --git a/static_ip_parameters_unittest.cc b/static_ip_parameters_unittest.cc
index d23dcd5..e492514 100644
--- a/static_ip_parameters_unittest.cc
+++ b/static_ip_parameters_unittest.cc
@@ -196,7 +196,7 @@
 
   {
     Error error;
-    EXPECT_FALSE(store.GetStringProperty("StaticIP.Address", NULL, &error));
+    EXPECT_FALSE(store.GetStringProperty("StaticIP.Address", nullptr, &error));
     EXPECT_EQ(Error::kNotFound, error.type());
   }
   string string_value;
@@ -205,7 +205,7 @@
   EXPECT_EQ(kGateway, string_value);
   {
     Error error;
-    EXPECT_FALSE(store.GetInt32Property("StaticIP.Mtu", NULL, &error));
+    EXPECT_FALSE(store.GetInt32Property("StaticIP.Mtu", nullptr, &error));
     EXPECT_EQ(Error::kNotFound, error.type());
   }
   EXPECT_TRUE(store.GetStringProperty("StaticIP.NameServers", &string_value,
diff --git a/traffic_monitor_unittest.cc b/traffic_monitor_unittest.cc
index 476f002..61dda3b 100644
--- a/traffic_monitor_unittest.cc
+++ b/traffic_monitor_unittest.cc
@@ -51,8 +51,8 @@
   TrafficMonitorTest()
       : device_(new MockDevice(&control_,
                                &dispatcher_,
-                               reinterpret_cast<Metrics *>(NULL),
-                               reinterpret_cast<Manager *>(NULL),
+                               nullptr,
+                               nullptr,
                                "netdev0",
                                "00:11:22:33:44:55",
                                1)),