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

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

Issue 2711683002: (Set)IsOverridingUserAgent should be called on VisibleItem (Closed)
Patch Set: Created 3 years, 10 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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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/crw_session_controller.h" 5 #import "ios/web/navigation/crw_session_controller.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <utility> 10 #include <utility>
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 69
70 // Stores the certificate policies decided by the user. 70 // Stores the certificate policies decided by the user.
71 CRWSessionCertificatePolicyManager* _sessionCertificatePolicyManager; 71 CRWSessionCertificatePolicyManager* _sessionCertificatePolicyManager;
72 72
73 // The timestamp of the last time this tab is visited, represented in time 73 // The timestamp of the last time this tab is visited, represented in time
74 // interval since 1970. 74 // interval since 1970.
75 NSTimeInterval _lastVisitedTimestamp; 75 NSTimeInterval _lastVisitedTimestamp;
76 76
77 // If |YES|, override |currentEntry.useDesktopUserAgent| and create the 77 // If |YES|, override |currentEntry.useDesktopUserAgent| and create the
78 // pending entry using the desktop user agent. 78 // pending entry using the desktop user agent.
79 BOOL _useDesktopUserAgentForNextPendingItem; 79 BOOL _useDesktopUserAgentForNextPendingItem;
kkhorimoto 2017/02/22 01:08:40 I missed this while reviewing your other CL, but c
liaoyuke 2017/02/22 01:37:43 Done.
80 80
81 // The browser state associated with this CRWSessionController; 81 // The browser state associated with this CRWSessionController;
82 web::BrowserState* _browserState; // weak 82 web::BrowserState* _browserState; // weak
83 83
84 // Time smoother for navigation entry timestamps; see comment in 84 // Time smoother for navigation entry timestamps; see comment in
85 // navigation_controller_impl.h 85 // navigation_controller_impl.h
86 web::TimeSmoother _timeSmoother; 86 web::TimeSmoother _timeSmoother;
87 } 87 }
88 88
89 // Redefine as readwrite. 89 // Redefine as readwrite.
(...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after
489 DCHECK(navigationItem); 489 DCHECK(navigationItem);
490 navigationItem->SetTimestamp( 490 navigationItem->SetTimestamp(
491 _timeSmoother.GetSmoothedTime(base::Time::Now())); 491 _timeSmoother.GetSmoothedTime(base::Time::Now()));
492 } 492 }
493 493
494 - (void)pushNewItemWithURL:(const GURL&)URL 494 - (void)pushNewItemWithURL:(const GURL&)URL
495 stateObject:(NSString*)stateObject 495 stateObject:(NSString*)stateObject
496 transition:(ui::PageTransition)transition { 496 transition:(ui::PageTransition)transition {
497 DCHECK(![self pendingEntry]); 497 DCHECK(![self pendingEntry]);
498 DCHECK([self currentEntry]); 498 DCHECK([self currentEntry]);
499 web::NavigationItem* currentItem = [self currentEntry].navigationItem; 499 web::NavigationItem* visibleItem = [self visibleEntry].navigationItem;
500 CHECK(web::history_state_util::IsHistoryStateChangeValid( 500 CHECK(web::history_state_util::IsHistoryStateChangeValid(
501 currentItem->GetURL(), URL)); 501 visibleItem->GetURL(), URL));
liaoyuke 2017/02/22 00:12:32 Confirmed with Kurt and it is safe to change all c
Eugene But (OOO till 7-30) 2017/02/22 21:57:41 Why is this visible? Should this be lastCommittedI
kkhorimoto 2017/02/22 22:54:15 Since a page showing an interstitial can't do a pu
Eugene But (OOO till 7-30) 2017/02/23 00:54:23 Yuke, please address this comment.
Eugene But (OOO till 7-30) 2017/02/23 02:36:59 Yuke?
liaoyuke 2017/02/23 17:50:42 Sorry, missed this one. Done!
502 web::Referrer referrer(currentItem->GetURL(), web::ReferrerPolicyDefault); 502 web::Referrer referrer(visibleItem->GetURL(), web::ReferrerPolicyDefault);
503 503
504 base::scoped_nsobject<CRWSessionEntry> pushedEntry([self 504 base::scoped_nsobject<CRWSessionEntry> pushedEntry([self
505 sessionEntryWithURL:URL 505 sessionEntryWithURL:URL
506 referrer:referrer 506 referrer:referrer
507 transition:transition 507 transition:transition
508 initiationType:web::NavigationInitiationType::USER_INITIATED]); 508 initiationType:web::NavigationInitiationType::USER_INITIATED]);
509 509
510 web::NavigationItemImpl* pushedItem = [pushedEntry navigationItemImpl]; 510 web::NavigationItemImpl* pushedItem = [pushedEntry navigationItemImpl];
511 pushedItem->SetIsOverridingUserAgent(currentItem->IsOverridingUserAgent()); 511 pushedItem->SetIsOverridingUserAgent(visibleItem->IsOverridingUserAgent());
512 pushedItem->SetSerializedStateObject(stateObject); 512 pushedItem->SetSerializedStateObject(stateObject);
513 pushedItem->SetIsCreatedFromPushState(true); 513 pushedItem->SetIsCreatedFromPushState(true);
514 web::SSLStatus& sslStatus = [self currentEntry].navigationItem->GetSSL(); 514 web::SSLStatus& sslStatus = [self currentEntry].navigationItem->GetSSL();
515 pushedEntry.get().navigationItem->GetSSL() = sslStatus; 515 pushedEntry.get().navigationItem->GetSSL() = sslStatus;
516 516
517 [self clearForwardItems]; 517 [self clearForwardItems];
518 // Add the new entry at the end. 518 // Add the new entry at the end.
519 [_entries addObject:pushedEntry]; 519 [_entries addObject:pushedEntry];
520 _previousNavigationIndex = _currentNavigationIndex; 520 _previousNavigationIndex = _currentNavigationIndex;
521 self.currentNavigationIndex = [_entries count] - 1; 521 self.currentNavigationIndex = [_entries count] - 1;
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
725 } 725 }
726 726
727 - (web::NavigationItemList)itemListForEntryList:(NSArray*)entries { 727 - (web::NavigationItemList)itemListForEntryList:(NSArray*)entries {
728 web::NavigationItemList list(entries.count); 728 web::NavigationItemList list(entries.count);
729 for (size_t index = 0; index < entries.count; ++index) 729 for (size_t index = 0; index < entries.count; ++index)
730 list[index] = [entries[index] navigationItem]; 730 list[index] = [entries[index] navigationItem];
731 return list; 731 return list;
732 } 732 }
733 733
734 @end 734 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698