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

Side by Side Diff: ios/chrome/browser/tabs/tab_model.mm

Issue 2718273003: Change return type of Tab -navigationManager. (Closed)
Patch Set: Created 3 years, 9 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/chrome/browser/tabs/tab_model.h" 5 #import "ios/chrome/browser/tabs/tab_model.h"
6 6
7 #include <cstdint> 7 #include <cstdint>
8 #include <utility> 8 #include <utility>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 722 matching lines...) Expand 10 before | Expand all | Expand 10 after
733 DCHECK([_tabRetainer containsObject:closedTab]); 733 DCHECK([_tabRetainer containsObject:closedTab]);
734 int closedTabIndex = _webStateList.GetIndexOfWebState(closedTab.webState); 734 int closedTabIndex = _webStateList.GetIndexOfWebState(closedTab.webState);
735 DCHECK_NE(closedTabIndex, WebStateList::kInvalidIndex); 735 DCHECK_NE(closedTabIndex, WebStateList::kInvalidIndex);
736 DCHECK_GE(closedTabIndex, 0); 736 DCHECK_GE(closedTabIndex, 0);
737 737
738 // Let the sessions::TabRestoreService know about that new tab. 738 // Let the sessions::TabRestoreService know about that new tab.
739 sessions::TabRestoreService* restoreService = 739 sessions::TabRestoreService* restoreService =
740 _browserState 740 _browserState
741 ? IOSChromeTabRestoreServiceFactory::GetForBrowserState(_browserState) 741 ? IOSChromeTabRestoreServiceFactory::GetForBrowserState(_browserState)
742 : nullptr; 742 : nullptr;
743 web::NavigationManagerImpl* navigationManager = [closedTab navigationManager]; 743 web::NavigationManager* navigationManager = [closedTab navigationManager];
744 DCHECK(navigationManager); 744 DCHECK(navigationManager);
745 int itemCount = navigationManager->GetItemCount(); 745 int itemCount = navigationManager->GetItemCount();
746 if (restoreService && (![self isNTPTab:closedTab] || itemCount > 1)) { 746 if (restoreService && (![self isNTPTab:closedTab] || itemCount > 1)) {
747 restoreService->CreateHistoricalTab( 747 restoreService->CreateHistoricalTab(
748 sessions::IOSLiveTab::GetForWebState(closedTab.webState), 748 sessions::IOSLiveTab::GetForWebState(closedTab.webState),
749 closedTabIndex); 749 closedTabIndex);
750 } 750 }
751 // This needs to be called before the tab is removed from the list. 751 // This needs to be called before the tab is removed from the list.
752 Tab* newSelection = 752 Tab* newSelection =
753 [_orderController determineNewSelectedTabFromRemovedTab:closedTab]; 753 [_orderController determineNewSelectedTabFromRemovedTab:closedTab];
(...skipping 26 matching lines...) Expand all
780 } 780 }
781 781
782 - (void)navigationCommittedInTab:(Tab*)tab { 782 - (void)navigationCommittedInTab:(Tab*)tab {
783 if (self.offTheRecord) 783 if (self.offTheRecord)
784 return; 784 return;
785 if (![tab navigationManager]) 785 if (![tab navigationManager])
786 return; 786 return;
787 787
788 // See if the navigation was within a page; if so ignore it. 788 // See if the navigation was within a page; if so ignore it.
789 web::NavigationItem* previousItem = 789 web::NavigationItem* previousItem =
790 [tab navigationManager]->GetPreviousItem(); 790 [tab navigationManagerImpl]->GetPreviousItem();
791 if (previousItem) { 791 if (previousItem) {
792 GURL previousURL = previousItem->GetURL(); 792 GURL previousURL = previousItem->GetURL();
793 GURL currentURL = [tab navigationManager]->GetVisibleItem()->GetURL(); 793 GURL currentURL = [tab navigationManager]->GetVisibleItem()->GetURL();
794 794
795 url::Replacements<char> replacements; 795 url::Replacements<char> replacements;
796 replacements.ClearRef(); 796 replacements.ClearRef();
797 if (previousURL.ReplaceComponents(replacements) == 797 if (previousURL.ReplaceComponents(replacements) ==
798 currentURL.ReplaceComponents(replacements)) { 798 currentURL.ReplaceComponents(replacements)) {
799 return; 799 return;
800 } 800 }
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
1060 web::NavigationManager::WebLoadParams params(URL); 1060 web::NavigationManager::WebLoadParams params(URL);
1061 params.referrer = referrer; 1061 params.referrer = referrer;
1062 params.transition_type = ui::PAGE_TRANSITION_TYPED; 1062 params.transition_type = ui::PAGE_TRANSITION_TYPED;
1063 [[tab webController] loadWithParams:params]; 1063 [[tab webController] loadWithParams:params];
1064 [tab webController].webUsageEnabled = webUsageEnabled_; 1064 [tab webController].webUsageEnabled = webUsageEnabled_;
1065 [self insertTab:tab atIndex:index opener:parentTab]; 1065 [self insertTab:tab atIndex:index opener:parentTab];
1066 return tab; 1066 return tab;
1067 } 1067 }
1068 1068
1069 @end 1069 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698