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 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
267 @"\nprevious index: %" PRIdNS | 267 @"\nprevious index: %" PRIdNS |
268 @"\npending" | 268 @"\npending" |
269 @" index: %" PRIdNS | 269 @" index: %" PRIdNS |
270 @"\n%@\npending: %@\ntransient: %@\n", | 270 @"\n%@\npending: %@\ntransient: %@\n", |
271 _currentNavigationIndex, | 271 _currentNavigationIndex, |
272 _previousNavigationIndex, _pendingItemIndex, | 272 _previousNavigationIndex, _pendingItemIndex, |
273 itemsDescription, pendingItemDescription, | 273 itemsDescription, pendingItemDescription, |
274 transientItemDescription]; | 274 transientItemDescription]; |
275 } | 275 } |
276 | 276 |
277 #pragma mark - NSCopying | |
278 | |
279 - (id)copyWithZone:(NSZone*)zone { | |
280 CRWSessionController* copy = [[[self class] alloc] init]; | |
281 copy->_openedByDOM = _openedByDOM; | |
282 copy->_currentNavigationIndex = _currentNavigationIndex; | |
283 copy->_previousNavigationIndex = _previousNavigationIndex; | |
284 copy->_pendingItemIndex = _pendingItemIndex; | |
285 copy->_sessionCertificatePolicyManager = | |
286 [_sessionCertificatePolicyManager copy]; | |
287 web::ScopedNavigationItemImplList itemCopies(self.items.size()); | |
288 for (size_t index = 0; index < self.items.size(); ++index) { | |
289 itemCopies[index] = | |
290 base::MakeUnique<web::NavigationItemImpl>(*self.items[index]); | |
291 } | |
292 std::swap(copy->_items, itemCopies); | |
293 return copy; | |
294 } | |
295 | |
296 #pragma mark - Public | 277 #pragma mark - Public |
297 | 278 |
298 - (void)setNavigationManager:(web::NavigationManagerImpl*)navigationManager { | 279 - (void)setNavigationManager:(web::NavigationManagerImpl*)navigationManager { |
299 _navigationManager = navigationManager; | 280 _navigationManager = navigationManager; |
300 if (_navigationManager) { | 281 if (_navigationManager) { |
301 // _browserState will be nullptr if CRWSessionController has been | 282 // _browserState will be nullptr if CRWSessionController has been |
302 // initialized with -initWithCoder: method. Take _browserState from | 283 // initialized with -initWithCoder: method. Take _browserState from |
303 // NavigationManagerImpl if that's the case. | 284 // NavigationManagerImpl if that's the case. |
304 if (!_browserState) { | 285 if (!_browserState) { |
305 _browserState = _navigationManager->GetBrowserState(); | 286 _browserState = _navigationManager->GetBrowserState(); |
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
644 return item; | 625 return item; |
645 } | 626 } |
646 | 627 |
647 - (BOOL)isRedirectTransitionForItemAtIndex:(size_t)index { | 628 - (BOOL)isRedirectTransitionForItemAtIndex:(size_t)index { |
648 DCHECK_LT(index, self.items.size()); | 629 DCHECK_LT(index, self.items.size()); |
649 ui::PageTransition transition = self.items[index]->GetTransitionType(); | 630 ui::PageTransition transition = self.items[index]->GetTransitionType(); |
650 return (transition & ui::PAGE_TRANSITION_IS_REDIRECT_MASK) ? YES : NO; | 631 return (transition & ui::PAGE_TRANSITION_IS_REDIRECT_MASK) ? YES : NO; |
651 } | 632 } |
652 | 633 |
653 @end | 634 @end |
OLD | NEW |