| 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 665 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 676 // This is called after |-applyWebViewScrollZoomScaleFromScrollState:|. | 676 // This is called after |-applyWebViewScrollZoomScaleFromScrollState:|. |
| 677 - (void)finishApplyingWebViewScrollZoomScale; | 677 - (void)finishApplyingWebViewScrollZoomScale; |
| 678 // Sets zoom scale value for webview scroll view from |zoomState|. | 678 // Sets zoom scale value for webview scroll view from |zoomState|. |
| 679 - (void)applyWebViewScrollZoomScaleFromZoomState: | 679 - (void)applyWebViewScrollZoomScaleFromZoomState: |
| 680 (const web::PageZoomState&)zoomState; | 680 (const web::PageZoomState&)zoomState; |
| 681 // Sets scroll offset value for webview scroll view from |scrollState|. | 681 // Sets scroll offset value for webview scroll view from |scrollState|. |
| 682 - (void)applyWebViewScrollOffsetFromScrollState: | 682 - (void)applyWebViewScrollOffsetFromScrollState: |
| 683 (const web::PageScrollState&)scrollState; | 683 (const web::PageScrollState&)scrollState; |
| 684 // Returns the referrer for the current page. | 684 // Returns the referrer for the current page. |
| 685 - (web::Referrer)currentReferrer; | 685 - (web::Referrer)currentReferrer; |
| 686 // Adds a new CRWSessionEntry with the given URL and state object to the history | 686 // Adds a new NavigationItem with the given URL and state object to the history |
| 687 // stack. A state object is a serialized generic JavaScript object that contains | 687 // stack. A state object is a serialized generic JavaScript object that contains |
| 688 // details of the UI's state for a given CRWSessionEntry/URL. | 688 // details of the UI's state for a given NavigationItem/URL. |
| 689 // TODO(stuartmorgan): Move the pushState/replaceState logic into | 689 // TODO(stuartmorgan): Move the pushState/replaceState logic into |
| 690 // NavigationManager. | 690 // NavigationManager. |
| 691 - (void)pushStateWithPageURL:(const GURL&)pageURL | 691 - (void)pushStateWithPageURL:(const GURL&)pageURL |
| 692 stateObject:(NSString*)stateObject | 692 stateObject:(NSString*)stateObject |
| 693 transition:(ui::PageTransition)transition; | 693 transition:(ui::PageTransition)transition; |
| 694 // Assigns the given URL and state object to the current CRWSessionEntry. | 694 // Assigns the given URL and state object to the current NavigationItem. |
| 695 - (void)replaceStateWithPageURL:(const GURL&)pageUrl | 695 - (void)replaceStateWithPageURL:(const GURL&)pageUrl |
| 696 stateObject:(NSString*)stateObject; | 696 stateObject:(NSString*)stateObject; |
| 697 // Sets _documentURL to newURL, and updates any relevant state information. | 697 // Sets _documentURL to newURL, and updates any relevant state information. |
| 698 - (void)setDocumentURL:(const GURL&)newURL; | 698 - (void)setDocumentURL:(const GURL&)newURL; |
| 699 // Sets last committed NavigationItem's title to the given |title|, which can | 699 // Sets last committed NavigationItem's title to the given |title|, which can |
| 700 // not be nil. | 700 // not be nil. |
| 701 - (void)setNavigationItemTitle:(NSString*)title; | 701 - (void)setNavigationItemTitle:(NSString*)title; |
| 702 // Returns YES if the current navigation item corresponds to a web page | 702 // Returns YES if the current navigation item corresponds to a web page |
| 703 // loaded by a POST request. | 703 // loaded by a POST request. |
| 704 - (BOOL)isCurrentNavigationItemPOST; | 704 - (BOOL)isCurrentNavigationItemPOST; |
| (...skipping 1396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2101 } | 2101 } |
| 2102 [_delegate webLoadCancelled:_URLOnStartLoading]; | 2102 [_delegate webLoadCancelled:_URLOnStartLoading]; |
| 2103 break; | 2103 break; |
| 2104 case web::PAGE_LOADED: | 2104 case web::PAGE_LOADED: |
| 2105 break; | 2105 break; |
| 2106 } | 2106 } |
| 2107 } | 2107 } |
| 2108 | 2108 |
| 2109 - (void)goToItemAtIndex:(int)index { | 2109 - (void)goToItemAtIndex:(int)index { |
| 2110 CRWSessionController* sessionController = self.sessionController; | 2110 CRWSessionController* sessionController = self.sessionController; |
| 2111 web::NavigationItemList items = sessionController.items; | 2111 const web::ScopedNavigationItemImplList& items = sessionController.items; |
| 2112 if (index < 0 || index >= static_cast<int>(items.size())) { | 2112 if (index < 0 || index >= static_cast<int>(items.size())) { |
| 2113 NOTREACHED(); | 2113 NOTREACHED(); |
| 2114 return; | 2114 return; |
| 2115 } | 2115 } |
| 2116 | 2116 |
| 2117 if (!_webStateImpl->IsShowingWebInterstitial()) | 2117 if (!_webStateImpl->IsShowingWebInterstitial()) |
| 2118 [self recordStateInHistory]; | 2118 [self recordStateInHistory]; |
| 2119 web::NavigationItem* fromItem = sessionController.currentItem; | 2119 web::NavigationItem* fromItem = sessionController.currentItem; |
| 2120 web::NavigationItem* toItem = items[index]; | 2120 web::NavigationItem* toItem = items[index].get(); |
| 2121 | 2121 |
| 2122 NSUserDefaults* userDefaults = [NSUserDefaults standardUserDefaults]; | 2122 NSUserDefaults* userDefaults = [NSUserDefaults standardUserDefaults]; |
| 2123 if (![userDefaults boolForKey:@"PendingIndexNavigationDisabled"]) { | 2123 if (![userDefaults boolForKey:@"PendingIndexNavigationDisabled"]) { |
| 2124 [self clearTransientContentView]; | 2124 [self clearTransientContentView]; |
| 2125 | 2125 |
| 2126 // Update the user agent before attempting the navigation. | 2126 // Update the user agent before attempting the navigation. |
| 2127 [self updateDesktopUserAgentForItem:toItem fromItem:fromItem]; | 2127 [self updateDesktopUserAgentForItem:toItem fromItem:fromItem]; |
| 2128 | 2128 |
| 2129 BOOL sameDocumentNavigation = | 2129 BOOL sameDocumentNavigation = |
| 2130 [sessionController isSameDocumentNavigationBetweenItem:fromItem | 2130 [sessionController isSameDocumentNavigationBetweenItem:fromItem |
| (...skipping 3068 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5199 - (void)simulateLoadRequestWithURL:(const GURL&)URL { | 5199 - (void)simulateLoadRequestWithURL:(const GURL&)URL { |
| 5200 _lastRegisteredRequestURL = URL; | 5200 _lastRegisteredRequestURL = URL; |
| 5201 _loadPhase = web::LOAD_REQUESTED; | 5201 _loadPhase = web::LOAD_REQUESTED; |
| 5202 } | 5202 } |
| 5203 | 5203 |
| 5204 - (NSString*)referrerFromNavigationAction:(WKNavigationAction*)action { | 5204 - (NSString*)referrerFromNavigationAction:(WKNavigationAction*)action { |
| 5205 return [action.request valueForHTTPHeaderField:kReferrerHeaderName]; | 5205 return [action.request valueForHTTPHeaderField:kReferrerHeaderName]; |
| 5206 } | 5206 } |
| 5207 | 5207 |
| 5208 @end | 5208 @end |
| OLD | NEW |