| 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 | 7 |
| 8 #include "base/basictypes.h" | 8 #include <windows.h> |
| 9 #include "base/non_thread_safe.h" | 9 |
| 10 #include "base/object_watcher.h" | 10 #include "base/object_watcher.h" |
| 11 #include "base/observer_list.h" | |
| 12 #include "net/base/network_change_notifier.h" | 11 #include "net/base/network_change_notifier.h" |
| 13 | 12 |
| 14 namespace net { | 13 namespace net { |
| 15 | 14 |
| 16 class NetworkChangeNotifierWin : public NetworkChangeNotifier, | 15 class NetworkChangeNotifierWin : public NetworkChangeNotifier, |
| 17 public NonThreadSafe { | 16 public base::ObjectWatcher::Delegate { |
| 18 public: | 17 public: |
| 19 NetworkChangeNotifierWin(); | 18 NetworkChangeNotifierWin(); |
| 20 | 19 |
| 21 // Called by NetworkChangeNotifierWin::Impl. | |
| 22 void OnIPAddressChanged(); | |
| 23 | |
| 24 // NetworkChangeNotifier methods: | |
| 25 virtual void AddObserver(Observer* observer); | |
| 26 virtual void RemoveObserver(Observer* observer); | |
| 27 | |
| 28 private: | 20 private: |
| 29 class Impl; | |
| 30 | |
| 31 virtual ~NetworkChangeNotifierWin(); | 21 virtual ~NetworkChangeNotifierWin(); |
| 32 | 22 |
| 33 // TODO(willchan): Fix the URLRequestContextGetter leaks and flip the false to | 23 // ObjectWatcher::Delegate methods: |
| 34 // true so we assert that all observers have been removed. | 24 virtual void OnObjectSignaled(HANDLE object); |
| 35 ObserverList<Observer, false> observers_; | 25 |
| 36 scoped_ptr<Impl> impl_; | 26 // Begins listening for a single subsequent address change. |
| 27 void WatchForAddressChange(); |
| 28 |
| 29 base::ObjectWatcher addr_watcher_; |
| 30 OVERLAPPED addr_overlapped_; |
| 37 | 31 |
| 38 DISALLOW_COPY_AND_ASSIGN(NetworkChangeNotifierWin); | 32 DISALLOW_COPY_AND_ASSIGN(NetworkChangeNotifierWin); |
| 39 }; | 33 }; |
| 40 | 34 |
| 41 } // namespace net | 35 } // namespace net |
| 42 | 36 |
| 43 #endif // NET_BASE_NETWORK_CHANGE_NOTIFIER_WIN_H_ | 37 #endif // NET_BASE_NETWORK_CHANGE_NOTIFIER_WIN_H_ |
| OLD | NEW |