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

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

Issue 1458703004: Fixes document type detection on iOS 9. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed comments 1 Created 5 years, 1 month 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
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 <objc/runtime.h> 7 #import <objc/runtime.h>
8 #include <cmath> 8 #include <cmath>
9 9
10 #include "base/ios/block_types.h" 10 #include "base/ios/block_types.h"
(...skipping 802 matching lines...) Expand 10 before | Expand all | Expand 10 after
813 } 813 }
814 814
815 - (BOOL)isViewAlive { 815 - (BOOL)isViewAlive {
816 return [self.containerView isViewAlive]; 816 return [self.containerView isViewAlive];
817 } 817 }
818 818
819 - (BOOL)contentIsHTML { 819 - (BOOL)contentIsHTML {
820 return [self webViewDocumentType] == web::WEB_VIEW_DOCUMENT_TYPE_HTML; 820 return [self webViewDocumentType] == web::WEB_VIEW_DOCUMENT_TYPE_HTML;
821 } 821 }
822 822
823 - (web::WebViewDocumentType)documentTypeFromMIMEType:(NSString*)MIMEType {
Eugene But (OOO till 7-30) 2015/11/19 16:29:01 NIT: Please try keeping the same order for interfa
stkhapugin 2015/11/20 10:50:43 Done.
824 if ([MIMEType isEqualToString:@"text/html"] ||
825 [MIMEType isEqualToString:@"application/xhtml+xml"] ||
826 [MIMEType isEqualToString:@"application/xml"]) {
827 return web::WEB_VIEW_DOCUMENT_TYPE_HTML;
828 }
829
830 return web::WEB_VIEW_DOCUMENT_TYPE_GENERIC;
831 }
832
823 // Stop doing stuff, especially network stuff. Close the request tracker. 833 // Stop doing stuff, especially network stuff. Close the request tracker.
824 - (void)terminateNetworkActivity { 834 - (void)terminateNetworkActivity {
825 DCHECK(!_isHalted); 835 DCHECK(!_isHalted);
826 _isHalted = YES; 836 _isHalted = YES;
827 837
828 // Cancel all outstanding perform requests, and clear anything already queued 838 // Cancel all outstanding perform requests, and clear anything already queued
829 // (since this may be called from within the handling loop) to prevent any 839 // (since this may be called from within the handling loop) to prevent any
830 // asynchronous JavaScript invocation handling from continuing. 840 // asynchronous JavaScript invocation handling from continuing.
831 [NSObject cancelPreviousPerformRequestsWithTarget:self]; 841 [NSObject cancelPreviousPerformRequestsWithTarget:self];
832 _webStateImpl->CloseRequestTracker(); 842 _webStateImpl->CloseRequestTracker();
(...skipping 2987 matching lines...) Expand 10 before | Expand all | Expand 10 after
3820 if (!_externalRequest || !_externalRequest->window_name) 3830 if (!_externalRequest || !_externalRequest->window_name)
3821 return @""; 3831 return @"";
3822 return _externalRequest->window_name; 3832 return _externalRequest->window_name;
3823 } 3833 }
3824 3834
3825 - (void)resetExternalRequest { 3835 - (void)resetExternalRequest {
3826 _externalRequest.reset(); 3836 _externalRequest.reset();
3827 } 3837 }
3828 3838
3829 @end 3839 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698