OLD | NEW |
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 673 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
684 | 684 |
685 - (NSString*)scriptByAddingWindowIDCheckForScript:(NSString*)script { | 685 - (NSString*)scriptByAddingWindowIDCheckForScript:(NSString*)script { |
686 NSString* kTemplate = @"if (__gCrWeb['windowId'] === '%@') { %@; }"; | 686 NSString* kTemplate = @"if (__gCrWeb['windowId'] === '%@') { %@; }"; |
687 return [NSString stringWithFormat:kTemplate, [self windowId], script]; | 687 return [NSString stringWithFormat:kTemplate, [self windowId], script]; |
688 } | 688 } |
689 | 689 |
690 - (void)removeWebViewAllowingCachedReconstruction:(BOOL)allowCache { | 690 - (void)removeWebViewAllowingCachedReconstruction:(BOOL)allowCache { |
691 if (!self.webView) | 691 if (!self.webView) |
692 return; | 692 return; |
693 | 693 |
| 694 SEL cancelDialogsSelector = |
| 695 @selector(cancelJavaScriptDialogsForWebController:); |
| 696 if ([self.UIDelegate respondsToSelector:cancelDialogsSelector]) |
| 697 [self.UIDelegate cancelJavaScriptDialogsForWebController:self]; |
| 698 |
694 if (allowCache) | 699 if (allowCache) |
695 _expectedReconstructionURL = [self currentNavigationURL]; | 700 _expectedReconstructionURL = [self currentNavigationURL]; |
696 else | 701 else |
697 _expectedReconstructionURL = GURL(); | 702 _expectedReconstructionURL = GURL(); |
698 | 703 |
699 [self abortLoad]; | 704 [self abortLoad]; |
700 [self.webView removeFromSuperview]; | 705 [self.webView removeFromSuperview]; |
701 [self.containerView resetContent]; | 706 [self.containerView resetContent]; |
702 [self resetWebView]; | 707 [self resetWebView]; |
703 } | 708 } |
(...skipping 3162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3866 if ([MIMEType isEqualToString:@"text/html"] || | 3871 if ([MIMEType isEqualToString:@"text/html"] || |
3867 [MIMEType isEqualToString:@"application/xhtml+xml"] || | 3872 [MIMEType isEqualToString:@"application/xhtml+xml"] || |
3868 [MIMEType isEqualToString:@"application/xml"]) { | 3873 [MIMEType isEqualToString:@"application/xml"]) { |
3869 return web::WEB_VIEW_DOCUMENT_TYPE_HTML; | 3874 return web::WEB_VIEW_DOCUMENT_TYPE_HTML; |
3870 } | 3875 } |
3871 | 3876 |
3872 return web::WEB_VIEW_DOCUMENT_TYPE_GENERIC; | 3877 return web::WEB_VIEW_DOCUMENT_TYPE_GENERIC; |
3873 } | 3878 } |
3874 | 3879 |
3875 @end | 3880 @end |
OLD | NEW |