Commit 3f9a5af5 authored by Mark Cogan's avatar Mark Cogan Committed by Commit Bot

[iOS] Factor out BVC's -tabLoadComplete: method.

-tabLoadComplete just tells the tab model to save asynchronously; this
CL just has call sites do that directly.

Change-Id: Ic7306d20505de61ca412f08794719fdd8c0057e6
Reviewed-on: https://chromium-review.googlesource.com/c/1323052
Commit-Queue: Mark Cogan <marq@chromium.org>
Reviewed-by: default avatarGauthier Ambard <gambard@chromium.org>
Cr-Commit-Position: refs/heads/master@{#606396}
parent 4768f623
......@@ -817,10 +817,6 @@ NSString* const kBrowserViewControllerSnackbarCategory =
// Tab creation and selection
// --------------------------
// Called when either a tab finishes loading or when a tab with finished content
// is added directly to the model via pre-rendering. The tab must be non-nil and
// must be a member of the tab model controlled by this BrowserViewController.
- (void)tabLoadComplete:(Tab*)tab;
// Adds a new tab with |url| and |postData| at the end of the model, and make it
// the selected tab and return it.
- (Tab*)addSelectedTabWithURL:(const GURL&)url
......@@ -2841,15 +2837,6 @@ applicationCommandEndpoint:(id<ApplicationCommands>)applicationCommandEndpoint {
#pragma mark - Private Methods: Tab creation and selection
// Called when either a tab finishes loading or when a tab with finished content
// is added directly to the model via pre-rendering.
- (void)tabLoadComplete:(Tab*)tab {
DCHECK(tab && ([_model indexOfTab:tab] != NSNotFound));
// Persist the session on a delay.
[_model saveSessionImmediately:NO];
}
- (Tab*)addSelectedTabWithURL:(const GURL&)url
postData:(TemplateURLRef::PostContent*)postData
transition:(ui::PageTransition)transition {
......@@ -4292,7 +4279,7 @@ applicationCommandEndpoint:(id<ApplicationCommands>)applicationCommandEndpoint {
->DidPromotePrerenderTab();
}
[self tabLoadComplete:newTab];
[self.tabModel saveSessionImmediately:NO];
return;
}
}
......@@ -4866,7 +4853,7 @@ applicationCommandEndpoint:(id<ApplicationCommands>)applicationCommandEndpoint {
- (void)tabModel:(TabModel*)model didFinishLoadingTab:(Tab*)tab {
[_toolbarUIUpdater updateState];
[self tabLoadComplete:tab];
[model saveSessionImmediately:NO];
if ([self canShowTabStrip]) {
UIUserInterfaceSizeClass sizeClass =
self.view.window.traitCollection.horizontalSizeClass;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment