Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 43 | 43 |
| 44 // For unit tests only. | 44 // For unit tests only. |
| 45 bool is_watching() { return is_watching_; } | 45 bool is_watching() { return is_watching_; } |
| 46 void set_is_watching(bool is_watching) { is_watching_ = is_watching; } | 46 void set_is_watching(bool is_watching) { is_watching_ = is_watching; } |
| 47 int sequential_failures() { return sequential_failures_; } | 47 int sequential_failures() { return sequential_failures_; } |
| 48 | 48 |
| 49 private: | 49 private: |
| 50 friend class NetworkChangeNotifierWinTest; | 50 friend class NetworkChangeNotifierWinTest; |
| 51 | 51 |
| 52 // NetworkChangeNotifier methods: | 52 // NetworkChangeNotifier methods: |
| 53 virtual bool IsCurrentlyOffline() const OVERRIDE; | 53 virtual ConnectionType GetCurrentConnectionType() const OVERRIDE; |
| 54 | 54 |
| 55 // ObjectWatcher::Delegate methods: | 55 // ObjectWatcher::Delegate methods: |
| 56 // Must only be called on the thread |this| was created on. | 56 // Must only be called on the thread |this| was created on. |
| 57 virtual void OnObjectSignaled(HANDLE object) OVERRIDE; | 57 virtual void OnObjectSignaled(HANDLE object) OVERRIDE; |
| 58 | 58 |
| 59 // Notifies IP address change observers of a change immediately, and notifies | 59 // Notifies IP address change observers of a change immediately, and notifies |
| 60 // network state change observers on a delay. Must only be called on the | 60 // network state change observers on a delay. Must only be called on the |
| 61 // thread |this| was created on. | 61 // thread |this| was created on. |
| 62 void NotifyObservers(); | 62 void NotifyObservers(); |
| 63 | 63 |
| 64 // Forwards online state notifications to parent class. | 64 // Forwards online state notifications to parent class. |
|
wtc
2012/05/11 18:46:22
online state => network connection type
| |
| 65 void NotifyParentOfOnlineStateChange(); | 65 void NotifyParentOfConnectionTypeChange(); |
| 66 | 66 |
| 67 // Tries to start listening for a single subsequent address change. Returns | 67 // Tries to start listening for a single subsequent address change. Returns |
| 68 // false on failure. The caller is responsible for updating |is_watching_|. | 68 // false on failure. The caller is responsible for updating |is_watching_|. |
| 69 // Virtual for unit tests. Must only be called on the thread |this| was | 69 // Virtual for unit tests. Must only be called on the thread |this| was |
| 70 // created on. | 70 // created on. |
| 71 virtual bool WatchForAddressChangeInternal(); | 71 virtual bool WatchForAddressChangeInternal(); |
| 72 | 72 |
| 73 // All member variables may only be accessed on the thread |this| was created | 73 // All member variables may only be accessed on the thread |this| was created |
| 74 // on. | 74 // on. |
| 75 | 75 |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 88 | 88 |
| 89 // Used for calling WatchForAddressChange again on failure. | 89 // Used for calling WatchForAddressChange again on failure. |
| 90 base::WeakPtrFactory<NetworkChangeNotifierWin> weak_factory_; | 90 base::WeakPtrFactory<NetworkChangeNotifierWin> weak_factory_; |
| 91 | 91 |
| 92 DISALLOW_COPY_AND_ASSIGN(NetworkChangeNotifierWin); | 92 DISALLOW_COPY_AND_ASSIGN(NetworkChangeNotifierWin); |
| 93 }; | 93 }; |
| 94 | 94 |
| 95 } // namespace net | 95 } // namespace net |
| 96 | 96 |
| 97 #endif // NET_BASE_NETWORK_CHANGE_NOTIFIER_WIN_H_ | 97 #endif // NET_BASE_NETWORK_CHANGE_NOTIFIER_WIN_H_ |
| OLD | NEW |