| Index: ios/web/navigation/navigation_manager_impl.mm
|
| diff --git a/ios/web/navigation/navigation_manager_impl.mm b/ios/web/navigation/navigation_manager_impl.mm
|
| index b246e7e17e03c15ebaf0ace9fb3799b016ecf84a..140c760468abf0f45fe5fdaa6d512dbb8b08ed32 100644
|
| --- a/ios/web/navigation/navigation_manager_impl.mm
|
| +++ b/ios/web/navigation/navigation_manager_impl.mm
|
| @@ -68,7 +68,10 @@ bool AreURLsInPageNavigation(const GURL& existing_url, const GURL& new_url) {
|
| }
|
|
|
| NavigationManagerImpl::NavigationManagerImpl()
|
| - : delegate_(nullptr), browser_state_(nullptr), facade_delegate_(nullptr) {}
|
| + : override_desktop_user_agent_for_next_pending_item_(false),
|
| + delegate_(nullptr),
|
| + browser_state_(nullptr),
|
| + facade_delegate_(nullptr) {}
|
|
|
| NavigationManagerImpl::~NavigationManagerImpl() {
|
| // The facade layer should be deleted before this object.
|
| @@ -173,6 +176,27 @@ bool AreURLsInPageNavigation(const GURL& existing_url, const GURL& new_url) {
|
| delegate_->GetWebState()->OpenURL(params);
|
| }
|
|
|
| +void NavigationManagerImpl::AddPendingItem(
|
| + const GURL& url,
|
| + const web::Referrer& referrer,
|
| + ui::PageTransition navigation_type,
|
| + NavigationInitiationType initiation_type) {
|
| + [session_controller_ addPendingItem:url
|
| + referrer:referrer
|
| + transition:navigation_type
|
| + initiationType:initiation_type];
|
| +
|
| + // Do nothing if pending item is the same as last committed item.
|
| + if (GetPendingItem()) {
|
| + bool use_desktop_user_agent =
|
| + override_desktop_user_agent_for_next_pending_item_ ||
|
| + (GetLastCommittedItem() &&
|
| + GetLastCommittedItem()->IsOverridingUserAgent());
|
| + GetPendingItem()->SetIsOverridingUserAgent(use_desktop_user_agent);
|
| + override_desktop_user_agent_for_next_pending_item_ = false;
|
| + }
|
| +}
|
| +
|
| NavigationItem* NavigationManagerImpl::GetLastUserItem() const {
|
| CRWSessionEntry* entry = [session_controller_ lastUserEntry];
|
| return [entry navigationItem];
|
| @@ -396,6 +420,13 @@ bool AreURLsInPageNavigation(const GURL& existing_url, const GURL& new_url) {
|
| return result;
|
| }
|
|
|
| +void NavigationManagerImpl::OverrideDesktopUserAgentForNextPendingItem() {
|
| + if (GetPendingItem())
|
| + GetPendingItem()->SetIsOverridingUserAgent(true);
|
| + else
|
| + override_desktop_user_agent_for_next_pending_item_ = true;
|
| +}
|
| +
|
| bool NavigationManagerImpl::IsRedirectItemAtIndex(int index) const {
|
| DCHECK_GT(index, 0);
|
| DCHECK_LT(index, GetItemCount());
|
|
|