| 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 1475 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1486 [_delegate webWillAddPendingURL:requestURL transition:transition]; | 1486 [_delegate webWillAddPendingURL:requestURL transition:transition]; |
| 1487 // Add or update pending url. | 1487 // Add or update pending url. |
| 1488 if (self.navigationManagerImpl->GetPendingItem()) { | 1488 if (self.navigationManagerImpl->GetPendingItem()) { |
| 1489 // Update the existing pending entry. | 1489 // Update the existing pending entry. |
| 1490 // Typically on PAGE_TRANSITION_CLIENT_REDIRECT. | 1490 // Typically on PAGE_TRANSITION_CLIENT_REDIRECT. |
| 1491 [[self sessionController] updatePendingItem:requestURL]; | 1491 [[self sessionController] updatePendingItem:requestURL]; |
| 1492 } else { | 1492 } else { |
| 1493 // A new session history entry needs to be created. | 1493 // A new session history entry needs to be created. |
| 1494 self.navigationManagerImpl->AddPendingItem( | 1494 self.navigationManagerImpl->AddPendingItem( |
| 1495 requestURL, referrer, transition, | 1495 requestURL, referrer, transition, |
| 1496 web::NavigationInitiationType::RENDERER_INITIATED); | 1496 web::NavigationInitiationType::RENDERER_INITIATED, |
| 1497 web::NavigationManager::UserAgentOverrideOption::INHERIT); |
| 1497 } | 1498 } |
| 1498 _webStateImpl->SetIsLoading(true); | 1499 _webStateImpl->SetIsLoading(true); |
| 1499 _webStateImpl->OnProvisionalNavigationStarted(requestURL); | 1500 _webStateImpl->OnProvisionalNavigationStarted(requestURL); |
| 1500 } | 1501 } |
| 1501 | 1502 |
| 1502 - (void)updateHTML5HistoryState { | 1503 - (void)updateHTML5HistoryState { |
| 1503 web::NavigationItemImpl* currentItem = self.currentNavItem; | 1504 web::NavigationItemImpl* currentItem = self.currentNavItem; |
| 1504 if (!currentItem) | 1505 if (!currentItem) |
| 1505 return; | 1506 return; |
| 1506 | 1507 |
| (...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1812 [self recordStateInHistory]; | 1813 [self recordStateInHistory]; |
| 1813 | 1814 |
| 1814 if (!self.currentNavItem) | 1815 if (!self.currentNavItem) |
| 1815 initialNavigation = YES; | 1816 initialNavigation = YES; |
| 1816 | 1817 |
| 1817 web::NavigationInitiationType navigationInitiationType = | 1818 web::NavigationInitiationType navigationInitiationType = |
| 1818 params.is_renderer_initiated | 1819 params.is_renderer_initiated |
| 1819 ? web::NavigationInitiationType::RENDERER_INITIATED | 1820 ? web::NavigationInitiationType::RENDERER_INITIATED |
| 1820 : web::NavigationInitiationType::USER_INITIATED; | 1821 : web::NavigationInitiationType::USER_INITIATED; |
| 1821 self.navigationManagerImpl->AddPendingItem( | 1822 self.navigationManagerImpl->AddPendingItem( |
| 1822 navUrl, params.referrer, transition, navigationInitiationType); | 1823 navUrl, params.referrer, transition, navigationInitiationType, |
| 1824 params.user_agent_override_option); |
| 1823 | 1825 |
| 1824 web::NavigationItemImpl* addedItem = self.currentNavItem; | 1826 web::NavigationItemImpl* addedItem = self.currentNavItem; |
| 1825 DCHECK(addedItem); | 1827 DCHECK(addedItem); |
| 1826 if (params.extra_headers) | 1828 if (params.extra_headers) |
| 1827 addedItem->AddHttpRequestHeaders(params.extra_headers); | 1829 addedItem->AddHttpRequestHeaders(params.extra_headers); |
| 1828 if (params.post_data) { | 1830 if (params.post_data) { |
| 1829 DCHECK([addedItem->GetHttpRequestHeaders() objectForKey:@"Content-Type"]) | 1831 DCHECK([addedItem->GetHttpRequestHeaders() objectForKey:@"Content-Type"]) |
| 1830 << "Post data should have an associated content type"; | 1832 << "Post data should have an associated content type"; |
| 1831 addedItem->SetPostData(params.post_data); | 1833 addedItem->SetPostData(params.post_data); |
| 1832 addedItem->SetShouldSkipRepostFormConfirmation(true); | 1834 addedItem->SetShouldSkipRepostFormConfirmation(true); |
| (...skipping 3243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5076 - (void)simulateLoadRequestWithURL:(const GURL&)URL { | 5078 - (void)simulateLoadRequestWithURL:(const GURL&)URL { |
| 5077 _lastRegisteredRequestURL = URL; | 5079 _lastRegisteredRequestURL = URL; |
| 5078 _loadPhase = web::LOAD_REQUESTED; | 5080 _loadPhase = web::LOAD_REQUESTED; |
| 5079 } | 5081 } |
| 5080 | 5082 |
| 5081 - (NSString*)referrerFromNavigationAction:(WKNavigationAction*)action { | 5083 - (NSString*)referrerFromNavigationAction:(WKNavigationAction*)action { |
| 5082 return [action.request valueForHTTPHeaderField:kReferrerHeaderName]; | 5084 return [action.request valueForHTTPHeaderField:kReferrerHeaderName]; |
| 5083 } | 5085 } |
| 5084 | 5086 |
| 5085 @end | 5087 @end |
| OLD | NEW |