Commit 5cf2911f authored by Gauthier Ambard's avatar Gauthier Ambard Committed by Commit Bot

Revert "Pass current tab as opener when opening new tab"

This reverts commit 6bdafce4.

Reason for revert: This CL is breaking the child ordering of tabs creating with Long Press on a link -> Open in a New Tab. They are now opened after the last page opened with ToolsMenu -> Open New Tab. See crbug.com/859508

Original change's description:
> Pass current tab as opener when opening new tab
>
> Pass the current tab as the opener when opening a new tab.
> This allow selection the previous current tab when the
> tab is closed via "pull-to-close" action or via the new
> "close" action in the UI refresh.
>
> The current tab is passed when tab is opened via ([*]
> denotes that this behaviour is added by this CL):
> - open tab in background
> - "New Tab" menu action [*]
> - captive portal detection [*]
> - search by image [*]
>
> Bug: 661988
> Cq-Include-Trybots: luci.chromium.try:ios-simulator-full-configs;master.tryserver.chromium.mac:ios-simulator-cronet;master.tryserver.chromium.mac:ios-simulator-full-configs
> Change-Id: Iecf41a8c0b3cfe465b3ff95a1061c97739b4ed79
> Reviewed-on: https://chromium-review.googlesource.com/1068680
> Reviewed-by: Eugene But <eugenebut@chromium.org>
> Reviewed-by: Mark Cogan <marq@chromium.org>
> Commit-Queue: Sylvain Defresne <sdefresne@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#561427}

TBR=marq@chromium.org,sdefresne@chromium.org,eugenebut@chromium.org

# Not skipping CQ checks because original CL landed > 1 day ago.

