summaryrefslogtreecommitdiffstats
path: root/net/base/network_change_notifier_win.cc
diff options
context:
space:
mode:
authorwillchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-01-22 03:04:26 +0000
committerwillchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-01-22 03:04:26 +0000
commitfe0f84184b33ea539c79102eb13f7401baaeb892 (patch)
treebf19da0bbde0ca4df133b974ba823bf199d94071 /net/base/network_change_notifier_win.cc
parent25e65ec8c39b3ba0a420f60d6c5c6021ef317b56 (diff)
downloadchromium_src-fe0f84184b33ea539c79102eb13f7401baaeb892.zip
chromium_src-fe0f84184b33ea539c79102eb13f7401baaeb892.tar.gz
chromium_src-fe0f84184b33ea539c79102eb13f7401baaeb892.tar.bz2
Revert 36837 (caused XP unit_tests crashes) - Implement NetworkChangeNotifierWin.
Uses the NotifyAddrChange() API to detect ip address changes. BUG=http://crbug.com/26156 Review URL: http://codereview.chromium.org/551077 TBR=willchan@chromium.org Review URL: http://codereview.chromium.org/543167 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@36842 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/base/network_change_notifier_win.cc')
-rw-r--r--net/base/network_change_notifier_win.cc60
1 files changed, 1 insertions, 59 deletions
diff --git a/net/base/network_change_notifier_win.cc b/net/base/network_change_notifier_win.cc
index e52bd46..711bd66 100644
--- a/net/base/network_change_notifier_win.cc
+++ b/net/base/network_change_notifier_win.cc
@@ -3,68 +3,10 @@
// found in the LICENSE file.
#include "net/base/network_change_notifier_win.h"
-#include <iphlpapi.h>
-#include <windows.h>
-#include <winsock2.h>
-#include "base/basictypes.h"
-#include "base/compiler_specific.h"
-#include "base/logging.h"
-#include "base/object_watcher.h"
namespace net {
-class NetworkChangeNotifierWin::Impl
- : public base::ObjectWatcher::Delegate {
- public:
- explicit Impl(NetworkChangeNotifierWin* notifier);
- virtual ~Impl();
-
- void WatchForAddressChange();
-
- // ObjectWatcher::Delegate methods:
-
- virtual void OnObjectSignaled(HANDLE object);
-
- private:
- NetworkChangeNotifierWin* const notifier_;
- base::ObjectWatcher addr_watcher_;
- OVERLAPPED addr_overlapped_;
-
- DISALLOW_COPY_AND_ASSIGN(Impl);
-};
-
-NetworkChangeNotifierWin::Impl::Impl(NetworkChangeNotifierWin* notifier)
- : notifier_(notifier) {
- memset(&addr_overlapped_, 0, sizeof(addr_overlapped_));
- addr_overlapped_.hEvent = WSACreateEvent();
-}
-
-NetworkChangeNotifierWin::Impl::~Impl() {
- CancelIPChangeNotify(&addr_overlapped_);
- addr_watcher_.StopWatching();
- WSACloseEvent(addr_overlapped_.hEvent);
- memset(&addr_overlapped_, 0, sizeof(addr_overlapped_));
-}
-
-void NetworkChangeNotifierWin::Impl::WatchForAddressChange() {
- HANDLE handle = NULL;
- DWORD ret = NotifyAddrChange(&handle, &addr_overlapped_);
- CHECK(ret == ERROR_IO_PENDING);
- addr_watcher_.StartWatching(addr_overlapped_.hEvent, this);
-}
-
-void NetworkChangeNotifierWin::Impl::OnObjectSignaled(HANDLE object) {
- notifier_->OnIPAddressChanged();
-
- // Start watching for further address changes.
- WatchForAddressChange();
-}
-
-NetworkChangeNotifierWin::NetworkChangeNotifierWin()
- : impl_(new Impl(ALLOW_THIS_IN_INITIALIZER_LIST(this))) {
- impl_->WatchForAddressChange();
-}
-
+NetworkChangeNotifierWin::NetworkChangeNotifierWin() {}
NetworkChangeNotifierWin::~NetworkChangeNotifierWin() {}
} // namespace net