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

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

Issue 2711733007: Revert of (Set)IsOverridingUserAgent should be called on VisibleItem (Closed)
Patch Set: Created 3 years, 9 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
77 // The browser state associated with this CRWSessionController; 81 // The browser state associated with this CRWSessionController;
78 web::BrowserState* _browserState; // weak 82 web::BrowserState* _browserState; // weak
79 83
80 // Time smoother for navigation entry timestamps; see comment in 84 // Time smoother for navigation entry timestamps; see comment in
81 // navigation_controller_impl.h 85 // navigation_controller_impl.h
82 web::TimeSmoother _timeSmoother; 86 web::TimeSmoother _timeSmoother;
83 } 87 }
84 88
85 // Redefine as readwrite. 89 // Redefine as readwrite.
86 @property(nonatomic, readwrite, assign) NSInteger currentNavigationIndex; 90 @property(nonatomic, readwrite, assign) NSInteger currentNavigationIndex;
(...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after
485 DCHECK(navigationItem); 489 DCHECK(navigationItem);
486 navigationItem->SetTimestamp( 490 navigationItem->SetTimestamp(
487 _timeSmoother.GetSmoothedTime(base::Time::Now())); 491 _timeSmoother.GetSmoothedTime(base::Time::Now()));
488 } 492 }
489 493
490 - (void)pushNewItemWithURL:(const GURL&)URL 494 - (void)pushNewItemWithURL:(const GURL&)URL
491 stateObject:(NSString*)stateObject 495 stateObject:(NSString*)stateObject
492 transition:(ui::PageTransition)transition { 496 transition:(ui::PageTransition)transition {
493 DCHECK(![self pendingEntry]); 497 DCHECK(![self pendingEntry]);
494 DCHECK([self currentEntry]); 498 DCHECK([self currentEntry]);
499 web::NavigationItem* currentItem = [self currentEntry].navigationItem;
500 CHECK(web::history_state_util::IsHistoryStateChangeValid(
501 currentItem->GetURL(), URL));
502 web::Referrer referrer(currentItem->GetURL(), web::ReferrerPolicyDefault);
495 503
496 web::NavigationItem* lastCommittedItem =
497 self.lastCommittedEntry.navigationItem;
498 CHECK(web::history_state_util::IsHistoryStateChangeValid(
499 lastCommittedItem->GetURL(), URL));
500
501 web::Referrer referrer(lastCommittedItem->GetURL(),
502 web::ReferrerPolicyDefault);
503 base::scoped_nsobject<CRWSessionEntry> pushedEntry([self 504 base::scoped_nsobject<CRWSessionEntry> pushedEntry([self
504 sessionEntryWithURL:URL 505 sessionEntryWithURL:URL
505 referrer:referrer 506 referrer:referrer
506 transition:transition 507 transition:transition
507 initiationType:web::NavigationInitiationType::USER_INITIATED]); 508 initiationType:web::NavigationInitiationType::USER_INITIATED]);
508 509
509 web::NavigationItemImpl* pushedItem = [pushedEntry navigationItemImpl]; 510 web::NavigationItemImpl* pushedItem = [pushedEntry navigationItemImpl];
510 pushedItem->SetIsOverridingUserAgent( 511 pushedItem->SetIsOverridingUserAgent(currentItem->IsOverridingUserAgent());
511 lastCommittedItem->IsOverridingUserAgent());
512 pushedItem->SetSerializedStateObject(stateObject); 512 pushedItem->SetSerializedStateObject(stateObject);
513 pushedItem->SetIsCreatedFromPushState(true); 513 pushedItem->SetIsCreatedFromPushState(true);
514 pushedItem->GetSSL() = lastCommittedItem->GetSSL(); 514 web::SSLStatus& sslStatus = [self currentEntry].navigationItem->GetSSL();
515 pushedEntry.get().navigationItem->GetSSL() = sslStatus;
515 516
516 [self clearForwardItems]; 517 [self clearForwardItems];
517 // Add the new entry at the end. 518 // Add the new entry at the end.
518 [_entries addObject:pushedEntry]; 519 [_entries addObject:pushedEntry];
519 _previousNavigationIndex = _currentNavigationIndex; 520 _previousNavigationIndex = _currentNavigationIndex;
520 self.currentNavigationIndex = [_entries count] - 1; 521 self.currentNavigationIndex = [_entries count] - 1;
521 522
522 if (_navigationManager) 523 if (_navigationManager)
523 _navigationManager->OnNavigationItemCommitted(); 524 _navigationManager->OnNavigationItemCommitted();
524 } 525 }
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
724 } 725 }
725 726
726 - (web::NavigationItemList)itemListForEntryList:(NSArray*)entries { 727 - (web::NavigationItemList)itemListForEntryList:(NSArray*)entries {
727 web::NavigationItemList list(entries.count); 728 web::NavigationItemList list(entries.count);
728 for (size_t index = 0; index < entries.count; ++index) 729 for (size_t index = 0; index < entries.count; ++index)
729 list[index] = [entries[index] navigationItem]; 730 list[index] = [entries[index] navigationItem];
730 return list; 731 return list;
731 } 732 }
732 733
733 @end 734 @end
OLDNEW
« no previous file with comments | « ios/chrome/browser/ui/browser_view_controller.mm ('k') | ios/web/web_state/ui/crw_web_controller.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698