Chromium Code Reviews| 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 1962 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1973 | 1973 |
| 1974 // Reload either the web view or the native content depending on which is | 1974 // Reload either the web view or the native content depending on which is |
| 1975 // displayed. | 1975 // displayed. |
| 1976 - (void)reloadInternal { | 1976 - (void)reloadInternal { |
| 1977 // Clear last user interaction. | 1977 // Clear last user interaction. |
| 1978 // TODO(crbug.com/546337): Move to after the load commits, in the subclass | 1978 // TODO(crbug.com/546337): Move to after the load commits, in the subclass |
| 1979 // implementation. This will be inaccurate if the reload fails or is | 1979 // implementation. This will be inaccurate if the reload fails or is |
| 1980 // cancelled. | 1980 // cancelled. |
| 1981 _lastUserInteraction.reset(); | 1981 _lastUserInteraction.reset(); |
| 1982 base::RecordAction(UserMetricsAction("Reload")); | 1982 base::RecordAction(UserMetricsAction("Reload")); |
| 1983 if (_webView) { | 1983 if ([self shouldLoadURLInNativeView:self.currentNavItem->GetURL()]) { |
|
Olivier
2017/03/21 17:50:26
I think this won't handle the Reading List loading
kkhorimoto
2017/03/21 17:59:46
Ahh you're right, I didn't think that through; the
| |
| 1984 [self.nativeController reload]; | |
| 1985 } else { | |
| 1984 web::NavigationItem* transientItem = | 1986 web::NavigationItem* transientItem = |
| 1985 self.navigationManagerImpl->GetTransientItem(); | 1987 self.navigationManagerImpl->GetTransientItem(); |
| 1986 if (transientItem) { | 1988 if (transientItem) { |
| 1987 // If there's a transient item, a reload is considered a new navigation to | 1989 // If there's a transient item, a reload is considered a new navigation to |
| 1988 // the transient item's URL (as on other platforms). | 1990 // the transient item's URL (as on other platforms). |
| 1989 NavigationManager::WebLoadParams reloadParams(transientItem->GetURL()); | 1991 NavigationManager::WebLoadParams reloadParams(transientItem->GetURL()); |
| 1990 reloadParams.transition_type = ui::PAGE_TRANSITION_RELOAD; | 1992 reloadParams.transition_type = ui::PAGE_TRANSITION_RELOAD; |
| 1991 reloadParams.extra_headers.reset( | 1993 reloadParams.extra_headers.reset( |
| 1992 [transientItem->GetHttpRequestHeaders() copy]); | 1994 [transientItem->GetHttpRequestHeaders() copy]); |
| 1993 [self loadWithParams:reloadParams]; | 1995 [self loadWithParams:reloadParams]; |
| 1994 } else { | 1996 } else { |
| 1995 // As with back and forward navigation, load the URL manually instead of | 1997 // As with back and forward navigation, load the URL manually instead of |
| 1996 // using the web view's reload. This ensures state processing and delegate | 1998 // using the web view's reload. This ensures state processing and delegate |
| 1997 // calls are consistent. | 1999 // calls are consistent. |
| 1998 // TODO(eugenebut): revisit this for WKWebView. | 2000 // TODO(eugenebut): revisit this for WKWebView. |
| 1999 [self loadCurrentURL]; | 2001 [self loadCurrentURL]; |
| 2000 } | 2002 } |
| 2001 } else { | |
| 2002 [self.nativeController reload]; | |
| 2003 } | 2003 } |
| 2004 } | 2004 } |
| 2005 | 2005 |
| 2006 - (void)reload { | 2006 - (void)reload { |
| 2007 [_delegate webWillReload]; | 2007 [_delegate webWillReload]; |
| 2008 [self reloadInternal]; | 2008 [self reloadInternal]; |
| 2009 } | 2009 } |
| 2010 | 2010 |
| 2011 - (void)abortLoad { | 2011 - (void)abortLoad { |
| 2012 [_webView stopLoading]; | 2012 [_webView stopLoading]; |
| (...skipping 3062 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5075 - (void)simulateLoadRequestWithURL:(const GURL&)URL { | 5075 - (void)simulateLoadRequestWithURL:(const GURL&)URL { |
| 5076 _lastRegisteredRequestURL = URL; | 5076 _lastRegisteredRequestURL = URL; |
| 5077 _loadPhase = web::LOAD_REQUESTED; | 5077 _loadPhase = web::LOAD_REQUESTED; |
| 5078 } | 5078 } |
| 5079 | 5079 |
| 5080 - (NSString*)referrerFromNavigationAction:(WKNavigationAction*)action { | 5080 - (NSString*)referrerFromNavigationAction:(WKNavigationAction*)action { |
| 5081 return [action.request valueForHTTPHeaderField:kReferrerHeaderName]; | 5081 return [action.request valueForHTTPHeaderField:kReferrerHeaderName]; |
| 5082 } | 5082 } |
| 5083 | 5083 |
| 5084 @end | 5084 @end |
| OLD | NEW |