Changeset 163563 in webkit
- Timestamp:
- Feb 6, 2014 2:04:33 PM (10 years ago)
- Location:
- trunk/Source/WebKit2
- Files:
-
- 5 edited
- 3 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit2/ChangeLog
r163555 r163563 1 2014-02-06 Anders Carlsson <andersca@apple.com> 2 3 Add WKNavigationResponse class 4 https://bugs.webkit.org/show_bug.cgi?id=128326 5 6 Reviewed by Dan Bernstein. 7 8 * UIProcess/API/Cocoa/WKFrameInfo.mm: 9 (-[WKFrameInfo initWithWebFrameProxy:WebKit::]): 10 * UIProcess/API/Cocoa/WKFrameInfoInternal.h: 11 * UIProcess/API/Cocoa/WKNavigationResponse.h: Copied from Source/WebKit2/UIProcess/API/Cocoa/WKFrameInfo.mm. 12 * UIProcess/API/Cocoa/WKNavigationResponse.mm: Copied from Source/WebKit2/UIProcess/API/Cocoa/WKFrameInfo.mm. 13 (-[WKNavigationResponse frame]): 14 (-[WKNavigationResponse setFrame:]): 15 (-[WKNavigationResponse response]): 16 (-[WKNavigationResponse setResponse:]): 17 * UIProcess/API/Cocoa/WKNavigationResponseInternal.h: Copied from Source/WebKit2/UIProcess/API/Cocoa/WKFrameInfoInternal.h. 18 * UIProcess/Cocoa/NavigationState.mm: 19 (WebKit::NavigationState::PolicyClient::decidePolicyForNavigationAction): 20 (WebKit::NavigationState::PolicyClient::decidePolicyForResponse): 21 * WebKit2.xcodeproj/project.pbxproj: 22 1 23 2014-02-06 Anders Carlsson <andersca@apple.com> 2 24 -
trunk/Source/WebKit2/UIProcess/API/Cocoa/WKFrameInfo.mm
r163501 r163563 29 29 #if WK_API_ENABLED 30 30 31 #import "WebFrameProxy.h" 31 32 #import <wtf/RetainPtr.h> 32 33 33 34 @implementation WKFrameInfo { 34 35 RetainPtr<NSURLRequest> _request; 36 } 37 38 - (instancetype)initWithWebFrameProxy:(WebKit::WebFrameProxy&)webFrameProxy 39 { 40 if (!(self = [super init])) 41 return nil; 42 43 _mainFrame = webFrameProxy.isMainFrame(); 44 45 // FIXME: This should use the full request of the frame, not just the URL. 46 _request = [NSURLRequest requestWithURL:[NSURL URLWithString:webFrameProxy.url()]]; 47 48 return self; 35 49 } 36 50 -
trunk/Source/WebKit2/UIProcess/API/Cocoa/WKFrameInfoInternal.h
r163501 r163563 28 28 #if WK_API_ENABLED 29 29 30 namespace WebKit { 31 class WebFrameProxy; 32 } 33 30 34 @interface WKFrameInfo () 31 35 32 @property (nonatomic, readwrite, getter=isMainFrame) BOOL mainFrame; 33 @property (nonatomic, readwrite, copy) NSURLRequest *request; 36 - (instancetype)initWithWebFrameProxy:(WebKit::WebFrameProxy&)webFrameProxy; 34 37 35 38 @end -
trunk/Source/WebKit2/UIProcess/API/Cocoa/WKNavigationResponse.h
r163555 r163563 24 24 */ 25 25 26 #import "config.h"27 #import "WKFrameInfoInternal.h"26 #import <Foundation/Foundation.h> 27 #import <WebKit2/WKFoundation.h> 28 28 29 29 #if WK_API_ENABLED 30 30 31 #import <wtf/RetainPtr.h> 31 @class WKFrameInfo; 32 32 33 @implementation WKFrameInfo { 34 RetainPtr<NSURLRequest> _request; 35 } 33 WK_API_CLASS 34 @interface WKNavigationResponse : NSObject 36 35 37 - (NSURLRequest *)request 38 { 39 return _request.get(); 40 } 41 42 - (void)setRequest:(NSURLRequest *)request 43 { 44 _request = adoptNS([request copy]); 45 } 36 @property (nonatomic, readonly) WKFrameInfo *frame; 37 @property (nonatomic, readonly) NSURLResponse *response; 38 @property (nonatomic, readonly) BOOL canShowMIMEType; 46 39 47 40 @end 48 41 49 42 #endif 50 -
trunk/Source/WebKit2/UIProcess/API/Cocoa/WKNavigationResponse.mm
r163555 r163563 25 25 26 26 #import "config.h" 27 #import "WK FrameInfoInternal.h"27 #import "WKNavigationResponseInternal.h" 28 28 29 29 #if WK_API_ENABLED … … 31 31 #import <wtf/RetainPtr.h> 32 32 33 @implementation WKFrameInfo { 34 RetainPtr<NSURLRequest> _request; 33 @implementation WKNavigationResponse { 34 RetainPtr<WKFrameInfo> _frame; 35 RetainPtr<NSURLResponse> _response; 35 36 } 36 37 37 - ( NSURLRequest *)request38 - (WKFrameInfo *)frame 38 39 { 39 return _ request.get();40 return _frame.get(); 40 41 } 41 42 42 - (void)set Request:(NSURLRequest *)request43 - (void)setFrame:(WKFrameInfo *)frame 43 44 { 44 _request = adoptNS([request copy]); 45 _frame = frame; 46 } 47 48 - (NSURLResponse *)response 49 { 50 return _response.get(); 51 } 52 53 - (void)setResponse:(NSURLResponse *)response 54 { 55 _response = adoptNS([response copy]); 45 56 } 46 57 … … 48 59 49 60 #endif 50 -
trunk/Source/WebKit2/UIProcess/API/Cocoa/WKNavigationResponseInternal.h
r163555 r163563 24 24 */ 25 25 26 #import "WK FrameInfo.h"26 #import "WKNavigationResponse.h" 27 27 28 28 #if WK_API_ENABLED 29 29 30 @interface WK FrameInfo()30 @interface WKNavigationResponse () 31 31 32 @property (nonatomic, readwrite, getter=isMainFrame) BOOL mainFrame; 33 @property (nonatomic, readwrite, copy) NSURLRequest *request; 32 @property (nonatomic, readwrite, strong) WKFrameInfo *frame; 33 @property (nonatomic, readwrite, copy) NSURLResponse *response; 34 @property (nonatomic, readwrite) BOOL canShowMIMEType; 34 35 35 36 @end -
trunk/Source/WebKit2/UIProcess/Cocoa/NavigationState.mm
r163551 r163563 35 35 #import "WKNavigationDelegate.h" 36 36 #import "WKNavigationInternal.h" 37 #import "WKNavigationResponseInternal.h" 37 38 #import "WKWebViewInternal.h" 38 39 #import "WebFrameProxy.h" … … 128 129 } 129 130 130 static RetainPtr<WKFrameInfo> frameInfoFromWebFrameProxy(WebFrameProxy& webFrameProxy)131 {132 auto frameInfo = adoptNS([[WKFrameInfo alloc] init]);133 134 [frameInfo setMainFrame:webFrameProxy.isMainFrame()];135 136 // FIXME: This should use the full request of the frame, not just the URL.137 [frameInfo setRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:webFrameProxy.url()]]];138 139 return frameInfo;140 }141 142 131 void NavigationState::PolicyClient::decidePolicyForNavigationAction(WebPageProxy*, WebFrameProxy* destinationFrame, const NavigationActionData& navigationActionData, WebFrameProxy* sourceFrame, const WebCore::ResourceRequest& originalRequest, const WebCore::ResourceRequest& request, RefPtr<WebFramePolicyListenerProxy> listener, API::Object* userData) 143 132 { … … 155 144 auto navigationAction = adoptNS([[WKNavigationAction alloc] init]); 156 145 157 if (sourceFrame) 158 [navigationAction setSourceFrame:frameInfoFromWebFrameProxy(*sourceFrame).get()]; 146 if (sourceFrame) { 147 auto frameInfo = adoptNS([[WKFrameInfo alloc] initWithWebFrameProxy:*sourceFrame]); 148 [navigationAction setSourceFrame:frameInfo.get()]; 149 } 159 150 160 151 [navigationAction setNavigationType:toWKNavigationType(navigationActionData.navigationType)]; … … 183 174 } 184 175 185 void NavigationState::PolicyClient::decidePolicyForResponse(WebPageProxy*, WebFrameProxy* , const WebCore::ResourceResponse&, const WebCore::ResourceRequest& resourceRequest, bool canShowMIMEType, RefPtr<WebFramePolicyListenerProxy> listener, API::Object* userData)176 void NavigationState::PolicyClient::decidePolicyForResponse(WebPageProxy*, WebFrameProxy* frame, const WebCore::ResourceResponse& resourceResponse, const WebCore::ResourceRequest& resourceRequest, bool canShowMIMEType, RefPtr<WebFramePolicyListenerProxy> listener, API::Object* userData) 186 177 { 187 178 if (!m_navigationState.m_navigationDelegateMethods.webViewDecidePolicyForNavigationResponseDecisionHandler) { … … 196 187 197 188 // FIXME: Set up the navigation response object. 198 WKNavigationResponse *navigationResponse = nil; 199 200 [navigationDelegate webView:m_navigationState.m_webView decidePolicyForNavigationResponse:navigationResponse decisionHandler:[listener](WKNavigationResponsePolicyDecision policyDecision) { 189 auto navigationResponse = adoptNS([[WKNavigationResponse alloc] init]); 190 191 [navigationResponse setFrame:adoptNS([[WKFrameInfo alloc] initWithWebFrameProxy:*frame]).get()]; 192 [navigationResponse setResponse:resourceResponse.nsURLResponse()]; 193 [navigationResponse setCanShowMIMEType:canShowMIMEType]; 194 195 [navigationDelegate webView:m_navigationState.m_webView decidePolicyForNavigationResponse:navigationResponse.get() decisionHandler:[listener](WKNavigationResponsePolicyDecision policyDecision) { 201 196 switch (policyDecision) { 202 197 case WKNavigationResponsePolicyDecisionAllow: -
trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj
r163554 r163563 97 97 1A186EEA12EF7618008E5F37 /* LayerTreeHost.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A186EE812EF7618008E5F37 /* LayerTreeHost.h */; }; 98 98 1A186EEB12EF7618008E5F37 /* LayerTreeHost.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A186EE912EF7618008E5F37 /* LayerTreeHost.cpp */; }; 99 1A1B0EB518A424950038481A /* WKNavigationResponse.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1A1B0EB318A424950038481A /* WKNavigationResponse.mm */; }; 100 1A1B0EB618A424950038481A /* WKNavigationResponse.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A1B0EB418A424950038481A /* WKNavigationResponse.h */; }; 101 1A1B0EB818A424CD0038481A /* WKNavigationResponseInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A1B0EB718A424CD0038481A /* WKNavigationResponseInternal.h */; }; 99 102 1A1C649B11F4174200553C19 /* WebContextMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1A1C648611F415B700553C19 /* WebContextMac.mm */; }; 100 103 1A1D8BA11731A36300141DA4 /* LocalStorageDatabase.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A1D8B9F1731A36300141DA4 /* LocalStorageDatabase.cpp */; }; … … 1739 1742 1A186EE812EF7618008E5F37 /* LayerTreeHost.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LayerTreeHost.h; sourceTree = "<group>"; }; 1740 1743 1A186EE912EF7618008E5F37 /* LayerTreeHost.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LayerTreeHost.cpp; sourceTree = "<group>"; }; 1744 1A1B0EB318A424950038481A /* WKNavigationResponse.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKNavigationResponse.mm; sourceTree = "<group>"; }; 1745 1A1B0EB418A424950038481A /* WKNavigationResponse.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKNavigationResponse.h; sourceTree = "<group>"; }; 1746 1A1B0EB718A424CD0038481A /* WKNavigationResponseInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKNavigationResponseInternal.h; sourceTree = "<group>"; }; 1741 1747 1A1C648611F415B700553C19 /* WebContextMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebContextMac.mm; sourceTree = "<group>"; }; 1742 1748 1A1D8B9F1731A36300141DA4 /* LocalStorageDatabase.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LocalStorageDatabase.cpp; sourceTree = "<group>"; }; … … 4306 4312 1ABC3DFB1899F51C004F0626 /* WKNavigationDelegate.h */, 4307 4313 1ABC3DF01899C6B6004F0626 /* WKNavigationInternal.h */, 4314 1A1B0EB418A424950038481A /* WKNavigationResponse.h */, 4315 1A1B0EB318A424950038481A /* WKNavigationResponse.mm */, 4316 1A1B0EB718A424CD0038481A /* WKNavigationResponseInternal.h */, 4308 4317 1AFDD3161891C94700153970 /* WKPreferences.h */, 4309 4318 1AFDD3181891CA1200153970 /* WKPreferences.mm */, … … 6283 6292 BC4BEEAB120A0A5F00FBA0C7 /* InjectedBundleNodeHandle.h in Headers */, 6284 6293 378E1A4E18208D700031007A /* WKNSURL.h in Headers */, 6294 1A1B0EB818A424CD0038481A /* WKNavigationResponseInternal.h in Headers */, 6285 6295 512935E41288D97800A4B695 /* InjectedBundlePageContextMenuClient.h in Headers */, 6286 6296 E1EE53E311F8CFC000CCBEE4 /* InjectedBundlePageEditorClient.h in Headers */, … … 6709 6719 37183D57182F4E700080C811 /* WKNSURLExtras.h in Headers */, 6710 6720 BCC938E11180DE440085E5FE /* WKContextPrivate.h in Headers */, 6721 1A1B0EB618A424950038481A /* WKNavigationResponse.h in Headers */, 6711 6722 9FB5F395169E6A80002C25BF /* WKContextPrivateMac.h in Headers */, 6712 6723 1AE00D5D182DADE100087DD7 /* KeyedEncoder.h in Headers */, … … 7771 7782 1A3D610113A7CC2A00F95D4E /* PluginModuleInfo.cpp in Sources */, 7772 7783 1A043977124D034800FFBFB5 /* PluginProcess.cpp in Sources */, 7784 1A1B0EB518A424950038481A /* WKNavigationResponse.mm in Sources */, 7773 7785 1A0EC907124C0AB8007EF4A5 /* PluginProcessConnection.cpp in Sources */, 7774 7786 1A0EC910124C0AF5007EF4A5 /* PluginProcessConnectionManager.cpp in Sources */,
Note: See TracChangeset
for help on using the changeset viewer.