Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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 Loading... | |
| 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 |
| 496 web::NavigationItem* lastCommittedItem = | |
| 497 [self lastCommittedEntry].navigationItem; | |
| 500 CHECK(web::history_state_util::IsHistoryStateChangeValid( | 498 CHECK(web::history_state_util::IsHistoryStateChangeValid( |
| 501 currentItem->GetURL(), URL)); | 499 lastCommittedItem->GetURL(), URL)); |
|
Eugene But (OOO till 7-30)
2017/02/23 18:00:12
web::NavigationItem* lastCommittedItem = self.last
liaoyuke
2017/02/23 18:37:11
Done.
| |
| 502 web::Referrer referrer(currentItem->GetURL(), web::ReferrerPolicyDefault); | |
| 503 | 500 |
| 501 web::Referrer referrer(lastCommittedItem->GetURL(), | |
| 502 web::ReferrerPolicyDefault); | |
| 504 base::scoped_nsobject<CRWSessionEntry> pushedEntry([self | 503 base::scoped_nsobject<CRWSessionEntry> pushedEntry([self |
| 505 sessionEntryWithURL:URL | 504 sessionEntryWithURL:URL |
| 506 referrer:referrer | 505 referrer:referrer |
| 507 transition:transition | 506 transition:transition |
| 508 initiationType:web::NavigationInitiationType::USER_INITIATED]); | 507 initiationType:web::NavigationInitiationType::USER_INITIATED]); |
| 509 | 508 |
| 510 web::NavigationItemImpl* pushedItem = [pushedEntry navigationItemImpl]; | 509 web::NavigationItemImpl* pushedItem = [pushedEntry navigationItemImpl]; |
| 511 pushedItem->SetIsOverridingUserAgent(currentItem->IsOverridingUserAgent()); | 510 pushedItem->SetIsOverridingUserAgent( |
| 511 lastCommittedItem->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 pushedItem->GetSSL() = lastCommittedItem->GetSSL(); |
| 515 pushedEntry.get().navigationItem->GetSSL() = sslStatus; | |
| 516 | 515 |
| 517 [self clearForwardItems]; | 516 [self clearForwardItems]; |
| 518 // Add the new entry at the end. | 517 // Add the new entry at the end. |
| 519 [_entries addObject:pushedEntry]; | 518 [_entries addObject:pushedEntry]; |
| 520 _previousNavigationIndex = _currentNavigationIndex; | 519 _previousNavigationIndex = _currentNavigationIndex; |
| 521 self.currentNavigationIndex = [_entries count] - 1; | 520 self.currentNavigationIndex = [_entries count] - 1; |
| 522 | 521 |
| 523 if (_navigationManager) | 522 if (_navigationManager) |
| 524 _navigationManager->OnNavigationItemCommitted(); | 523 _navigationManager->OnNavigationItemCommitted(); |
| 525 } | 524 } |
| (...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 725 } | 724 } |
| 726 | 725 |
| 727 - (web::NavigationItemList)itemListForEntryList:(NSArray*)entries { | 726 - (web::NavigationItemList)itemListForEntryList:(NSArray*)entries { |
| 728 web::NavigationItemList list(entries.count); | 727 web::NavigationItemList list(entries.count); |
| 729 for (size_t index = 0; index < entries.count; ++index) | 728 for (size_t index = 0; index < entries.count; ++index) |
| 730 list[index] = [entries[index] navigationItem]; | 729 list[index] = [entries[index] navigationItem]; |
| 731 return list; | 730 return list; |
| 732 } | 731 } |
| 733 | 732 |
| 734 @end | 733 @end |
| OLD | NEW |