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

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

Issue 2676063003: Set CRWSessionController's BrowserState when NavigationManger's is set. (Closed)
Patch Set: Created 3 years, 10 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 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
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
OLDNEW
« no previous file with comments | « ios/web/navigation/crw_session_controller.h ('k') | ios/web/navigation/navigation_manager_impl.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698