| 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 #include "ios/chrome/browser/ui/static_content/static_html_view_controller.h" | 5 #include "ios/chrome/browser/ui/static_content/static_html_view_controller.h" |
| 6 | 6 |
| 7 #import <WebKit/WebKit.h> | 7 #import <WebKit/WebKit.h> |
| 8 | 8 |
| 9 #include <stdlib.h> | 9 #include <stdlib.h> |
| 10 | 10 |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 200 #pragma mark - | 200 #pragma mark - |
| 201 #pragma mark WKNavigationDelegate implementation | 201 #pragma mark WKNavigationDelegate implementation |
| 202 | 202 |
| 203 - (void)webView:(WKWebView*)webView | 203 - (void)webView:(WKWebView*)webView |
| 204 decidePolicyForNavigationAction:(WKNavigationAction*)navigationAction | 204 decidePolicyForNavigationAction:(WKNavigationAction*)navigationAction |
| 205 decisionHandler: | 205 decisionHandler: |
| 206 (void (^)(WKNavigationActionPolicy))decisionHandler { | 206 (void (^)(WKNavigationActionPolicy))decisionHandler { |
| 207 decisionHandler( | 207 decisionHandler( |
| 208 [self | 208 [self |
| 209 shouldStartLoadWithRequest:navigationAction.request | 209 shouldStartLoadWithRequest:navigationAction.request |
| 210 fromMainFrame:[navigationAction.sourceFrame isMainFrame]] | 210 fromMainFrame:[navigationAction.targetFrame isMainFrame]] |
| 211 ? WKNavigationActionPolicyAllow | 211 ? WKNavigationActionPolicyAllow |
| 212 : WKNavigationActionPolicyCancel); | 212 : WKNavigationActionPolicyCancel); |
| 213 } | 213 } |
| 214 | 214 |
| 215 #pragma mark - | 215 #pragma mark - |
| 216 #pragma mark CRWContextMenuDelegate implementation | 216 #pragma mark CRWContextMenuDelegate implementation |
| 217 | 217 |
| 218 - (BOOL)webView:(WKWebView*)webView | 218 - (BOOL)webView:(WKWebView*)webView |
| 219 handleContextMenu:(const web::ContextMenuParams&)params { | 219 handleContextMenu:(const web::ContextMenuParams&)params { |
| 220 if ([delegate_ | 220 if ([delegate_ |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 310 allowingReadAccessToURL:resourcesRootDirectory_]; | 310 allowingReadAccessToURL:resourcesRootDirectory_]; |
| 311 } else { | 311 } else { |
| 312 NSURL* resourceURL = [self resourceURL]; | 312 NSURL* resourceURL = [self resourceURL]; |
| 313 [generator_ generateHtml:^(NSString* HTML) { | 313 [generator_ generateHtml:^(NSString* HTML) { |
| 314 [webView loadHTMLString:HTML baseURL:resourceURL]; | 314 [webView loadHTMLString:HTML baseURL:resourceURL]; |
| 315 }]; | 315 }]; |
| 316 } | 316 } |
| 317 } | 317 } |
| 318 | 318 |
| 319 @end | 319 @end |
| OLD | NEW |