Bug: 661988, 859508
Change-Id: I14e6f2350bad216381224aaf3319018e1c1ffdf1
Cq-Include-Trybots: luci.chromium.try:ios-simulator-full-configs
Reviewed-on: https://chromium-review.googlesource.com/1124279Reviewed-by: default avatarSylvain Defresne <sdefresne@chromium.org>
Commit-Queue: Gauthier Ambard <gambard@chromium.org>
Cr-Commit-Position: refs/heads/master@{#572173}
parent 5e4aae83
......@@ -54,8 +54,7 @@ typedef Tab* (^mock_gurl_nsuinteger_pagetransition)(const GURL&,
- (Tab*)addSelectedTabWithURL:(const GURL&)url
atIndex:(NSUInteger)position
transition:(ui::PageTransition)transition
opener:(Tab*)parentTab {
transition:(ui::PageTransition)transition {
static_cast<mock_gurl_nsuinteger_pagetransition>(
[self blockForSelector:_cmd])(url, position, transition);
id mockTab = [OCMockObject mockForClass:[Tab class]];
......@@ -79,7 +78,6 @@ typedef Tab* (^mock_gurl_nsuinteger_pagetransition)(const GURL&,
- (Tab*)addSelectedTabWithURL:(const GURL&)url
atIndex:(NSUInteger)position
transition:(ui::PageTransition)transition
opener:(Tab*)parentTab
tabAddedCompletion:(ProceduralBlock)completion;
- (void)expectNewForegroundTab;
- (void)setActive:(BOOL)active;
......@@ -99,7 +97,6 @@ typedef Tab* (^mock_gurl_nsuinteger_pagetransition)(const GURL&,
- (Tab*)addSelectedTabWithURL:(const GURL&)url
atIndex:(NSUInteger)position
transition:(ui::PageTransition)transition
opener:(Tab*)parentTab
tabAddedCompletion:(ProceduralBlock)completion {
self.tabURL = url;
self.position = position;
......
......@@ -2193,7 +2193,6 @@ void MainControllerAuthenticationServiceDelegate::ClearBrowsingData(
return [targetBVC addSelectedTabWithURL:URL
atIndex:NSNotFound
transition:transition
opener:nil
tabAddedCompletion:tabOpenedCompletion];
}
......@@ -2290,7 +2289,6 @@ void MainControllerAuthenticationServiceDelegate::ClearBrowsingData(
tab = [targetBVC addSelectedTabWithURL:url
atIndex:tabIndex
transition:transition
opener:nil
tabAddedCompletion:tabOpenedCompletion];
} else {
// Voice search, QRScanner and the omnibox are presented by the BVC.
......
......@@ -113,16 +113,14 @@ applicationCommandEndpoint:(id<ApplicationCommands>)applicationCommandEndpoint
// Add a new tab with the given url, appends it to the end of the model,
// and makes it the selected tab. The selected tab is returned.
- (Tab*)addSelectedTabWithURL:(const GURL&)url
transition:(ui::PageTransition)transition
opener:(Tab*)parentTab;
transition:(ui::PageTransition)transition;
// Add a new tab with the given url, at the given |position|,
// and makes it the selected tab. The selected tab is returned.
// If |position| == NSNotFound the tab will be added at the end of the stack.
- (Tab*)addSelectedTabWithURL:(const GURL&)url
atIndex:(NSUInteger)position
transition:(ui::PageTransition)transition
opener:(Tab*)parentTab;
transition:(ui::PageTransition)transition;
// Add a new tab with the given url, at the given |position|,
// and makes it the selected tab. The selected tab is returned.
......@@ -131,7 +129,6 @@ applicationCommandEndpoint:(id<ApplicationCommands>)applicationCommandEndpoint
- (Tab*)addSelectedTabWithURL:(const GURL&)url
atIndex:(NSUInteger)position
transition:(ui::PageTransition)transition
opener:(Tab*)parentTab
tabAddedCompletion:(ProceduralBlock)tabAddedCompletion;
// Informs the BVC that a new foreground tab is about to be opened. This is
......
......@@ -848,8 +848,7 @@ NSString* const kBrowserViewControllerSnackbarCategory =
// the selected tab and return it.
- (Tab*)addSelectedTabWithURL:(const GURL&)url
postData:(TemplateURLRef::PostContent*)postData
transition:(ui::PageTransition)transition
opener:(Tab*)parentTab;
transition:(ui::PageTransition)transition;
// Internal method that all of the similar public and private methods call.
// Adds a new tab with |url| and |postData| (if not null) at |position| in the
// tab model (or at the end if |position is NSNotFound|, with |transition| as
......@@ -859,7 +858,6 @@ NSString* const kBrowserViewControllerSnackbarCategory =
postData:(TemplateURLRef::PostContent*)postData
atIndex:(NSUInteger)position
transition:(ui::PageTransition)transition
opener:(Tab*)parentTab
tabAddedCompletion:(ProceduralBlock)tabAddedCompletion;
// Whether the given tab's URL is an application specific URL.
- (BOOL)isTabNativePage:(Tab*)tab;
......@@ -1407,35 +1405,29 @@ applicationCommandEndpoint:(id<ApplicationCommands>)applicationCommandEndpoint {
}
- (Tab*)addSelectedTabWithURL:(const GURL&)url
transition:(ui::PageTransition)transition
opener:(Tab*)parentTab {
transition:(ui::PageTransition)transition {
return [self addSelectedTabWithURL:url
atIndex:[_model count]
transition:transition
opener:parentTab];
transition:transition];
}
- (Tab*)addSelectedTabWithURL:(const GURL&)url
atIndex:(NSUInteger)position
transition:(ui::PageTransition)transition
opener:(Tab*)parentTab {
transition:(ui::PageTransition)transition {
return [self addSelectedTabWithURL:url
atIndex:position
transition:transition
opener:parentTab
tabAddedCompletion:nil];
}
- (Tab*)addSelectedTabWithURL:(const GURL&)url
atIndex:(NSUInteger)position
transition:(ui::PageTransition)transition
opener:(Tab*)parentTab
tabAddedCompletion:(ProceduralBlock)tabAddedCompletion {
return [self addSelectedTabWithURL:url
postData:NULL
atIndex:position
transition:transition
opener:parentTab
tabAddedCompletion:tabAddedCompletion];
}
......@@ -2833,13 +2825,11 @@ applicationCommandEndpoint:(id<ApplicationCommands>)applicationCommandEndpoint {
- (Tab*)addSelectedTabWithURL:(const GURL&)url
postData:(TemplateURLRef::PostContent*)postData
transition:(ui::PageTransition)transition
opener:(Tab*)parentTab {
transition:(ui::PageTransition)transition {
return [self addSelectedTabWithURL:url
postData:postData
atIndex:[_model count]
transition:transition
opener:(Tab*)parentTab
tabAddedCompletion:nil];
}
......@@ -2847,7 +2837,6 @@ applicationCommandEndpoint:(id<ApplicationCommands>)applicationCommandEndpoint {
postData:(TemplateURLRef::PostContent*)postData
atIndex:(NSUInteger)position
transition:(ui::PageTransition)transition
opener:(Tab*)parentTab
tabAddedCompletion:(ProceduralBlock)tabAddedCompletion {
if (position == NSNotFound)
position = [_model count];
......@@ -2879,7 +2868,7 @@ applicationCommandEndpoint:(id<ApplicationCommands>)applicationCommandEndpoint {
}
Tab* tab = [_model insertTabWithLoadParams:params
opener:parentTab
opener:nil
openedByDOM:NO
atIndex:position
inBackground:NO];
......@@ -3670,8 +3659,7 @@ applicationCommandEndpoint:(id<ApplicationCommands>)applicationCommandEndpoint {
search_args, templateUrlService->search_terms_data(), &post_content));
[self addSelectedTabWithURL:result
postData:&post_content
transition:ui::PAGE_TRANSITION_TYPED
opener:[_model currentTab]];
transition:ui::PAGE_TRANSITION_TYPED];
}
// Saves the image at the given URL on the system's album. The referrer is used
......@@ -4666,8 +4654,7 @@ applicationCommandEndpoint:(id<ApplicationCommands>)applicationCommandEndpoint {
->UpdateSnapshot(/*with_overlays=*/true, /*visible_frame_only=*/true);
}
[self addSelectedTabWithURL:GURL(kChromeUINewTabURL)
transition:ui::PAGE_TRANSITION_TYPED
opener:currentTab];
transition:ui::PAGE_TRANSITION_TYPED];
}
- (void)printTab {
......@@ -5668,9 +5655,7 @@ nativeContentHeaderHeightForPreloadController:(PreloadController*)controller
- (void)captivePortalDetectorTabHelper:
(CaptivePortalDetectorTabHelper*)tabHelper
connectWithLandingURL:(const GURL&)landingURL {
[self addSelectedTabWithURL:landingURL
transition:ui::PAGE_TRANSITION_TYPED
opener:[_model currentTab]];
[self addSelectedTabWithURL:landingURL transition:ui::PAGE_TRANSITION_TYPED];
}
#pragma mark - PageInfoPresentation
......
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