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

Unified Diff: ios/chrome/browser/tabs/tab.mm

Issue 2718273003: Change return type of Tab -navigationManager. (Closed)
Patch Set: Fix BrowserViewControllerTest unit tests. 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ios/chrome/browser/tabs/tab.h ('k') | ios/chrome/browser/tabs/tab_model.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ios/chrome/browser/tabs/tab.mm
diff --git a/ios/chrome/browser/tabs/tab.mm b/ios/chrome/browser/tabs/tab.mm
index cbb5b929db6b79f71b55cd06c8d6b8ae95b76f53..bca7ffb2322290a0b6a81cf53a28835708c0c823 100644
--- a/ios/chrome/browser/tabs/tab.mm
+++ b/ios/chrome/browser/tabs/tab.mm
@@ -873,10 +873,12 @@ void TabInfoBarObserver::OnInfoBarReplaced(infobars::InfoBar* old_infobar,
return self.webController.viewForPrinting;
}
-- (NavigationManagerImpl*)navigationManager {
- if (!webStateImpl_)
- return nil;
- return &(webStateImpl_->GetNavigationManagerImpl());
+- (web::NavigationManager*)navigationManager {
+ return webStateImpl_ ? webStateImpl_->GetNavigationManager() : nullptr;
+}
+
+- (web::NavigationManagerImpl*)navigationManagerImpl {
+ return webStateImpl_ ? &(webStateImpl_->GetNavigationManagerImpl()) : nullptr;
}
- (id<StoreKitLauncher>)storeKitLauncher {
@@ -896,8 +898,8 @@ void TabInfoBarObserver::OnInfoBarReplaced(infobars::InfoBar* old_infobar,
currentIndex:(NSInteger)currentIndex {
std::vector<std::unique_ptr<web::NavigationItem>> items =
sessions::IOSSerializedNavigationBuilder::ToNavigationItems(navigations);
- [self navigationManager]->ReplaceSessionHistory(std::move(items),
- currentIndex);
+ [self navigationManagerImpl]->ReplaceSessionHistory(std::move(items),
+ currentIndex);
[self didReplaceSessionHistory];
[self.webController loadCurrentURL];
@@ -1274,7 +1276,7 @@ void TabInfoBarObserver::OnInfoBarReplaced(infobars::InfoBar* old_infobar,
- (web::NavigationItem*)currentNavigationItem {
if (![self navigationManager])
return nil;
- return [[self navigationManager]->GetSessionController() currentItem];
+ return [[self navigationManagerImpl]->GetSessionController() currentItem];
}
- (void)setShouldObserveInfoBarManager:(BOOL)shouldObserveInfoBarManager {
@@ -1325,7 +1327,7 @@ void TabInfoBarObserver::OnInfoBarReplaced(infobars::InfoBar* old_infobar,
if (self.navigationManager) {
CRWSessionController* sessionController =
- self.navigationManager->GetSessionController();
+ [self navigationManagerImpl]->GetSessionController();
NSInteger itemIndex = [sessionController indexOfItem:item];
DCHECK_NE(itemIndex, NSNotFound);
self.navigationManager->GoToIndex(itemIndex);
@@ -1375,7 +1377,7 @@ void TabInfoBarObserver::OnInfoBarReplaced(infobars::InfoBar* old_infobar,
// Clears pending navigation history after successfully launching the
// external app.
DCHECK([self navigationManager]);
- [[self navigationManager]->GetSessionController() discardNonCommittedItems];
+ [self navigationManager]->DiscardNonCommittedItems();
// Ensure the UI reflects the current entry, not the just-discarded pending
// entry.
[parentTabModel_ notifyTabChanged:self];
@@ -1601,7 +1603,7 @@ void TabInfoBarObserver::OnInfoBarReplaced(infobars::InfoBar* old_infobar,
ui::PageTransitionFromInt(ui::PAGE_TRANSITION_FORM_SUBMIT);
DCHECK([self navigationManager]);
CRWSessionController* sessionController =
- [self navigationManager]->GetSessionController();
+ [self navigationManagerImpl]->GetSessionController();
web::NavigationItem* lastUserItem = [sessionController lastUserItem];
if (!lastUserItem)
return;
@@ -1640,7 +1642,7 @@ void TabInfoBarObserver::OnInfoBarReplaced(infobars::InfoBar* old_infobar,
- (void)webPageOrderedClose {
// Only allow a web page to close itself if it was opened by DOM, or if there
// are no navigation items.
- DCHECK([[self navigationManager]->GetSessionController() isOpenedByDOM] ||
+ DCHECK([[self navigationManagerImpl]->GetSessionController() isOpenedByDOM] ||
![self navigationManager]->GetItemCount());
[self closeThisTab];
}
@@ -1875,15 +1877,15 @@ void TabInfoBarObserver::OnInfoBarReplaced(infobars::InfoBar* old_infobar,
- (double)lastVisitedTimestamp {
DCHECK([self navigationManager]);
- return
- [[self navigationManager]->GetSessionController() lastVisitedTimestamp];
+ return [[self navigationManagerImpl]->GetSessionController()
+ lastVisitedTimestamp];
}
- (void)updateLastVisitedTimestamp {
// Stores this information in self.history and it will be written into disc
// with other information when needed.
DCHECK([self navigationManager]);
- [[self navigationManager]->GetSessionController()
+ [[self navigationManagerImpl]->GetSessionController()
setLastVisitedTimestamp:[[NSDate date] timeIntervalSince1970]];
}
« no previous file with comments | « ios/chrome/browser/tabs/tab.h ('k') | ios/chrome/browser/tabs/tab_model.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698