| 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 1319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1330 // re-sent when replaying the entry. | 1330 // re-sent when replaying the entry. |
| 1331 // TODO(stuartmorgan): When possible, get the real referrer and policy in | 1331 // TODO(stuartmorgan): When possible, get the real referrer and policy in |
| 1332 // advance and use that instead. https://crbug.com/227769. | 1332 // advance and use that instead. https://crbug.com/227769. |
| 1333 return web::Referrer(GURL(base::SysNSStringToUTF8(referrerString)), | 1333 return web::Referrer(GURL(base::SysNSStringToUTF8(referrerString)), |
| 1334 web::ReferrerPolicyAlways); | 1334 web::ReferrerPolicyAlways); |
| 1335 } | 1335 } |
| 1336 | 1336 |
| 1337 - (void)pushStateWithPageURL:(const GURL&)pageURL | 1337 - (void)pushStateWithPageURL:(const GURL&)pageURL |
| 1338 stateObject:(NSString*)stateObject | 1338 stateObject:(NSString*)stateObject |
| 1339 transition:(ui::PageTransition)transition { | 1339 transition:(ui::PageTransition)transition { |
| 1340 _webStateImpl->OnProvisionalNavigationStarted(pageURL); | 1340 std::unique_ptr<web::NavigationContextImpl> context = |
| 1341 web::NavigationContextImpl::CreateNavigationContext(_webStateImpl, |
| 1342 pageURL); |
| 1343 _webStateImpl->OnNavigationStarted(context.get()); |
| 1341 [[self sessionController] pushNewItemWithURL:pageURL | 1344 [[self sessionController] pushNewItemWithURL:pageURL |
| 1342 stateObject:stateObject | 1345 stateObject:stateObject |
| 1343 transition:transition]; | 1346 transition:transition]; |
| 1344 std::unique_ptr<web::NavigationContextImpl> context = | |
| 1345 web::NavigationContextImpl::CreateNavigationContext(_webStateImpl, | |
| 1346 pageURL); | |
| 1347 context->SetIsSameDocument(true); | 1347 context->SetIsSameDocument(true); |
| 1348 _webStateImpl->OnNavigationFinished(context.get()); | 1348 _webStateImpl->OnNavigationFinished(context.get()); |
| 1349 self.userInteractionRegistered = NO; | 1349 self.userInteractionRegistered = NO; |
| 1350 } | 1350 } |
| 1351 | 1351 |
| 1352 - (void)replaceStateWithPageURL:(const GURL&)pageURL | 1352 - (void)replaceStateWithPageURL:(const GURL&)pageURL |
| 1353 stateObject:(NSString*)stateObject { | 1353 stateObject:(NSString*)stateObject { |
| 1354 _webStateImpl->OnProvisionalNavigationStarted(pageURL); | |
| 1355 [[self sessionController] updateCurrentItemWithURL:pageURL | |
| 1356 stateObject:stateObject]; | |
| 1357 std::unique_ptr<web::NavigationContextImpl> context = | 1354 std::unique_ptr<web::NavigationContextImpl> context = |
| 1358 web::NavigationContextImpl::CreateNavigationContext(_webStateImpl, | 1355 web::NavigationContextImpl::CreateNavigationContext(_webStateImpl, |
| 1359 pageURL); | 1356 pageURL); |
| 1357 _webStateImpl->OnNavigationStarted(context.get()); |
| 1358 [[self sessionController] updateCurrentItemWithURL:pageURL |
| 1359 stateObject:stateObject]; |
| 1360 context->SetIsSameDocument(true); | 1360 context->SetIsSameDocument(true); |
| 1361 _webStateImpl->OnNavigationFinished(context.get()); | 1361 _webStateImpl->OnNavigationFinished(context.get()); |
| 1362 } | 1362 } |
| 1363 | 1363 |
| 1364 - (void)setDocumentURL:(const GURL&)newURL { | 1364 - (void)setDocumentURL:(const GURL&)newURL { |
| 1365 if (newURL != _documentURL && newURL.is_valid()) { | 1365 if (newURL != _documentURL && newURL.is_valid()) { |
| 1366 _documentURL = newURL; | 1366 _documentURL = newURL; |
| 1367 _interactionRegisteredSinceLastURLChange = NO; | 1367 _interactionRegisteredSinceLastURLChange = NO; |
| 1368 } | 1368 } |
| 1369 } | 1369 } |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1524 // A new session history entry needs to be created. | 1524 // A new session history entry needs to be created. |
| 1525 self.navigationManagerImpl->AddPendingItem( | 1525 self.navigationManagerImpl->AddPendingItem( |
| 1526 requestURL, referrer, transition, | 1526 requestURL, referrer, transition, |
| 1527 web::NavigationInitiationType::RENDERER_INITIATED, | 1527 web::NavigationInitiationType::RENDERER_INITIATED, |
| 1528 web::NavigationManager::UserAgentOverrideOption::INHERIT); | 1528 web::NavigationManager::UserAgentOverrideOption::INHERIT); |
| 1529 } | 1529 } |
| 1530 std::unique_ptr<web::NavigationContextImpl> context = | 1530 std::unique_ptr<web::NavigationContextImpl> context = |
| 1531 web::NavigationContextImpl::CreateNavigationContext(_webStateImpl, | 1531 web::NavigationContextImpl::CreateNavigationContext(_webStateImpl, |
| 1532 requestURL); | 1532 requestURL); |
| 1533 _webStateImpl->SetIsLoading(true); | 1533 _webStateImpl->SetIsLoading(true); |
| 1534 // TODO(crbug.com/713836): pass context to |OnProvisionalNavigationStarted|. | 1534 _webStateImpl->OnNavigationStarted(context.get()); |
| 1535 _webStateImpl->OnProvisionalNavigationStarted(requestURL); | |
| 1536 return context; | 1535 return context; |
| 1537 } | 1536 } |
| 1538 | 1537 |
| 1539 - (void)updateHTML5HistoryState { | 1538 - (void)updateHTML5HistoryState { |
| 1540 web::NavigationItemImpl* currentItem = self.currentNavItem; | 1539 web::NavigationItemImpl* currentItem = self.currentNavItem; |
| 1541 if (!currentItem) | 1540 if (!currentItem) |
| 1542 return; | 1541 return; |
| 1543 | 1542 |
| 1544 // Same-document navigations must trigger a popState event. | 1543 // Same-document navigations must trigger a popState event. |
| 1545 CRWSessionController* sessionController = self.sessionController; | 1544 CRWSessionController* sessionController = self.sessionController; |
| (...skipping 3605 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5151 - (NSUInteger)observerCount { | 5150 - (NSUInteger)observerCount { |
| 5152 DCHECK_EQ(_observerBridges.size(), [_observers count]); | 5151 DCHECK_EQ(_observerBridges.size(), [_observers count]); |
| 5153 return [_observers count]; | 5152 return [_observers count]; |
| 5154 } | 5153 } |
| 5155 | 5154 |
| 5156 - (NSString*)referrerFromNavigationAction:(WKNavigationAction*)action { | 5155 - (NSString*)referrerFromNavigationAction:(WKNavigationAction*)action { |
| 5157 return [action.request valueForHTTPHeaderField:kReferrerHeaderName]; | 5156 return [action.request valueForHTTPHeaderField:kReferrerHeaderName]; |
| 5158 } | 5157 } |
| 5159 | 5158 |
| 5160 @end | 5159 @end |
| OLD | NEW |