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

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

Issue 2712743008: Remove -insertTabWithWebState:atIndex: from TabModel. (Closed)
Patch Set: Rebase. 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_model.h ('k') | ios/chrome/browser/tabs/tab_model_observers_bridge.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ios/chrome/browser/tabs/tab_model.mm
diff --git a/ios/chrome/browser/tabs/tab_model.mm b/ios/chrome/browser/tabs/tab_model.mm
index 0a4a9fdf5b0dbfd915085c012970856134f9335a..f6efb53da08b95a71a7871c8f48766f4188f681b 100644
--- a/ios/chrome/browser/tabs/tab_model.mm
+++ b/ios/chrome/browser/tabs/tab_model.mm
@@ -514,14 +514,21 @@ Tab* GetOpenerForTab(id<NSFastEnumeration> tabs, Tab* tab) {
inBackground:inBackground];
}
-- (Tab*)insertTabWithWebState:(std::unique_ptr<web::WebState>)webState
- atIndex:(NSUInteger)index {
+- (Tab*)insertTabWithNavigationItems:
+ (web::ScopedNavigationItemList)navigationItems
+ selectedNavigationIndex:(int)selectedNavigationIndex
+ atIndex:(NSUInteger)index
+ inBackground:(BOOL)inBackground {
DCHECK(_browserState);
- DCHECK_EQ(webState->GetBrowserState(), _browserState);
+ auto webState = base::MakeUnique<web::WebStateImpl>(_browserState);
+ webState->GetNavigationManagerImpl().ReplaceSessionHistory(
+ std::move(navigationItems), selectedNavigationIndex);
base::scoped_nsobject<Tab> tab(
[[Tab alloc] initWithWebState:std::move(webState) model:self]);
[tab webController].webUsageEnabled = webUsageEnabled_;
[self insertTab:tab atIndex:index];
+ if (!inBackground)
+ [self setCurrentTab:tab];
return tab;
}
@@ -872,7 +879,7 @@ Tab* GetOpenerForTab(id<NSFastEnumeration> tabs, Tab* tab) {
[tab webController].usePlaceholderOverlay = YES;
// Restore the CertificatePolicyCache (note that webState is invalid after
- // passing it via move semantic to -insertTabWithWebState:atIndex:).
+ // passing it via move semantic to -initWithWebState:model:).
UpdateCertificatePolicyCacheFromWebState(policyCache, [tab webState]);
[self insertTab:tab atIndex:self.count opener:nil];
[restoredTabs addObject:tab.get()];
« no previous file with comments | « ios/chrome/browser/tabs/tab_model.h ('k') | ios/chrome/browser/tabs/tab_model_observers_bridge.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698