Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(460)

Side by Side Diff: ios/web/navigation/navigation_manager_impl.mm

Issue 2805453002: Reland of Set user agent type of transient item the same as pending item (Closed)
Patch Set: Address comments Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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): Add a DCHECK that pending item should always exists
Eugene But (OOO till 7-30) 2017/04/05 22:05:39 There is no need for DCHECK, because when crbug.co
177 // when the bug is fixed, because transient item is only supposed to be added
178 // for pending non-app-specific loads.
179 NavigationItem* item = GetPendingItem();
180 if (!item)
181 item = GetLastCommittedNonAppSpecificItem();
182 DCHECK(!item || item->GetUserAgentType() != UserAgentType::NONE);
183 if (item)
Eugene But (OOO till 7-30) 2017/04/05 22:05:39 When can |item| be null?
184 GetTransientItem()->SetUserAgentType(item->GetUserAgentType());
185 }
186
173 void NavigationManagerImpl::AddPendingItem( 187 void NavigationManagerImpl::AddPendingItem(
174 const GURL& url, 188 const GURL& url,
175 const web::Referrer& referrer, 189 const web::Referrer& referrer,
176 ui::PageTransition navigation_type, 190 ui::PageTransition navigation_type,
177 NavigationInitiationType initiation_type, 191 NavigationInitiationType initiation_type,
178 UserAgentOverrideOption user_agent_override_option) { 192 UserAgentOverrideOption user_agent_override_option) {
179 [session_controller_ addPendingItem:url 193 [session_controller_ addPendingItem:url
180 referrer:referrer 194 referrer:referrer
181 transition:navigation_type 195 transition:navigation_type
182 initiationType:initiation_type]; 196 initiationType:initiation_type];
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after
458 const ScopedNavigationItemImplList& items = [session_controller_ items]; 472 const ScopedNavigationItemImplList& items = [session_controller_ items];
459 while (index >= 0) { 473 while (index >= 0) {
460 NavigationItem* item = items[index--].get(); 474 NavigationItem* item = items[index--].get();
461 if (!client->IsAppSpecificURL(item->GetVirtualURL())) 475 if (!client->IsAppSpecificURL(item->GetVirtualURL()))
462 return item; 476 return item;
463 } 477 }
464 return nullptr; 478 return nullptr;
465 } 479 }
466 480
467 } // namespace web 481 } // namespace web
OLDNEW
« no previous file with comments | « ios/web/navigation/navigation_manager_impl.h ('k') | ios/web/navigation/navigation_manager_impl_unittest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698