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 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
234 // _browserState will be nullptr if CRWSessionController has been | 234 // _browserState will be nullptr if CRWSessionController has been |
235 // initialized with -initWithCoder: method. Take _browserState from | 235 // initialized with -initWithCoder: method. Take _browserState from |
236 // NavigationManagerImpl if that's the case. | 236 // NavigationManagerImpl if that's the case. |
237 if (!_browserState) { | 237 if (!_browserState) { |
238 _browserState = _navigationManager->GetBrowserState(); | 238 _browserState = _navigationManager->GetBrowserState(); |
239 } | 239 } |
240 DCHECK_EQ(_browserState, _navigationManager->GetBrowserState()); | 240 DCHECK_EQ(_browserState, _navigationManager->GetBrowserState()); |
241 } | 241 } |
242 } | 242 } |
243 | 243 |
| 244 - (void)setBrowserState:(web::BrowserState*)browserState { |
| 245 _browserState = browserState; |
| 246 DCHECK(!_navigationManager || |
| 247 _navigationManager->GetBrowserState() == _browserState); |
| 248 } |
| 249 |
244 - (NSString*)description { | 250 - (NSString*)description { |
245 return [NSString | 251 return [NSString |
246 stringWithFormat: | 252 stringWithFormat: |
247 @"id: %@\nname: %@\nlast visit: %f\ncurrent index: %" PRIdNS | 253 @"id: %@\nname: %@\nlast visit: %f\ncurrent index: %" PRIdNS |
248 @"\nprevious index: %" PRIdNS @"\npending index: %" PRIdNS | 254 @"\nprevious index: %" PRIdNS @"\npending index: %" PRIdNS |
249 @"\n%@\npending: %@\ntransient: %@\n", | 255 @"\n%@\npending: %@\ntransient: %@\n", |
250 _tabId, self.windowName, _lastVisitedTimestamp, | 256 _tabId, self.windowName, _lastVisitedTimestamp, |
251 _currentNavigationIndex, _previousNavigationIndex, _pendingEntryIndex, | 257 _currentNavigationIndex, _previousNavigationIndex, _pendingEntryIndex, |
252 _entries, _pendingEntry.get(), _transientEntry.get()]; | 258 _entries, _pendingEntry.get(), _transientEntry.get()]; |
253 } | 259 } |
(...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
685 return [[CRWSessionEntry alloc] initWithNavigationItem:std::move(item)]; | 691 return [[CRWSessionEntry alloc] initWithNavigationItem:std::move(item)]; |
686 } | 692 } |
687 | 693 |
688 - (BOOL)isRedirectTransitionForEntryAtIndex:(NSInteger)index { | 694 - (BOOL)isRedirectTransitionForEntryAtIndex:(NSInteger)index { |
689 ui::PageTransition transition = | 695 ui::PageTransition transition = |
690 [_entries[index] navigationItem]->GetTransitionType(); | 696 [_entries[index] navigationItem]->GetTransitionType(); |
691 return (transition & ui::PAGE_TRANSITION_IS_REDIRECT_MASK) ? YES : NO; | 697 return (transition & ui::PAGE_TRANSITION_IS_REDIRECT_MASK) ? YES : NO; |
692 } | 698 } |
693 | 699 |
694 @end | 700 @end |
OLD | NEW |