| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 // For unit tests only. | 45 // For unit tests only. |
| 46 bool is_watching() { return is_watching_; } | 46 bool is_watching() { return is_watching_; } |
| 47 void set_is_watching(bool is_watching) { is_watching_ = is_watching; } | 47 void set_is_watching(bool is_watching) { is_watching_ = is_watching; } |
| 48 int sequential_failures() { return sequential_failures_; } | 48 int sequential_failures() { return sequential_failures_; } |
| 49 | 49 |
| 50 private: | 50 private: |
| 51 class DnsWatcherThread; | 51 class DnsWatcherThread; |
| 52 friend class NetworkChangeNotifierWinTest; | 52 friend class NetworkChangeNotifierWinTest; |
| 53 | 53 |
| 54 // NetworkChangeNotifier methods: | 54 // NetworkChangeNotifier methods: |
| 55 virtual bool IsCurrentlyOffline() const OVERRIDE; | 55 virtual ConnectionType GetCurrentConnectionType() const OVERRIDE; |
| 56 | 56 |
| 57 // ObjectWatcher::Delegate methods: | 57 // ObjectWatcher::Delegate methods: |
| 58 // Must only be called on the thread |this| was created on. | 58 // Must only be called on the thread |this| was created on. |
| 59 virtual void OnObjectSignaled(HANDLE object) OVERRIDE; | 59 virtual void OnObjectSignaled(HANDLE object) OVERRIDE; |
| 60 | 60 |
| 61 // Notifies IP address change observers of a change immediately, and notifies | 61 // Notifies IP address change observers of a change immediately, and notifies |
| 62 // network state change observers on a delay. Must only be called on the | 62 // network state change observers on a delay. Must only be called on the |
| 63 // thread |this| was created on. | 63 // thread |this| was created on. |
| 64 void NotifyObservers(); | 64 void NotifyObservers(); |
| 65 | 65 |
| 66 // Forwards online state notifications to parent class. | 66 // Forwards connection type notifications to parent class. |
| 67 void NotifyParentOfOnlineStateChange(); | 67 void NotifyParentOfConnectionTypeChange(); |
| 68 | 68 |
| 69 // Tries to start listening for a single subsequent address change. Returns | 69 // Tries to start listening for a single subsequent address change. Returns |
| 70 // false on failure. The caller is responsible for updating |is_watching_|. | 70 // false on failure. The caller is responsible for updating |is_watching_|. |
| 71 // Virtual for unit tests. Must only be called on the thread |this| was | 71 // Virtual for unit tests. Must only be called on the thread |this| was |
| 72 // created on. | 72 // created on. |
| 73 virtual bool WatchForAddressChangeInternal(); | 73 virtual bool WatchForAddressChangeInternal(); |
| 74 | 74 |
| 75 // All member variables may only be accessed on the thread |this| was created | 75 // All member variables may only be accessed on the thread |this| was created |
| 76 // on. | 76 // on. |
| 77 | 77 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 93 | 93 |
| 94 // Thread on which we can run DnsConfigWatcher. | 94 // Thread on which we can run DnsConfigWatcher. |
| 95 scoped_ptr<DnsWatcherThread> dns_watcher_thread_; | 95 scoped_ptr<DnsWatcherThread> dns_watcher_thread_; |
| 96 | 96 |
| 97 DISALLOW_COPY_AND_ASSIGN(NetworkChangeNotifierWin); | 97 DISALLOW_COPY_AND_ASSIGN(NetworkChangeNotifierWin); |
| 98 }; | 98 }; |
| 99 | 99 |
| 100 } // namespace net | 100 } // namespace net |
| 101 | 101 |
| 102 #endif // NET_BASE_NETWORK_CHANGE_NOTIFIER_WIN_H_ | 102 #endif // NET_BASE_NETWORK_CHANGE_NOTIFIER_WIN_H_ |
| OLD | NEW |