| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. | 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 void setNetworkStateChangedFunction(void (*)()); | 60 void setNetworkStateChangedFunction(void (*)()); |
| 61 | 61 |
| 62 bool onLine() const { return m_isOnLine; } | 62 bool onLine() const { return m_isOnLine; } |
| 63 | 63 |
| 64 #if (PLATFORM(QT) && !defined(QT_NO_BEARERMANAGEMENT)) | 64 #if (PLATFORM(QT) && !defined(QT_NO_BEARERMANAGEMENT)) |
| 65 void setNetworkAccessAllowed(bool); | 65 void setNetworkAccessAllowed(bool); |
| 66 #elif PLATFORM(CHROMIUM) | 66 #elif PLATFORM(CHROMIUM) |
| 67 void setOnLine(bool); | 67 void setOnLine(bool); |
| 68 #endif | 68 #endif |
| 69 | 69 |
| 70 #if PLATFORM(BLACKBERRY) | |
| 71 void networkStateChange(bool online); | |
| 72 #endif | |
| 73 | |
| 74 private: | 70 private: |
| 75 bool m_isOnLine; | 71 bool m_isOnLine; |
| 76 void (*m_networkStateChangedFunction)(); | 72 void (*m_networkStateChangedFunction)(); |
| 77 | 73 |
| 78 void updateState(); | 74 void updateState(); |
| 79 | 75 |
| 80 #if PLATFORM(MAC) | 76 #if PLATFORM(MAC) |
| 81 void networkStateChangeTimerFired(Timer<NetworkStateNotifier>*); | 77 void networkStateChangeTimerFired(Timer<NetworkStateNotifier>*); |
| 82 | 78 |
| 83 static void dynamicStoreCallback(SCDynamicStoreRef, CFArrayRef changedKeys,
void *info); | 79 static void dynamicStoreCallback(SCDynamicStoreRef, CFArrayRef changedKeys,
void *info); |
| 84 | 80 |
| 85 RetainPtr<SCDynamicStoreRef> m_store; | 81 RetainPtr<SCDynamicStoreRef> m_store; |
| 86 Timer<NetworkStateNotifier> m_networkStateChangeTimer; | 82 Timer<NetworkStateNotifier> m_networkStateChangeTimer; |
| 87 | 83 |
| 88 #elif PLATFORM(WIN) | 84 #elif PLATFORM(WIN) |
| 89 static void CALLBACK addrChangeCallback(void*, BOOLEAN timedOut); | 85 static void CALLBACK addrChangeCallback(void*, BOOLEAN timedOut); |
| 90 static void callAddressChanged(void*); | 86 static void callAddressChanged(void*); |
| 91 void addressChanged(); | 87 void addressChanged(); |
| 92 | 88 |
| 93 void registerForAddressChange(); | 89 void registerForAddressChange(); |
| 94 HANDLE m_waitHandle; | 90 HANDLE m_waitHandle; |
| 95 OVERLAPPED m_overlapped; | 91 OVERLAPPED m_overlapped; |
| 96 | 92 |
| 97 #elif (PLATFORM(QT) && !defined(QT_NO_BEARERMANAGEMENT)) | 93 #elif (PLATFORM(QT) && !defined(QT_NO_BEARERMANAGEMENT)) |
| 98 friend class NetworkStateNotifierPrivate; | 94 friend class NetworkStateNotifierPrivate; |
| 99 NetworkStateNotifierPrivate* p; | 95 NetworkStateNotifierPrivate* p; |
| 100 #endif | 96 #endif |
| 101 }; | 97 }; |
| 102 | 98 |
| 103 #if !PLATFORM(MAC) && !PLATFORM(WIN) && !(PLATFORM(QT) && !defined(QT_NO_BEARERM
ANAGEMENT)) && !PLATFORM(BLACKBERRY) | 99 #if !PLATFORM(MAC) && !PLATFORM(WIN) && !(PLATFORM(QT) && !defined(QT_NO_BEARERM
ANAGEMENT)) |
| 104 | 100 |
| 105 inline NetworkStateNotifier::NetworkStateNotifier() | 101 inline NetworkStateNotifier::NetworkStateNotifier() |
| 106 : m_isOnLine(true) | 102 : m_isOnLine(true) |
| 107 , m_networkStateChangedFunction(0) | 103 , m_networkStateChangedFunction(0) |
| 108 { | 104 { |
| 109 } | 105 } |
| 110 | 106 |
| 111 inline void NetworkStateNotifier::updateState() { } | 107 inline void NetworkStateNotifier::updateState() { } |
| 112 | 108 |
| 113 #endif | 109 #endif |
| 114 | 110 |
| 115 NetworkStateNotifier& networkStateNotifier(); | 111 NetworkStateNotifier& networkStateNotifier(); |
| 116 | 112 |
| 117 }; | 113 }; |
| 118 | 114 |
| 119 #endif // NetworkStateNotifier_h | 115 #endif // NetworkStateNotifier_h |
| OLD | NEW |