| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/navigation/navigation_manager_impl.h" | 5 #import "ios/web/navigation/navigation_manager_impl.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 } | 163 } |
| 164 | 164 |
| 165 void NavigationManagerImpl::LoadURL(const GURL& url, | 165 void NavigationManagerImpl::LoadURL(const GURL& url, |
| 166 const web::Referrer& referrer, | 166 const web::Referrer& referrer, |
| 167 ui::PageTransition type) { | 167 ui::PageTransition type) { |
| 168 WebState::OpenURLParams params(url, referrer, | 168 WebState::OpenURLParams params(url, referrer, |
| 169 WindowOpenDisposition::CURRENT_TAB, type, NO); | 169 WindowOpenDisposition::CURRENT_TAB, type, NO); |
| 170 delegate_->GetWebState()->OpenURL(params); | 170 delegate_->GetWebState()->OpenURL(params); |
| 171 } | 171 } |
| 172 | 172 |
| 173 void NavigationManagerImpl::AddTransientItem(const GURL& url) { |
| 174 [session_controller_ addTransientItemWithURL:url]; |
| 175 |
| 176 // TODO(crbug.com/676129): Transient item is only supposed to be added for |
| 177 // pending non-app-specific loads, but pending item can be null because of the |
| 178 // bug. The workaround should be removed once the bug is fixed. |
| 179 NavigationItem* item = GetPendingItem(); |
| 180 if (!item) |
| 181 item = GetLastCommittedNonAppSpecificItem(); |
| 182 DCHECK(item->GetUserAgentType() != UserAgentType::NONE); |
| 183 GetTransientItem()->SetUserAgentType(item->GetUserAgentType()); |
| 184 } |
| 185 |
| 173 void NavigationManagerImpl::AddPendingItem( | 186 void NavigationManagerImpl::AddPendingItem( |
| 174 const GURL& url, | 187 const GURL& url, |
| 175 const web::Referrer& referrer, | 188 const web::Referrer& referrer, |
| 176 ui::PageTransition navigation_type, | 189 ui::PageTransition navigation_type, |
| 177 NavigationInitiationType initiation_type, | 190 NavigationInitiationType initiation_type, |
| 178 UserAgentOverrideOption user_agent_override_option) { | 191 UserAgentOverrideOption user_agent_override_option) { |
| 179 [session_controller_ addPendingItem:url | 192 [session_controller_ addPendingItem:url |
| 180 referrer:referrer | 193 referrer:referrer |
| 181 transition:navigation_type | 194 transition:navigation_type |
| 182 initiationType:initiation_type]; | 195 initiationType:initiation_type]; |
| (...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 458 const ScopedNavigationItemImplList& items = [session_controller_ items]; | 471 const ScopedNavigationItemImplList& items = [session_controller_ items]; |
| 459 while (index >= 0) { | 472 while (index >= 0) { |
| 460 NavigationItem* item = items[index--].get(); | 473 NavigationItem* item = items[index--].get(); |
| 461 if (!client->IsAppSpecificURL(item->GetVirtualURL())) | 474 if (!client->IsAppSpecificURL(item->GetVirtualURL())) |
| 462 return item; | 475 return item; |
| 463 } | 476 } |
| 464 return nullptr; | 477 return nullptr; |
| 465 } | 478 } |
| 466 | 479 |
| 467 } // namespace web | 480 } // namespace web |
| OLD | NEW |