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

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

Issue 2779263002: Set user agent type of transient item the same as pending item. (Closed)
Patch Set: Remove code duplication 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 DCHECK(GetTransientItem());
176
177 // Transient item can only be added for pending non-app-specific loads.
178 DCHECK(GetPendingItem());
Eugene But (OOO till 7-30) 2017/03/31 18:33:00 nit: No need to DCHECK, the next line will crash a
liaoyuke 2017/04/04 17:25:01 Done.
179 DCHECK_NE(UserAgentType::NONE, GetPendingItem()->GetUserAgentType());
180 GetTransientItem()->SetUserAgentType(GetPendingItem()->GetUserAgentType());
181 }
182
173 void NavigationManagerImpl::AddPendingItem( 183 void NavigationManagerImpl::AddPendingItem(
174 const GURL& url, 184 const GURL& url,
175 const web::Referrer& referrer, 185 const web::Referrer& referrer,
176 ui::PageTransition navigation_type, 186 ui::PageTransition navigation_type,
177 NavigationInitiationType initiation_type) { 187 NavigationInitiationType initiation_type) {
178 [session_controller_ addPendingItem:url 188 [session_controller_ addPendingItem:url
179 referrer:referrer 189 referrer:referrer
180 transition:navigation_type 190 transition:navigation_type
181 initiationType:initiation_type]; 191 initiationType:initiation_type];
182 192
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after
463 const ScopedNavigationItemImplList& items = [session_controller_ items]; 473 const ScopedNavigationItemImplList& items = [session_controller_ items];
464 while (index >= 0) { 474 while (index >= 0) {
465 NavigationItem* item = items[index--].get(); 475 NavigationItem* item = items[index--].get();
466 if (!client->IsAppSpecificURL(item->GetVirtualURL())) 476 if (!client->IsAppSpecificURL(item->GetVirtualURL()))
467 return item; 477 return item;
468 } 478 }
469 return nullptr; 479 return nullptr;
470 } 480 }
471 481
472 } // namespace web 482 } // 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