Changeset 33457 in webkit
- Timestamp:
- May 14, 2008 2:30:46 PM (16 years ago)
- Location:
- trunk/WebCore
- Files:
-
- 3 added
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r33455 r33457 1 2008-05-14 Anders Carlsson <andersca@apple.com> 2 3 Reviewed by Brady. 4 5 <rdar://problem/5931742> Support navigator.onLine from HTML5 6 7 * WebCore.vcproj/WebCore.vcproj: 8 * WebCore.xcodeproj/project.pbxproj: 9 Add NetworkStateNotifier files. 10 11 * dom/EventNames.h: 12 Add offline and online events. 13 14 * page/Navigator.cpp: 15 (WebCore::Navigator::onLine): 16 * page/Navigator.h: 17 * page/Navigator.idl: 18 Add navigator.onLine. 19 20 * page/Page.cpp: 21 (WebCore::networkStateChanged): 22 Dispatch offline/online events to all frames. 23 24 (WebCore::Page::Page): 25 Set state change callback. 26 27 * platform/network/NetworkStateNotifier.cpp: Added. 28 * platform/network/NetworkStateNotifier.h: Added. 29 30 * platform/network/mac/NetworkStateNotifierMac.cpp: Added. 31 Mac network state notifier. 32 1 33 2008-05-14 Adam Roben <aroben@apple.com> 2 34 -
trunk/WebCore/WebCore.vcproj/WebCore.vcproj
r33410 r33457 6302 6302 </File> 6303 6303 <File 6304 RelativePath="..\platform\network\NetworkStateNotifier.h" 6305 > 6306 </File> 6307 <File 6308 RelativePath="..\platform\network\NetworkStateNotifier.cpp" 6309 > 6310 </File> 6311 <File 6304 6312 RelativePath="..\platform\network\ProtectionSpace.cpp" 6305 6313 > -
trunk/WebCore/WebCore.xcodeproj/project.pbxproj
r33400 r33457 182 182 1A7CCB1C0CD9469A00B7B64E /* SQLTransactionErrorCallback.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A7CCB180CD9469A00B7B64E /* SQLTransactionErrorCallback.h */; }; 183 183 1A7CCB240CD946FD00B7B64E /* SQLTransaction.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A7CCB220CD946FD00B7B64E /* SQLTransaction.h */; }; 184 1A7FA6190DDA3B3A0028F8A5 /* NetworkStateNotifier.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A7FA6180DDA3B3A0028F8A5 /* NetworkStateNotifier.h */; }; 185 1A7FA61B0DDA3BBE0028F8A5 /* NetworkStateNotifier.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A7FA61A0DDA3BBE0028F8A5 /* NetworkStateNotifier.cpp */; }; 186 1A7FA6490DDA3CBA0028F8A5 /* NetworkStateNotifierMac.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A7FA6470DDA3CBA0028F8A5 /* NetworkStateNotifierMac.cpp */; }; 187 1A7FA7CC0DDA4B770028F8A5 /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1A7FA7CB0DDA4B770028F8A5 /* SystemConfiguration.framework */; }; 184 188 1A820D910A13EBA600AF843C /* ImageDocument.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A820D8F0A13EBA600AF843C /* ImageDocument.cpp */; }; 185 189 1A820D920A13EBA600AF843C /* ImageDocument.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A820D900A13EBA600AF843C /* ImageDocument.h */; }; … … 4635 4639 1A7CCB220CD946FD00B7B64E /* SQLTransaction.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SQLTransaction.h; sourceTree = "<group>"; }; 4636 4640 1A7CCB230CD946FD00B7B64E /* SQLTransaction.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = SQLTransaction.idl; sourceTree = "<group>"; }; 4641 1A7FA6180DDA3B3A0028F8A5 /* NetworkStateNotifier.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NetworkStateNotifier.h; sourceTree = "<group>"; }; 4642 1A7FA61A0DDA3BBE0028F8A5 /* NetworkStateNotifier.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NetworkStateNotifier.cpp; sourceTree = "<group>"; }; 4643 1A7FA6470DDA3CBA0028F8A5 /* NetworkStateNotifierMac.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NetworkStateNotifierMac.cpp; sourceTree = "<group>"; }; 4644 1A7FA7CB0DDA4B770028F8A5 /* SystemConfiguration.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SystemConfiguration.framework; path = /System/Library/Frameworks/SystemConfiguration.framework; sourceTree = "<absolute>"; }; 4637 4645 1A820D8F0A13EBA600AF843C /* ImageDocument.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = ImageDocument.cpp; sourceTree = "<group>"; }; 4638 4646 1A820D900A13EBA600AF843C /* ImageDocument.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = ImageDocument.h; sourceTree = "<group>"; }; … … 8376 8384 1CFAE3230A6D6A3F0032593D /* libobjc.dylib in Frameworks */, 8377 8385 DD763BB20992C2C900740B8E /* libxml2.dylib in Frameworks */, 8386 1A7FA7CC0DDA4B770028F8A5 /* SystemConfiguration.framework in Frameworks */, 8378 8387 ); 8379 8388 runOnlyForDeploymentPostprocessing = 0; … … 8435 8444 DD763BB10992C2C900740B8E /* libxml2.dylib */, 8436 8445 A85D7A2F0879EBA9006A9172 /* QuartzCore.framework */, 8446 1A7FA7CB0DDA4B770028F8A5 /* SystemConfiguration.framework */, 8437 8447 ); 8438 8448 name = Frameworks; … … 8891 8901 514C765D0CE923A1007EF3CD /* HTTPParsers.cpp */, 8892 8902 514C765E0CE923A1007EF3CD /* HTTPParsers.h */, 8903 1A7FA61A0DDA3BBE0028F8A5 /* NetworkStateNotifier.cpp */, 8904 1A7FA6180DDA3B3A0028F8A5 /* NetworkStateNotifier.h */, 8893 8905 514C765F0CE923A1007EF3CD /* ProtectionSpace.cpp */, 8894 8906 514C76600CE923A1007EF3CD /* ProtectionSpace.h */, … … 8914 8926 514C76440CE9234E007EF3CD /* FormDataStreamMac.h */, 8915 8927 514C76450CE9234E007EF3CD /* FormDataStreamMac.mm */, 8928 1A7FA6470DDA3CBA0028F8A5 /* NetworkStateNotifierMac.cpp */, 8916 8929 514C76460CE9234E007EF3CD /* ResourceErrorMac.mm */, 8917 8930 514C76470CE9234E007EF3CD /* ResourceHandleMac.mm */, … … 15080 15093 BC34C33F0DD607DE00090123 /* AccessItemRule.h in Headers */, 15081 15094 BC76AC130DD7AD5C00415F34 /* ParserUtilities.h in Headers */, 15095 1A7FA6190DDA3B3A0028F8A5 /* NetworkStateNotifier.h in Headers */, 15082 15096 ); 15083 15097 runOnlyForDeploymentPostprocessing = 0; … … 16794 16808 BC34C33C0DD607DE00090123 /* AccessItem.cpp in Sources */, 16795 16809 BC34C33E0DD607DE00090123 /* AccessItemRule.cpp in Sources */, 16810 1A7FA61B0DDA3BBE0028F8A5 /* NetworkStateNotifier.cpp in Sources */, 16811 1A7FA6490DDA3CBA0028F8A5 /* NetworkStateNotifierMac.cpp in Sources */, 16796 16812 ); 16797 16813 runOnlyForDeploymentPostprocessing = 0; -
trunk/WebCore/dom/EventNames.h
r32006 r33457 66 66 macro(mousewheel) \ 67 67 macro(noupdate) \ 68 macro(offline) \ 69 macro(online) \ 68 70 macro(overflowchanged) \ 69 71 macro(paste) \ -
trunk/WebCore/page/Navigator.cpp
r30923 r33457 30 30 #include "Language.h" 31 31 #include "MimeTypeArray.h" 32 #include "NetworkStateNotifier.h" 32 33 #include "PlatformString.h" 33 34 #include "PluginArray.h" … … 170 171 return m_frame->settings()->isJavaEnabled(); 171 172 } 173 174 bool Navigator::onLine() const 175 { 176 return networkStateNotifier().onLine(); 177 } 172 178 173 179 } // namespace WebCore -
trunk/WebCore/page/Navigator.h
r30923 r33457 56 56 bool javaEnabled() const; 57 57 58 bool onLine() const; 58 59 private: 59 60 Navigator(Frame*); -
trunk/WebCore/page/Navigator.idl
r30923 r33457 35 35 readonly attribute boolean cookieEnabled; 36 36 boolean javaEnabled(); 37 38 readonly attribute boolean onLine; 37 39 }; 38 40 -
trunk/WebCore/page/Page.cpp
r33447 r33457 29 29 #include "DOMWindow.h" 30 30 #include "DragController.h" 31 #include "EventNames.h" 31 32 #include "FileSystem.h" 32 33 #include "FocusController.h" … … 39 40 #include "JavaScriptDebugServer.h" 40 41 #include "Logging.h" 42 #include "NetworkStateNotifier.h" 41 43 #include "Navigator.h" 42 44 #include "PageGroup.h" … … 62 64 namespace WebCore { 63 65 66 using namespace EventNames; 67 64 68 static HashSet<Page*>* allPages; 65 69 … … 79 83 #endif 80 84 85 static void networkStateChanged() 86 { 87 Vector<RefPtr<Frame> > frames; 88 89 // Get all the frames of all the pages in all the page groups 90 HashSet<Page*>::iterator end = allPages->end(); 91 for (HashSet<Page*>::iterator it = allPages->begin(); it != end; ++it) { 92 for (Frame* frame = (*it)->mainFrame(); frame; frame = frame->tree()->traverseNext()) 93 frames.append(frame); 94 } 95 96 AtomicString eventName = networkStateNotifier().onLine() ? onlineEvent : offlineEvent; 97 98 for (unsigned i = 0; i < frames.size(); i++) { 99 Document* document = frames[i]->document(); 100 101 if (!document) 102 continue; 103 104 // If the document does not have a body the event should be dispatched to the document 105 EventTargetNode* eventTarget = document->body(); 106 if (!eventTarget) 107 eventTarget = document; 108 109 eventTarget->dispatchHTMLEvent(eventName, false, false); 110 } 111 } 112 81 113 Page::Page(ChromeClient* chromeClient, ContextMenuClient* contextMenuClient, EditorClient* editorClient, DragClient* dragClient, InspectorClient* inspectorClient) 82 114 : m_chrome(new Chrome(this, chromeClient)) … … 103 135 allPages = new HashSet<Page*>; 104 136 setFocusRingColorChangeFunction(setNeedsReapplyStyles); 137 138 networkStateNotifier().setNetworkStateChangedFunction(networkStateChanged); 105 139 } 106 140
Note: See TracChangeset
for help on using the changeset viewer.