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

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

Issue 2711683002: (Set)IsOverridingUserAgent should be called on VisibleItem (Closed)
Patch Set: Addressed feedback 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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 // The window name associated with the session. 67 // The window name associated with the session.
68 NSString* _windowName; 68 NSString* _windowName;
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
78 // pending entry using the desktop user agent.
79 BOOL _useDesktopUserAgentForNextPendingItem;
80
81 // The browser state associated with this CRWSessionController; 77 // The browser state associated with this CRWSessionController;
82 web::BrowserState* _browserState; // weak 78 web::BrowserState* _browserState; // weak
83 79
84 // Time smoother for navigation entry timestamps; see comment in 80 // Time smoother for navigation entry timestamps; see comment in
85 // navigation_controller_impl.h 81 // navigation_controller_impl.h
86 web::TimeSmoother _timeSmoother; 82 web::TimeSmoother _timeSmoother;
87 } 83 }
88 84
89 // Redefine as readwrite. 85 // Redefine as readwrite.
90 @property(nonatomic, readwrite, assign) NSInteger currentNavigationIndex; 86 @property(nonatomic, readwrite, assign) NSInteger currentNavigationIndex;
(...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after
489 DCHECK(navigationItem); 485 DCHECK(navigationItem);
490 navigationItem->SetTimestamp( 486 navigationItem->SetTimestamp(
491 _timeSmoother.GetSmoothedTime(base::Time::Now())); 487 _timeSmoother.GetSmoothedTime(base::Time::Now()));
492 } 488 }
493 489
494 - (void)pushNewItemWithURL:(const GURL&)URL 490 - (void)pushNewItemWithURL:(const GURL&)URL
495 stateObject:(NSString*)stateObject 491 stateObject:(NSString*)stateObject
496 transition:(ui::PageTransition)transition { 492 transition:(ui::PageTransition)transition {
497 DCHECK(![self pendingEntry]); 493 DCHECK(![self pendingEntry]);
498 DCHECK([self currentEntry]); 494 DCHECK([self currentEntry]);
499 web::NavigationItem* currentItem = [self currentEntry].navigationItem; 495 web::NavigationItem* visibleItem = [self visibleEntry].navigationItem;
500 CHECK(web::history_state_util::IsHistoryStateChangeValid( 496 CHECK(web::history_state_util::IsHistoryStateChangeValid(
501 currentItem->GetURL(), URL)); 497 visibleItem->GetURL(), URL));
502 web::Referrer referrer(currentItem->GetURL(), web::ReferrerPolicyDefault); 498 web::Referrer referrer(visibleItem->GetURL(), web::ReferrerPolicyDefault);
503 499
504 base::scoped_nsobject<CRWSessionEntry> pushedEntry([self 500 base::scoped_nsobject<CRWSessionEntry> pushedEntry([self
505 sessionEntryWithURL:URL 501 sessionEntryWithURL:URL
506 referrer:referrer 502 referrer:referrer
507 transition:transition 503 transition:transition
508 initiationType:web::NavigationInitiationType::USER_INITIATED]); 504 initiationType:web::NavigationInitiationType::USER_INITIATED]);
509 505
510 web::NavigationItemImpl* pushedItem = [pushedEntry navigationItemImpl]; 506 web::NavigationItemImpl* pushedItem = [pushedEntry navigationItemImpl];
511 pushedItem->SetIsOverridingUserAgent(currentItem->IsOverridingUserAgent()); 507 pushedItem->SetIsOverridingUserAgent(visibleItem->IsOverridingUserAgent());
512 pushedItem->SetSerializedStateObject(stateObject); 508 pushedItem->SetSerializedStateObject(stateObject);
513 pushedItem->SetIsCreatedFromPushState(true); 509 pushedItem->SetIsCreatedFromPushState(true);
514 web::SSLStatus& sslStatus = [self currentEntry].navigationItem->GetSSL(); 510 web::SSLStatus& sslStatus = [self currentEntry].navigationItem->GetSSL();
515 pushedEntry.get().navigationItem->GetSSL() = sslStatus; 511 pushedEntry.get().navigationItem->GetSSL() = sslStatus;
516 512
517 [self clearForwardItems]; 513 [self clearForwardItems];
518 // Add the new entry at the end. 514 // Add the new entry at the end.
519 [_entries addObject:pushedEntry]; 515 [_entries addObject:pushedEntry];
520 _previousNavigationIndex = _currentNavigationIndex; 516 _previousNavigationIndex = _currentNavigationIndex;
521 self.currentNavigationIndex = [_entries count] - 1; 517 self.currentNavigationIndex = [_entries count] - 1;
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
725 } 721 }
726 722
727 - (web::NavigationItemList)itemListForEntryList:(NSArray*)entries { 723 - (web::NavigationItemList)itemListForEntryList:(NSArray*)entries {
728 web::NavigationItemList list(entries.count); 724 web::NavigationItemList list(entries.count);
729 for (size_t index = 0; index < entries.count; ++index) 725 for (size_t index = 0; index < entries.count; ++index)
730 list[index] = [entries[index] navigationItem]; 726 list[index] = [entries[index] navigationItem];
731 return list; 727 return list;
732 } 728 }
733 729
734 @end 730 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698