| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "net/base/network_change_notifier_win.h" | 5 #include "net/base/network_change_notifier_win.h" |
| 6 | 6 |
| 7 #include <iphlpapi.h> | 7 #include <iphlpapi.h> |
| 8 #include <winsock2.h> | 8 #include <winsock2.h> |
| 9 | 9 |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 timer_.Start(base::TimeDelta::FromSeconds(1), this, | 156 timer_.Start(base::TimeDelta::FromSeconds(1), this, |
| 157 &NetworkChangeNotifierWin::NotifyParentOfOnlineStateChange); | 157 &NetworkChangeNotifierWin::NotifyParentOfOnlineStateChange); |
| 158 | 158 |
| 159 // Start watching for the next address change. | 159 // Start watching for the next address change. |
| 160 WatchForAddressChange(); | 160 WatchForAddressChange(); |
| 161 } | 161 } |
| 162 | 162 |
| 163 void NetworkChangeNotifierWin::WatchForAddressChange() { | 163 void NetworkChangeNotifierWin::WatchForAddressChange() { |
| 164 HANDLE handle = NULL; | 164 HANDLE handle = NULL; |
| 165 DWORD ret = NotifyAddrChange(&handle, &addr_overlapped_); | 165 DWORD ret = NotifyAddrChange(&handle, &addr_overlapped_); |
| 166 CHECK(ret == ERROR_IO_PENDING); | 166 CHECK_EQ(static_cast<DWORD>(ERROR_IO_PENDING), ret); |
| 167 addr_watcher_.StartWatching(addr_overlapped_.hEvent, this); | 167 addr_watcher_.StartWatching(addr_overlapped_.hEvent, this); |
| 168 } | 168 } |
| 169 | 169 |
| 170 void NetworkChangeNotifierWin::NotifyParentOfOnlineStateChange() { | 170 void NetworkChangeNotifierWin::NotifyParentOfOnlineStateChange() { |
| 171 NotifyObserversOfOnlineStateChange(); | 171 NotifyObserversOfOnlineStateChange(); |
| 172 } | 172 } |
| 173 | 173 |
| 174 } // namespace net | 174 } // namespace net |
| OLD | NEW |