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

Side by Side Diff: ios/web/web_state/ui/crw_web_controller.mm

Issue 2398233003: with sync (Closed)
Patch Set: done Created 4 years, 2 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 unified diff | Download patch
« no previous file with comments | « ios/chrome/browser/sync/ios_chrome_sync_client.mm ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #import "ios/web/web_state/ui/crw_web_controller.h" 5 #import "ios/web/web_state/ui/crw_web_controller.h"
6 6
7 #import <WebKit/WebKit.h> 7 #import <WebKit/WebKit.h>
8 8
9 #import <objc/runtime.h> 9 #import <objc/runtime.h>
10 #include <stddef.h> 10 #include <stddef.h>
(...skipping 4708 matching lines...) Expand 10 before | Expand all | Expand 10 after
4719 // This happens during tests. 4719 // This happens during tests.
4720 if (!_webView) { 4720 if (!_webView) {
4721 return web::WEB_VIEW_DOCUMENT_TYPE_GENERIC; 4721 return web::WEB_VIEW_DOCUMENT_TYPE_GENERIC;
4722 } 4722 }
4723 4723
4724 std::string MIMEType = self.webState->GetContentsMimeType(); 4724 std::string MIMEType = self.webState->GetContentsMimeType();
4725 return [self documentTypeFromMIMEType:base::SysUTF8ToNSString(MIMEType)]; 4725 return [self documentTypeFromMIMEType:base::SysUTF8ToNSString(MIMEType)];
4726 } 4726 }
4727 4727
4728 - (void)loadRequest:(NSMutableURLRequest*)request { 4728 - (void)loadRequest:(NSMutableURLRequest*)request {
4729 _latestWKNavigation.reset([[_webView loadRequest:request] retain]); 4729 if ([[request URL] isFileURL]) {
4730 NSURL* url = [request URL];
4731 NSMutableArray* partsArray =
4732 [NSMutableArray arrayWithArray:[url pathComponents]];
4733 [partsArray removeLastObject];
4734 _latestWKNavigation.reset([[_webView
4735 loadFileURL:url
4736 allowingReadAccessToURL:[NSURL fileURLWithPathComponents:partsArray]]
4737 retain]);
4738 } else {
4739 _latestWKNavigation.reset([[_webView loadRequest:request] retain]);
4740 }
4730 } 4741 }
4731 4742
4732 - (void)loadPOSTRequest:(NSMutableURLRequest*)request { 4743 - (void)loadPOSTRequest:(NSMutableURLRequest*)request {
4733 if (!_POSTRequestLoader) { 4744 if (!_POSTRequestLoader) {
4734 _POSTRequestLoader.reset([[CRWJSPOSTRequestLoader alloc] init]); 4745 _POSTRequestLoader.reset([[CRWJSPOSTRequestLoader alloc] init]);
4735 } 4746 }
4736 4747
4737 CRWWKScriptMessageRouter* messageRouter = 4748 CRWWKScriptMessageRouter* messageRouter =
4738 [self webViewConfigurationProvider].GetScriptMessageRouter(); 4749 [self webViewConfigurationProvider].GetScriptMessageRouter();
4739 4750
(...skipping 905 matching lines...) Expand 10 before | Expand all | Expand 10 after
5645 } 5656 }
5646 5657
5647 return web::WEB_VIEW_DOCUMENT_TYPE_GENERIC; 5658 return web::WEB_VIEW_DOCUMENT_TYPE_GENERIC;
5648 } 5659 }
5649 5660
5650 - (NSString*)refererFromNavigationAction:(WKNavigationAction*)action { 5661 - (NSString*)refererFromNavigationAction:(WKNavigationAction*)action {
5651 return [action.request valueForHTTPHeaderField:@"Referer"]; 5662 return [action.request valueForHTTPHeaderField:@"Referer"];
5652 } 5663 }
5653 5664
5654 @end 5665 @end
OLDNEW
« no previous file with comments | « ios/chrome/browser/sync/ios_chrome_sync_client.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698