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 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
141 const web::Referrer& referrer, | 141 const web::Referrer& referrer, |
142 ui::PageTransition type) { | 142 ui::PageTransition type) { |
143 WebState::OpenURLParams params(url, referrer, | 143 WebState::OpenURLParams params(url, referrer, |
144 WindowOpenDisposition::CURRENT_TAB, type, NO); | 144 WindowOpenDisposition::CURRENT_TAB, type, NO); |
145 delegate_->GetWebState()->OpenURL(params); | 145 delegate_->GetWebState()->OpenURL(params); |
146 } | 146 } |
147 | 147 |
148 void NavigationManagerImpl::AddTransientItem(const GURL& url) { | 148 void NavigationManagerImpl::AddTransientItem(const GURL& url) { |
149 [session_controller_ addTransientItemWithURL:url]; | 149 [session_controller_ addTransientItemWithURL:url]; |
150 | 150 |
151 // TODO(crbug.com/676129): Transient item is only supposed to be added for | |
152 // pending non-app-specific loads, but pending item can be null because of the | |
153 // bug. The workaround should be removed once the bug is fixed. | |
154 NavigationItem* item = GetPendingItem(); | 151 NavigationItem* item = GetPendingItem(); |
155 if (!item) | 152 DCHECK(item); |
Eugene But (OOO till 7-30)
2017/06/15 00:08:11
nit: No need for DCHECK before dereferencing the p
mrefaat
2017/06/15 18:35:35
Done.
| |
156 item = GetLastCommittedNonAppSpecificItem(); | |
157 DCHECK(item->GetUserAgentType() != UserAgentType::NONE); | 153 DCHECK(item->GetUserAgentType() != UserAgentType::NONE); |
158 GetTransientItem()->SetUserAgentType(item->GetUserAgentType()); | 154 GetTransientItem()->SetUserAgentType(item->GetUserAgentType()); |
159 } | 155 } |
160 | 156 |
161 void NavigationManagerImpl::AddPendingItem( | 157 void NavigationManagerImpl::AddPendingItem( |
162 const GURL& url, | 158 const GURL& url, |
163 const web::Referrer& referrer, | 159 const web::Referrer& referrer, |
164 ui::PageTransition navigation_type, | 160 ui::PageTransition navigation_type, |
165 NavigationInitiationType initiation_type, | 161 NavigationInitiationType initiation_type, |
166 UserAgentOverrideOption user_agent_override_option) { | 162 UserAgentOverrideOption user_agent_override_option) { |
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
439 const ScopedNavigationItemImplList& items = [session_controller_ items]; | 435 const ScopedNavigationItemImplList& items = [session_controller_ items]; |
440 while (index >= 0) { | 436 while (index >= 0) { |
441 NavigationItem* item = items[index--].get(); | 437 NavigationItem* item = items[index--].get(); |
442 if (!client->IsAppSpecificURL(item->GetVirtualURL())) | 438 if (!client->IsAppSpecificURL(item->GetVirtualURL())) |
443 return item; | 439 return item; |
444 } | 440 } |
445 return nullptr; | 441 return nullptr; |
446 } | 442 } |
447 | 443 |
448 } // namespace web | 444 } // namespace web |
OLD | NEW |