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 <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 4749 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4760 [self handleLoadError:loadError inMainFrame:YES]; | 4760 [self handleLoadError:loadError inMainFrame:YES]; |
4761 else | 4761 else |
4762 self.webStateImpl->SetContentsMimeType("text/html"); | 4762 self.webStateImpl->SetContentsMimeType("text/html"); |
4763 }]; | 4763 }]; |
4764 } | 4764 } |
4765 | 4765 |
4766 - (void)loadHTML:(NSString*)HTML forURL:(const GURL&)URL { | 4766 - (void)loadHTML:(NSString*)HTML forURL:(const GURL&)URL { |
4767 // Remove the transient content view. | 4767 // Remove the transient content view. |
4768 [self clearTransientContentView]; | 4768 [self clearTransientContentView]; |
4769 | 4769 |
4770 DLOG_IF(WARNING, !_webView) << "_webView null while trying to load HTML"; | |
4771 _loadPhase = web::LOAD_REQUESTED; | 4770 _loadPhase = web::LOAD_REQUESTED; |
| 4771 [self ensureWebViewCreated]; |
| 4772 DCHECK(_webView) << "_webView null while trying to load HTML"; |
4772 [_webView loadHTMLString:HTML baseURL:net::NSURLWithGURL(URL)]; | 4773 [_webView loadHTMLString:HTML baseURL:net::NSURLWithGURL(URL)]; |
4773 } | 4774 } |
4774 | 4775 |
4775 - (void)loadHTML:(NSString*)HTML forAppSpecificURL:(const GURL&)URL { | 4776 - (void)loadHTML:(NSString*)HTML forAppSpecificURL:(const GURL&)URL { |
4776 CHECK(web::GetWebClient()->IsAppSpecificURL(URL)); | 4777 CHECK(web::GetWebClient()->IsAppSpecificURL(URL)); |
4777 [self loadHTML:HTML forURL:URL]; | 4778 [self loadHTML:HTML forURL:URL]; |
4778 } | 4779 } |
4779 | 4780 |
4780 - (void)loadHTMLForCurrentURL:(NSString*)HTML { | 4781 - (void)loadHTMLForCurrentURL:(NSString*)HTML { |
4781 [self loadHTML:HTML forURL:self.currentURL]; | 4782 [self loadHTML:HTML forURL:self.currentURL]; |
(...skipping 846 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5628 } | 5629 } |
5629 | 5630 |
5630 return web::WEB_VIEW_DOCUMENT_TYPE_GENERIC; | 5631 return web::WEB_VIEW_DOCUMENT_TYPE_GENERIC; |
5631 } | 5632 } |
5632 | 5633 |
5633 - (NSString*)refererFromNavigationAction:(WKNavigationAction*)action { | 5634 - (NSString*)refererFromNavigationAction:(WKNavigationAction*)action { |
5634 return [action.request valueForHTTPHeaderField:@"Referer"]; | 5635 return [action.request valueForHTTPHeaderField:@"Referer"]; |
5635 } | 5636 } |
5636 | 5637 |
5637 @end | 5638 @end |
OLD | NEW |