| 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 #ifndef NET_BASE_NETWORK_CHANGE_NOTIFIER_WIN_H_ | 5 #ifndef NET_BASE_NETWORK_CHANGE_NOTIFIER_WIN_H_ |
| 6 #define NET_BASE_NETWORK_CHANGE_NOTIFIER_WIN_H_ | 6 #define NET_BASE_NETWORK_CHANGE_NOTIFIER_WIN_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <windows.h> | 9 #include <windows.h> |
| 10 | 10 |
| 11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 12 #include "base/timer.h" |
| 12 #include "base/win/object_watcher.h" | 13 #include "base/win/object_watcher.h" |
| 13 #include "net/base/network_change_notifier.h" | 14 #include "net/base/network_change_notifier.h" |
| 14 | 15 |
| 15 namespace net { | 16 namespace net { |
| 16 | 17 |
| 17 class NetworkChangeNotifierWin : public NetworkChangeNotifier, | 18 class NetworkChangeNotifierWin : public NetworkChangeNotifier, |
| 18 public base::win::ObjectWatcher::Delegate { | 19 public base::win::ObjectWatcher::Delegate { |
| 19 public: | 20 public: |
| 20 NetworkChangeNotifierWin(); | 21 NetworkChangeNotifierWin(); |
| 21 | 22 |
| 22 private: | 23 private: |
| 23 virtual ~NetworkChangeNotifierWin(); | 24 virtual ~NetworkChangeNotifierWin(); |
| 24 | 25 |
| 25 // NetworkChangeNotifier methods: | 26 // NetworkChangeNotifier methods: |
| 26 virtual bool IsCurrentlyOffline() const; | 27 virtual bool IsCurrentlyOffline() const; |
| 27 | 28 |
| 28 // ObjectWatcher::Delegate methods: | 29 // ObjectWatcher::Delegate methods: |
| 29 virtual void OnObjectSignaled(HANDLE object); | 30 virtual void OnObjectSignaled(HANDLE object); |
| 30 | 31 |
| 31 // Begins listening for a single subsequent address change. | 32 // Begins listening for a single subsequent address change. |
| 32 void WatchForAddressChange(); | 33 void WatchForAddressChange(); |
| 33 | 34 |
| 35 // Forwards online state notifications to parent class. |
| 36 void NotifyParentOfOnlineStateChange(); |
| 37 |
| 34 base::win::ObjectWatcher addr_watcher_; | 38 base::win::ObjectWatcher addr_watcher_; |
| 35 OVERLAPPED addr_overlapped_; | 39 OVERLAPPED addr_overlapped_; |
| 36 | 40 |
| 41 base::OneShotTimer<NetworkChangeNotifierWin> timer_; |
| 42 |
| 37 DISALLOW_COPY_AND_ASSIGN(NetworkChangeNotifierWin); | 43 DISALLOW_COPY_AND_ASSIGN(NetworkChangeNotifierWin); |
| 38 }; | 44 }; |
| 39 | 45 |
| 40 } // namespace net | 46 } // namespace net |
| 41 | 47 |
| 42 #endif // NET_BASE_NETWORK_CHANGE_NOTIFIER_WIN_H_ | 48 #endif // NET_BASE_NETWORK_CHANGE_NOTIFIER_WIN_H_ |
| OLD | NEW |