| 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 2013 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2024 | 2024 |
| 2025 // Reload either the web view or the native content depending on which is | 2025 // Reload either the web view or the native content depending on which is |
| 2026 // displayed. | 2026 // displayed. |
| 2027 - (void)reloadInternal { | 2027 - (void)reloadInternal { |
| 2028 // Clear last user interaction. | 2028 // Clear last user interaction. |
| 2029 // TODO(crbug.com/546337): Move to after the load commits, in the subclass | 2029 // TODO(crbug.com/546337): Move to after the load commits, in the subclass |
| 2030 // implementation. This will be inaccurate if the reload fails or is | 2030 // implementation. This will be inaccurate if the reload fails or is |
| 2031 // cancelled. | 2031 // cancelled. |
| 2032 _lastUserInteraction.reset(); | 2032 _lastUserInteraction.reset(); |
| 2033 base::RecordAction(UserMetricsAction("Reload")); | 2033 base::RecordAction(UserMetricsAction("Reload")); |
| 2034 if ([self shouldLoadURLInNativeView:self.currentNavItem->GetURL()]) { | 2034 GURL url = self.currentNavItem->GetURL(); |
| 2035 if ([self shouldLoadURLInNativeView:url]) { |
| 2036 std::unique_ptr<web::NavigationContextImpl> navigationContext = [self |
| 2037 registerLoadRequestForURL:url |
| 2038 referrer:self.currentNavItemReferrer |
| 2039 transition:ui::PageTransition::PAGE_TRANSITION_RELOAD]; |
| 2035 [self.nativeController reload]; | 2040 [self.nativeController reload]; |
| 2041 _webStateImpl->OnNavigationFinished(navigationContext.get()); |
| 2042 [self loadCompleteWithSuccess:YES forNavigation:nil]; |
| 2036 } else { | 2043 } else { |
| 2037 web::NavigationItem* transientItem = | 2044 web::NavigationItem* transientItem = |
| 2038 self.navigationManagerImpl->GetTransientItem(); | 2045 self.navigationManagerImpl->GetTransientItem(); |
| 2039 if (transientItem) { | 2046 if (transientItem) { |
| 2040 // If there's a transient item, a reload is considered a new navigation to | 2047 // If there's a transient item, a reload is considered a new navigation to |
| 2041 // the transient item's URL (as on other platforms). | 2048 // the transient item's URL (as on other platforms). |
| 2042 NavigationManager::WebLoadParams reloadParams(transientItem->GetURL()); | 2049 NavigationManager::WebLoadParams reloadParams(transientItem->GetURL()); |
| 2043 reloadParams.transition_type = ui::PAGE_TRANSITION_RELOAD; | 2050 reloadParams.transition_type = ui::PAGE_TRANSITION_RELOAD; |
| 2044 reloadParams.extra_headers.reset( | 2051 reloadParams.extra_headers.reset( |
| 2045 [transientItem->GetHttpRequestHeaders() copy]); | 2052 [transientItem->GetHttpRequestHeaders() copy]); |
| (...skipping 3188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5234 - (NSUInteger)observerCount { | 5241 - (NSUInteger)observerCount { |
| 5235 DCHECK_EQ(_observerBridges.size(), [_observers count]); | 5242 DCHECK_EQ(_observerBridges.size(), [_observers count]); |
| 5236 return [_observers count]; | 5243 return [_observers count]; |
| 5237 } | 5244 } |
| 5238 | 5245 |
| 5239 - (NSString*)referrerFromNavigationAction:(WKNavigationAction*)action { | 5246 - (NSString*)referrerFromNavigationAction:(WKNavigationAction*)action { |
| 5240 return [action.request valueForHTTPHeaderField:kReferrerHeaderName]; | 5247 return [action.request valueForHTTPHeaderField:kReferrerHeaderName]; |
| 5241 } | 5248 } |
| 5242 | 5249 |
| 5243 @end | 5250 @end |
| OLD | NEW |