| 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 2066 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2077 } else if (_requireReloadOnDisplay && _webView) { | 2077 } else if (_requireReloadOnDisplay && _webView) { |
| 2078 _requireReloadOnDisplay = NO; | 2078 _requireReloadOnDisplay = NO; |
| 2079 [self addPlaceholderOverlay]; | 2079 [self addPlaceholderOverlay]; |
| 2080 [self loadCurrentURL]; | 2080 [self loadCurrentURL]; |
| 2081 } | 2081 } |
| 2082 } | 2082 } |
| 2083 | 2083 |
| 2084 - (BOOL)shouldReload:(const GURL&)destinationURL | 2084 - (BOOL)shouldReload:(const GURL&)destinationURL |
| 2085 transition:(ui::PageTransition)transition { | 2085 transition:(ui::PageTransition)transition { |
| 2086 // Do a reload if the user hits enter in the address bar or re-types a URL. | 2086 // Do a reload if the user hits enter in the address bar or re-types a URL. |
| 2087 CRWSessionController* sessionController = | |
| 2088 _webStateImpl->GetNavigationManagerImpl().GetSessionController(); | |
| 2089 web::NavigationItem* item = | 2087 web::NavigationItem* item = |
| 2090 _webStateImpl->GetNavigationManagerImpl().GetVisibleItem(); | 2088 _webStateImpl->GetNavigationManagerImpl().GetVisibleItem(); |
| 2091 return (transition & ui::PAGE_TRANSITION_FROM_ADDRESS_BAR) && item && | 2089 return (transition & ui::PAGE_TRANSITION_FROM_ADDRESS_BAR) && item && |
| 2092 (destinationURL == item->GetURL() || | 2090 (destinationURL == item->GetURL() || |
| 2093 destinationURL == [sessionController currentEntry].originalUrl); | 2091 destinationURL == item->GetOriginalRequestURL()); |
| 2094 } | 2092 } |
| 2095 | 2093 |
| 2096 // Reload either the web view or the native content depending on which is | 2094 // Reload either the web view or the native content depending on which is |
| 2097 // displayed. | 2095 // displayed. |
| 2098 - (void)reloadInternal { | 2096 - (void)reloadInternal { |
| 2099 // Clear last user interaction. | 2097 // Clear last user interaction. |
| 2100 // TODO(crbug.com/546337): Move to after the load commits, in the subclass | 2098 // TODO(crbug.com/546337): Move to after the load commits, in the subclass |
| 2101 // implementation. This will be inaccurate if the reload fails or is | 2099 // implementation. This will be inaccurate if the reload fails or is |
| 2102 // cancelled. | 2100 // cancelled. |
| 2103 _lastUserInteraction.reset(); | 2101 _lastUserInteraction.reset(); |
| (...skipping 3409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5513 } | 5511 } |
| 5514 | 5512 |
| 5515 return web::WEB_VIEW_DOCUMENT_TYPE_GENERIC; | 5513 return web::WEB_VIEW_DOCUMENT_TYPE_GENERIC; |
| 5516 } | 5514 } |
| 5517 | 5515 |
| 5518 - (NSString*)refererFromNavigationAction:(WKNavigationAction*)action { | 5516 - (NSString*)refererFromNavigationAction:(WKNavigationAction*)action { |
| 5519 return [action.request valueForHTTPHeaderField:@"Referer"]; | 5517 return [action.request valueForHTTPHeaderField:@"Referer"]; |
| 5520 } | 5518 } |
| 5521 | 5519 |
| 5522 @end | 5520 @end |
| OLD | NEW |