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