| 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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 @property(nonatomic, readwrite, assign) NSInteger currentNavigationIndex; | 68 @property(nonatomic, readwrite, assign) NSInteger currentNavigationIndex; |
| 69 | 69 |
| 70 // TODO(rohitrao): These properties must be redefined readwrite to work around a | 70 // TODO(rohitrao): These properties must be redefined readwrite to work around a |
| 71 // clang bug. crbug.com/228650 | 71 // clang bug. crbug.com/228650 |
| 72 @property(nonatomic, readwrite, strong) | 72 @property(nonatomic, readwrite, strong) |
| 73 CRWSessionCertificatePolicyManager* sessionCertificatePolicyManager; | 73 CRWSessionCertificatePolicyManager* sessionCertificatePolicyManager; |
| 74 | 74 |
| 75 // Expose setters for serialization properties. These are exposed in a category | 75 // Expose setters for serialization properties. These are exposed in a category |
| 76 // in SessionStorageBuilder, and will be removed as ownership of | 76 // in SessionStorageBuilder, and will be removed as ownership of |
| 77 // their backing ivars moves to NavigationManagerImpl. | 77 // their backing ivars moves to NavigationManagerImpl. |
| 78 @property(nonatomic, readwrite, getter=isOpenedByDOM) BOOL openedByDOM; | |
| 79 @property(nonatomic, readwrite, assign) NSInteger previousNavigationIndex; | 78 @property(nonatomic, readwrite, assign) NSInteger previousNavigationIndex; |
| 80 | 79 |
| 81 // Removes all items after currentNavigationIndex_. | 80 // Removes all items after currentNavigationIndex_. |
| 82 - (void)clearForwardItems; | 81 - (void)clearForwardItems; |
| 83 // Discards the transient item, if any. | 82 // Discards the transient item, if any. |
| 84 - (void)discardTransientItem; | 83 - (void)discardTransientItem; |
| 85 // Creates a NavigationItemImpl with the specified properties. | 84 // Creates a NavigationItemImpl with the specified properties. |
| 86 - (std::unique_ptr<web::NavigationItemImpl>) | 85 - (std::unique_ptr<web::NavigationItemImpl>) |
| 87 itemWithURL:(const GURL&)url | 86 itemWithURL:(const GURL&)url |
| 88 referrer:(const web::Referrer&)referrer | 87 referrer:(const web::Referrer&)referrer |
| 89 transition:(ui::PageTransition)transition | 88 transition:(ui::PageTransition)transition |
| 90 initiationType:(web::NavigationInitiationType)initiationType; | 89 initiationType:(web::NavigationInitiationType)initiationType; |
| 91 // Returns YES if the PageTransition for the underlying navigationItem at | 90 // Returns YES if the PageTransition for the underlying navigationItem at |
| 92 // |index| in |items| has ui::PAGE_TRANSITION_IS_REDIRECT_MASK. | 91 // |index| in |items| has ui::PAGE_TRANSITION_IS_REDIRECT_MASK. |
| 93 - (BOOL)isRedirectTransitionForItemAtIndex:(size_t)index; | 92 - (BOOL)isRedirectTransitionForItemAtIndex:(size_t)index; |
| 94 | 93 |
| 95 @end | 94 @end |
| 96 | 95 |
| 97 @implementation CRWSessionController | 96 @implementation CRWSessionController |
| 98 | 97 |
| 99 @synthesize currentNavigationIndex = _currentNavigationIndex; | 98 @synthesize currentNavigationIndex = _currentNavigationIndex; |
| 100 @synthesize previousNavigationIndex = _previousNavigationIndex; | 99 @synthesize previousNavigationIndex = _previousNavigationIndex; |
| 101 @synthesize pendingItemIndex = _pendingItemIndex; | 100 @synthesize pendingItemIndex = _pendingItemIndex; |
| 102 @synthesize openedByDOM = _openedByDOM; | |
| 103 @synthesize sessionCertificatePolicyManager = _sessionCertificatePolicyManager; | 101 @synthesize sessionCertificatePolicyManager = _sessionCertificatePolicyManager; |
| 104 | 102 |
| 105 - (instancetype)initWithBrowserState:(web::BrowserState*)browserState | 103 - (instancetype)initWithBrowserState:(web::BrowserState*)browserState { |
| 106 openedByDOM:(BOOL)openedByDOM { | |
| 107 self = [super init]; | 104 self = [super init]; |
| 108 if (self) { | 105 if (self) { |
| 109 _openedByDOM = openedByDOM; | |
| 110 _browserState = browserState; | 106 _browserState = browserState; |
| 111 _currentNavigationIndex = -1; | 107 _currentNavigationIndex = -1; |
| 112 _previousNavigationIndex = -1; | 108 _previousNavigationIndex = -1; |
| 113 _pendingItemIndex = -1; | 109 _pendingItemIndex = -1; |
| 114 _sessionCertificatePolicyManager = | 110 _sessionCertificatePolicyManager = |
| 115 [[CRWSessionCertificatePolicyManager alloc] init]; | 111 [[CRWSessionCertificatePolicyManager alloc] init]; |
| 116 } | 112 } |
| 117 return self; | 113 return self; |
| 118 } | 114 } |
| 119 | 115 |
| (...skipping 506 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 626 return item; | 622 return item; |
| 627 } | 623 } |
| 628 | 624 |
| 629 - (BOOL)isRedirectTransitionForItemAtIndex:(size_t)index { | 625 - (BOOL)isRedirectTransitionForItemAtIndex:(size_t)index { |
| 630 DCHECK_LT(index, self.items.size()); | 626 DCHECK_LT(index, self.items.size()); |
| 631 ui::PageTransition transition = self.items[index]->GetTransitionType(); | 627 ui::PageTransition transition = self.items[index]->GetTransitionType(); |
| 632 return (transition & ui::PAGE_TRANSITION_IS_REDIRECT_MASK) ? YES : NO; | 628 return (transition & ui::PAGE_TRANSITION_IS_REDIRECT_MASK) ? YES : NO; |
| 633 } | 629 } |
| 634 | 630 |
| 635 @end | 631 @end |
| OLD | NEW |