| 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 2360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2371 } | 2371 } |
| 2372 | 2372 |
| 2373 [self restoreStateFromHistory]; | 2373 [self restoreStateFromHistory]; |
| 2374 _webStateImpl->OnPageLoaded(currentURL, loadSuccess); | 2374 _webStateImpl->OnPageLoaded(currentURL, loadSuccess); |
| 2375 _webStateImpl->SetIsLoading(false); | 2375 _webStateImpl->SetIsLoading(false); |
| 2376 // Inform the embedder the load completed. | 2376 // Inform the embedder the load completed. |
| 2377 [_delegate webDidFinishWithURL:currentURL loadSuccess:loadSuccess]; | 2377 [_delegate webDidFinishWithURL:currentURL loadSuccess:loadSuccess]; |
| 2378 } | 2378 } |
| 2379 | 2379 |
| 2380 - (void)goDelta:(int)delta { | 2380 - (void)goDelta:(int)delta { |
| 2381 if (_isBeingDestroyed) |
| 2382 return; |
| 2383 |
| 2381 if (delta == 0) { | 2384 if (delta == 0) { |
| 2382 [self reload]; | 2385 [self reload]; |
| 2383 } else if ([self.sessionController canGoDelta:delta]) { | 2386 } else if (_webStateImpl->GetNavigationManager()->CanGoToOffset(delta)) { |
| 2384 [self goToItemAtIndex:[self.sessionController indexOfEntryForDelta:delta]]; | 2387 [self goToItemAtIndex:[self.sessionController indexOfEntryForDelta:delta]]; |
| 2385 } | 2388 } |
| 2386 } | 2389 } |
| 2387 | 2390 |
| 2388 - (void)finishHistoryNavigationFromEntry:(CRWSessionEntry*)fromEntry { | 2391 - (void)finishHistoryNavigationFromEntry:(CRWSessionEntry*)fromEntry { |
| 2389 [_delegate webWillFinishHistoryNavigationFromEntry:fromEntry]; | 2392 [_delegate webWillFinishHistoryNavigationFromEntry:fromEntry]; |
| 2390 | 2393 |
| 2391 // Only load the new URL if it has a different document than |fromEntry| to | 2394 // Only load the new URL if it has a different document than |fromEntry| to |
| 2392 // prevent extra page loads from NavigationItems created by hash changes or | 2395 // prevent extra page loads from NavigationItems created by hash changes or |
| 2393 // calls to window.history.pushState(). | 2396 // calls to window.history.pushState(). |
| (...skipping 3333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5727 } | 5730 } |
| 5728 | 5731 |
| 5729 return web::WEB_VIEW_DOCUMENT_TYPE_GENERIC; | 5732 return web::WEB_VIEW_DOCUMENT_TYPE_GENERIC; |
| 5730 } | 5733 } |
| 5731 | 5734 |
| 5732 - (NSString*)refererFromNavigationAction:(WKNavigationAction*)action { | 5735 - (NSString*)refererFromNavigationAction:(WKNavigationAction*)action { |
| 5733 return [action.request valueForHTTPHeaderField:@"Referer"]; | 5736 return [action.request valueForHTTPHeaderField:@"Referer"]; |
| 5734 } | 5737 } |
| 5735 | 5738 |
| 5736 @end | 5739 @end |
| OLD | NEW |