| 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 2175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2186 } else if (_requireReloadOnDisplay && _webView) { | 2186 } else if (_requireReloadOnDisplay && _webView) { |
| 2187 _requireReloadOnDisplay = NO; | 2187 _requireReloadOnDisplay = NO; |
| 2188 [self addPlaceholderOverlay]; | 2188 [self addPlaceholderOverlay]; |
| 2189 [self loadCurrentURL]; | 2189 [self loadCurrentURL]; |
| 2190 } | 2190 } |
| 2191 } | 2191 } |
| 2192 | 2192 |
| 2193 - (BOOL)shouldReload:(const GURL&)destinationURL | 2193 - (BOOL)shouldReload:(const GURL&)destinationURL |
| 2194 transition:(ui::PageTransition)transition { | 2194 transition:(ui::PageTransition)transition { |
| 2195 // Do a reload if the user hits enter in the address bar or re-types a URL. | 2195 // Do a reload if the user hits enter in the address bar or re-types a URL. |
| 2196 CRWSessionController* sessionController = | |
| 2197 _webStateImpl->GetNavigationManagerImpl().GetSessionController(); | |
| 2198 web::NavigationItem* item = | 2196 web::NavigationItem* item = |
| 2199 _webStateImpl->GetNavigationManagerImpl().GetVisibleItem(); | 2197 _webStateImpl->GetNavigationManagerImpl().GetVisibleItem(); |
| 2200 return (transition & ui::PAGE_TRANSITION_FROM_ADDRESS_BAR) && item && | 2198 return (transition & ui::PAGE_TRANSITION_FROM_ADDRESS_BAR) && item && |
| 2201 (destinationURL == item->GetURL() || | 2199 (destinationURL == item->GetURL() || |
| 2202 destinationURL == [sessionController currentEntry].originalUrl); | 2200 destinationURL == item->GetOriginalRequestURL()); |
| 2203 } | 2201 } |
| 2204 | 2202 |
| 2205 // Reload either the web view or the native content depending on which is | 2203 // Reload either the web view or the native content depending on which is |
| 2206 // displayed. | 2204 // displayed. |
| 2207 - (void)reloadInternal { | 2205 - (void)reloadInternal { |
| 2208 // Clear last user interaction. | 2206 // Clear last user interaction. |
| 2209 // TODO(crbug.com/546337): Move to after the load commits, in the subclass | 2207 // TODO(crbug.com/546337): Move to after the load commits, in the subclass |
| 2210 // implementation. This will be inaccurate if the reload fails or is | 2208 // implementation. This will be inaccurate if the reload fails or is |
| 2211 // cancelled. | 2209 // cancelled. |
| 2212 _lastUserInteraction.reset(); | 2210 _lastUserInteraction.reset(); |
| (...skipping 3588 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5801 } | 5799 } |
| 5802 | 5800 |
| 5803 return web::WEB_VIEW_DOCUMENT_TYPE_GENERIC; | 5801 return web::WEB_VIEW_DOCUMENT_TYPE_GENERIC; |
| 5804 } | 5802 } |
| 5805 | 5803 |
| 5806 - (NSString*)refererFromNavigationAction:(WKNavigationAction*)action { | 5804 - (NSString*)refererFromNavigationAction:(WKNavigationAction*)action { |
| 5807 return [action.request valueForHTTPHeaderField:@"Referer"]; | 5805 return [action.request valueForHTTPHeaderField:@"Referer"]; |
| 5808 } | 5806 } |
| 5809 | 5807 |
| 5810 @end | 5808 @end |
| OLD | NEW |