Changeset 98285 in webkit
- Timestamp:
- Oct 24, 2011, 3:07:24 PM (14 years ago)
- Location:
- trunk/Source/WebKit2
- Files:
-
- 1 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit2/ChangeLog
r98280 r98285 1 2011-10-24 Sam Weinig <sam@webkit.org> 2 3 Hook up minimalist load delegate to WKBrowsingContextController 4 https://bugs.webkit.org/show_bug.cgi?id=70764 5 6 Reviewed by Simon Fraser. 7 8 * UIProcess/API/mac/WKBrowsingContextController.h: 9 * UIProcess/API/mac/WKBrowsingContextController.mm: 10 (-[WKBrowsingContextController loadDelegate]): 11 (-[WKBrowsingContextController setLoadDelegate:]): 12 Add loadDelegate getter/setter. As per convention, the delegate is not 13 retained. 14 15 (didStartProvisionalLoadForFrame): 16 (didCommitLoadForFrame): 17 (didFinishLoadForFrame): 18 (setUpPageLoaderClient): 19 (-[WKBrowsingContextController initWithPageRef:]): 20 Hookup the delegate to a WKPageLoaderClient. 21 22 * UIProcess/API/mac/WKBrowsingContextLoadDelegate.h: Added. 23 Add load delegate as a proper protocol. 24 25 * WebKit2.xcodeproj/project.pbxproj: 26 Add new file. 27 1 28 2011-10-24 Michael Saboff <msaboff@apple.com> 2 29 -
trunk/Source/WebKit2/UIProcess/API/mac/WKBrowsingContextController.h
r98270 r98285 28 28 29 29 @class WKBrowsingContextControllerData; 30 @protocol WKBrowsingContextLoadDelegate; 30 31 31 32 WK_EXPORT … … 34 35 WKBrowsingContextControllerData *_data; 35 36 } 37 38 #pragma mark Delegates 39 40 @property(assign) id<WKBrowsingContextLoadDelegate> loadDelegate; 41 36 42 37 43 #pragma mark Loading -
trunk/Source/WebKit2/UIProcess/API/mac/WKBrowsingContextController.mm
r98270 r98285 36 36 #import "WKURLRequestNS.h" 37 37 38 #import "WKBrowsingContextLoadDelegate.h" 38 39 39 40 static inline NSString *autoreleased(WKStringRef string) … … 52 53 @interface WKBrowsingContextControllerData : NSObject { 53 54 @public 55 // Underlying WKPageRef. 54 56 WKRetainPtr<WKPageRef> _pageRef; 57 58 // Delegate for load callbacks. 59 id<WKBrowsingContextLoadDelegate> _loadDelegate; 55 60 } 56 61 @end … … 72 77 } 73 78 79 #pragma mark Delegates 80 81 - (id<WKBrowsingContextLoadDelegate>)loadDelegate 82 { 83 return _data->_loadDelegate; 84 } 85 86 - (void)setLoadDelegate:(id<WKBrowsingContextLoadDelegate>)loadDelegate 87 { 88 _data->_loadDelegate = loadDelegate; 89 } 90 91 74 92 #pragma mark Loading 75 93 … … 185 203 186 204 @implementation WKBrowsingContextController (Internal) 205 206 static void didStartProvisionalLoadForFrame(WKPageRef page, WKFrameRef frame, WKTypeRef userData, const void* clientInfo) 207 { 208 if (!WKFrameIsMainFrame(frame)) 209 return; 210 211 WKBrowsingContextController *browsingContext = (WKBrowsingContextController *)clientInfo; 212 [browsingContext.loadDelegate browsingContextControllerDidStartProvisionalLoad:browsingContext]; 213 } 214 215 static void didCommitLoadForFrame(WKPageRef page, WKFrameRef frame, WKTypeRef userData, const void* clientInfo) 216 { 217 if (!WKFrameIsMainFrame(frame)) 218 return; 219 220 WKBrowsingContextController *browsingContext = (WKBrowsingContextController *)clientInfo; 221 [browsingContext.loadDelegate browsingContextControllerDidCommitLoad:browsingContext]; 222 } 223 224 static void didFinishLoadForFrame(WKPageRef page, WKFrameRef frame, WKTypeRef userData, const void* clientInfo) 225 { 226 if (!WKFrameIsMainFrame(frame)) 227 return; 228 229 WKBrowsingContextController *browsingContext = (WKBrowsingContextController *)clientInfo; 230 [browsingContext.loadDelegate browsingContextControllerDidFinishLoad:browsingContext]; 231 } 232 233 static void setUpPageLoaderClient(WKBrowsingContextController *browsingContext, WKPageRef pageRef) 234 { 235 WKPageLoaderClient loaderClient; 236 memset(&loaderClient, 0, sizeof(loaderClient)); 237 238 loaderClient.version = kWKPageLoaderClientCurrentVersion; 239 loaderClient.clientInfo = browsingContext; 240 loaderClient.didStartProvisionalLoadForFrame = didStartProvisionalLoadForFrame; 241 loaderClient.didCommitLoadForFrame = didCommitLoadForFrame; 242 loaderClient.didFinishLoadForFrame = didFinishLoadForFrame; 243 244 WKPageSetPageLoaderClient(pageRef, &loaderClient); 245 } 246 187 247 188 248 /* This should only be called from associate view. */ … … 197 257 _data->_pageRef = pageRef; 198 258 259 setUpPageLoaderClient(self, pageRef); 260 199 261 return self; 200 262 } -
trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj
r98184 r98285 696 696 BCBAACF51452324F0053F82F /* WKBrowsingContextGroup.mm in Sources */ = {isa = PBXBuildFile; fileRef = BCBAACEF145232440053F82F /* WKBrowsingContextGroup.mm */; }; 697 697 BCBAACF61452324F0053F82F /* WKBrowsingContextGroupInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = BCBAACF0145232480053F82F /* WKBrowsingContextGroupInternal.h */; }; 698 BCBAAD0B14560A430053F82F /* WKBrowsingContextLoadDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = BCBAAD0A14560A430053F82F /* WKBrowsingContextLoadDelegate.h */; }; 698 699 BCBCB0CB1215E32100DE59CA /* ImmutableDictionary.h in Headers */ = {isa = PBXBuildFile; fileRef = BCBCB0CA1215E32100DE59CA /* ImmutableDictionary.h */; }; 699 700 BCBCB0CD1215E33A00DE59CA /* ImmutableDictionary.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCBCB0CC1215E33A00DE59CA /* ImmutableDictionary.cpp */; }; … … 727 728 BCD597D1112B56AC00EC8C23 /* WKPreferences.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCD597CF112B56AC00EC8C23 /* WKPreferences.cpp */; }; 728 729 BCD597D6112B56DC00EC8C23 /* WKPage.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCD597D4112B56DC00EC8C23 /* WKPage.cpp */; }; 729 BCD597D7112B56DC00EC8C23 /* WKPage.h in Headers */ = {isa = PBXBuildFile; fileRef = BCD597D5112B56DC00EC8C23 /* WKPage.h */; settings = {ATTRIBUTES = (P rivate, ); }; };730 BCD597D7112B56DC00EC8C23 /* WKPage.h in Headers */ = {isa = PBXBuildFile; fileRef = BCD597D5112B56DC00EC8C23 /* WKPage.h */; settings = {ATTRIBUTES = (Public, ); }; }; 730 731 BCD597FF112B57BE00EC8C23 /* WebPreferences.h in Headers */ = {isa = PBXBuildFile; fileRef = BCD597FD112B57BE00EC8C23 /* WebPreferences.h */; }; 731 732 BCD59800112B57BE00EC8C23 /* WebPreferences.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCD597FE112B57BE00EC8C23 /* WebPreferences.cpp */; }; … … 1661 1662 BCBAACEF145232440053F82F /* WKBrowsingContextGroup.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKBrowsingContextGroup.mm; sourceTree = "<group>"; }; 1662 1663 BCBAACF0145232480053F82F /* WKBrowsingContextGroupInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKBrowsingContextGroupInternal.h; sourceTree = "<group>"; }; 1664 BCBAAD0A14560A430053F82F /* WKBrowsingContextLoadDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKBrowsingContextLoadDelegate.h; sourceTree = "<group>"; }; 1663 1665 BCBCB0CA1215E32100DE59CA /* ImmutableDictionary.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ImmutableDictionary.h; sourceTree = "<group>"; }; 1664 1666 BCBCB0CC1215E33A00DE59CA /* ImmutableDictionary.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ImmutableDictionary.cpp; sourceTree = "<group>"; }; … … 2935 2937 BCBAACEF145232440053F82F /* WKBrowsingContextGroup.mm */, 2936 2938 BCBAACF0145232480053F82F /* WKBrowsingContextGroupInternal.h */, 2939 BCBAAD0A14560A430053F82F /* WKBrowsingContextLoadDelegate.h */, 2937 2940 BCBAACE5145225C90053F82F /* WKProcessGroup.h */, 2938 2941 BCBAACE6145225CA0053F82F /* WKProcessGroup.mm */, … … 3924 3927 BCBAACF41452324F0053F82F /* WKBrowsingContextGroup.h in Headers */, 3925 3928 BCBAACF61452324F0053F82F /* WKBrowsingContextGroupInternal.h in Headers */, 3929 BCBAAD0B14560A430053F82F /* WKBrowsingContextLoadDelegate.h in Headers */, 3926 3930 ); 3927 3931 runOnlyForDeploymentPostprocessing = 0;
Note:
See TracChangeset
for help on using the changeset viewer.