Chromium Code Reviews| 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 da2ae03a14d715f438312e472af75142eecc141b..62522d968285026661f175552b6672759b354e61 100644 |
| --- a/ios/web/navigation/navigation_manager_impl.mm |
| +++ b/ios/web/navigation/navigation_manager_impl.mm |
| @@ -170,6 +170,26 @@ bool AreURLsInPageNavigation(const GURL& existing_url, const GURL& new_url) { |
| delegate_->GetWebState()->OpenURL(params); |
| } |
| +void NavigationManagerImpl::AddTransientItem(const GURL& url) { |
| + [session_controller_ addTransientItemWithURL:url]; |
| + |
| + // TODO(crbug.com/676129): Add a DCHECK that pending item should always exists |
| + // when the bug is fixed, because transient item is only supposed to be added |
| + // for pending non-app-specific loads. |
| + if (GetPendingItem()) { |
|
Eugene But (OOO till 7-30)
2017/04/05 20:12:28
Could you please avoid code duplication. Sothing l
liaoyuke
2017/04/05 20:29:40
Done.
|
| + GetTransientItem()->SetUserAgentType(GetPendingItem()->GetUserAgentType()); |
| + return; |
| + } |
| + |
| + NavigationItem* last_non_native_item = GetLastCommittedNonAppSpecificItem(); |
| + DCHECK(!last_non_native_item || |
| + last_non_native_item->GetUserAgentType() != UserAgentType::NONE); |
| + if (last_non_native_item) { |
| + GetTransientItem()->SetUserAgentType( |
| + last_non_native_item->GetUserAgentType()); |
| + } |
| +} |
| + |
| void NavigationManagerImpl::AddPendingItem( |
| const GURL& url, |
| const web::Referrer& referrer, |