Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(492)

Unified Diff: ios/web/web_state/ui/crw_web_controller.mm

Issue 2840473003: Return WKNavigation from loadRequest and loadPostRequest. (Closed)
Patch Set: Rebased Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ios/web/web_state/js/crw_js_post_request_loader.mm ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ios/web/web_state/ui/crw_web_controller.mm
diff --git a/ios/web/web_state/ui/crw_web_controller.mm b/ios/web/web_state/ui/crw_web_controller.mm
index b87fdca8210473345a426bd70ff40bb71fa3feaf..1e7c47326955a1b846d668542693cd7c5a13dfed 100644
--- a/ios/web/web_state/ui/crw_web_controller.mm
+++ b/ios/web/web_state/ui/crw_web_controller.mm
@@ -563,7 +563,7 @@ NSError* WKWebViewErrorWithSource(NSError* error, WKWebViewErrorSource source) {
// Returns |YES| if |url| should be loaded in a native view.
- (BOOL)shouldLoadURLInNativeView:(const GURL&)url;
// Loads the request into the |webView|.
-- (void)loadRequest:(NSMutableURLRequest*)request;
+- (WKNavigation*)loadRequest:(NSMutableURLRequest*)request;
// Loads POST request with body in |_wkWebView| by constructing an HTML page
// that executes the request through JavaScript and replaces document with the
// result.
@@ -571,7 +571,7 @@ NSError* WKWebViewErrorWithSource(NSError* error, WKWebViewErrorSource source) {
// the data is passed to |_wkWebView| on main thread.
// This is necessary because WKWebView ignores POST request body.
// Workaround for https://bugs.webkit.org/show_bug.cgi?id=145410
-- (void)loadPOSTRequest:(NSMutableURLRequest*)request;
+- (WKNavigation*)loadPOSTRequest:(NSMutableURLRequest*)request;
// Loads the HTML into the page at the given URL.
- (void)loadHTML:(NSString*)html forURL:(const GURL&)url;
@@ -4043,12 +4043,14 @@ const NSTimeInterval kSnapshotOverlayTransition = 0.5;
return web::WKWebViewConfigurationProvider::FromBrowserState(browserState);
}
-- (void)loadRequest:(NSMutableURLRequest*)request {
+- (WKNavigation*)loadRequest:(NSMutableURLRequest*)request {
+ WKNavigation* navigation = [_webView loadRequest:request];
[_navigationStates setState:web::WKNavigationState::REQUESTED
- forNavigation:[_webView loadRequest:request]];
+ forNavigation:navigation];
+ return navigation;
}
-- (void)loadPOSTRequest:(NSMutableURLRequest*)request {
+- (WKNavigation*)loadPOSTRequest:(NSMutableURLRequest*)request {
if (!_POSTRequestLoader) {
_POSTRequestLoader.reset([[CRWJSPOSTRequestLoader alloc] init]);
}
@@ -4056,17 +4058,16 @@ const NSTimeInterval kSnapshotOverlayTransition = 0.5;
CRWWKScriptMessageRouter* messageRouter =
[self webViewConfigurationProvider].GetScriptMessageRouter();
- [_POSTRequestLoader loadPOSTRequest:request
- inWebView:_webView
- messageRouter:messageRouter
- completionHandler:^(NSError* loadError) {
- if (loadError)
- [self handleLoadError:loadError
- inMainFrame:YES
- forNavigation:nil];
- else
- self.webStateImpl->SetContentsMimeType("text/html");
- }];
+ return [_POSTRequestLoader
+ loadPOSTRequest:request
+ inWebView:_webView
+ messageRouter:messageRouter
+ completionHandler:^(NSError* loadError) {
+ if (loadError)
+ [self handleLoadError:loadError inMainFrame:YES forNavigation:nil];
+ else
+ self.webStateImpl->SetContentsMimeType("text/html");
+ }];
}
- (void)loadHTML:(NSString*)HTML forURL:(const GURL&)URL {
« no previous file with comments | « ios/web/web_state/js/crw_js_post_request_loader.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698