| 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 2061 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2072 | 2072 |
| 2073 - (void)abortLoad { | 2073 - (void)abortLoad { |
| 2074 [_webView stopLoading]; | 2074 [_webView stopLoading]; |
| 2075 [_pendingNavigationInfo setCancelled:YES]; | 2075 [_pendingNavigationInfo setCancelled:YES]; |
| 2076 _certVerificationErrors->Clear(); | 2076 _certVerificationErrors->Clear(); |
| 2077 [self loadCancelled]; | 2077 [self loadCancelled]; |
| 2078 } | 2078 } |
| 2079 | 2079 |
| 2080 - (void)loadCancelled { | 2080 - (void)loadCancelled { |
| 2081 [_passKitDownloader cancelPendingDownload]; | 2081 [_passKitDownloader cancelPendingDownload]; |
| 2082 | 2082 if (_loadPhase != web::PAGE_LOADED) { |
| 2083 // Current load will not complete; this should be communicated upstream to the | 2083 _loadPhase = web::PAGE_LOADED; |
| 2084 // delegate. | 2084 if (!_isHalted) { |
| 2085 switch (_loadPhase) { | 2085 _webStateImpl->SetIsLoading(false); |
| 2086 case web::LOAD_REQUESTED: | 2086 } |
| 2087 // Load phase after abort is always PAGE_LOADED. | |
| 2088 _loadPhase = web::PAGE_LOADED; | |
| 2089 if (!_isHalted) { | |
| 2090 _webStateImpl->SetIsLoading(false); | |
| 2091 } | |
| 2092 [_delegate webCancelStartLoadingRequest]; | |
| 2093 break; | |
| 2094 case web::PAGE_LOADING: | |
| 2095 // The previous load never fully completed before this page change. The | |
| 2096 // loadPhase is changed to PAGE_LOADED to indicate the cycle is complete, | |
| 2097 // and the delegate is called. | |
| 2098 _loadPhase = web::PAGE_LOADED; | |
| 2099 if (!_isHalted) { | |
| 2100 _webStateImpl->SetIsLoading(false); | |
| 2101 } | |
| 2102 [_delegate webLoadCancelled:_URLOnStartLoading]; | |
| 2103 break; | |
| 2104 case web::PAGE_LOADED: | |
| 2105 break; | |
| 2106 } | 2087 } |
| 2107 } | 2088 } |
| 2108 | 2089 |
| 2109 - (void)goToItemAtIndex:(int)index { | 2090 - (void)goToItemAtIndex:(int)index { |
| 2110 CRWSessionController* sessionController = self.sessionController; | 2091 CRWSessionController* sessionController = self.sessionController; |
| 2111 const web::ScopedNavigationItemImplList& items = sessionController.items; | 2092 const web::ScopedNavigationItemImplList& items = sessionController.items; |
| 2112 if (index < 0 || index >= static_cast<int>(items.size())) { | 2093 if (index < 0 || index >= static_cast<int>(items.size())) { |
| 2113 NOTREACHED(); | 2094 NOTREACHED(); |
| 2114 return; | 2095 return; |
| 2115 } | 2096 } |
| (...skipping 3089 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5205 - (void)simulateLoadRequestWithURL:(const GURL&)URL { | 5186 - (void)simulateLoadRequestWithURL:(const GURL&)URL { |
| 5206 _lastRegisteredRequestURL = URL; | 5187 _lastRegisteredRequestURL = URL; |
| 5207 _loadPhase = web::LOAD_REQUESTED; | 5188 _loadPhase = web::LOAD_REQUESTED; |
| 5208 } | 5189 } |
| 5209 | 5190 |
| 5210 - (NSString*)referrerFromNavigationAction:(WKNavigationAction*)action { | 5191 - (NSString*)referrerFromNavigationAction:(WKNavigationAction*)action { |
| 5211 return [action.request valueForHTTPHeaderField:kReferrerHeaderName]; | 5192 return [action.request valueForHTTPHeaderField:kReferrerHeaderName]; |
| 5212 } | 5193 } |
| 5213 | 5194 |
| 5214 @end | 5195 @end |
| OLD | NEW |