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

Unified Diff: chrome/browser/ui/app_list/search_answer_web_contents_delegate.cc

Issue 2842413002: Honoring requested link navigation disposition when clicking links in answer card. (Closed)
Patch Set: Created 3 years, 8 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/app_list/search_answer_web_contents_delegate.cc
diff --git a/chrome/browser/ui/app_list/search_answer_web_contents_delegate.cc b/chrome/browser/ui/app_list/search_answer_web_contents_delegate.cc
index 51d95105f580ffba6404399b8bc8256ab225e54f..08af8884a8f4d1fc49703d00bc974ef42845cb1d 100644
--- a/chrome/browser/ui/app_list/search_answer_web_contents_delegate.cc
+++ b/chrome/browser/ui/app_list/search_answer_web_contents_delegate.cc
@@ -100,12 +100,20 @@ content::WebContents* SearchAnswerWebContentsDelegate::OpenURLFromTab(
if (!params.user_gesture)
return WebContentsDelegate::OpenURLFromTab(source, params);
- // Open the user-clicked link in a new browser tab. This will automatically
- // close the app list.
+ // Open the user-clicked link in the browser taking into account the requested
+ // disposition.
chrome::NavigateParams new_tab_params(profile_, params.url,
params.transition);
- new_tab_params.disposition = WindowOpenDisposition::NEW_FOREGROUND_TAB;
- new_tab_params.window_action = chrome::NavigateParams::SHOW_WINDOW;
+
+ new_tab_params.disposition = params.disposition;
+
+ if (params.disposition == WindowOpenDisposition::NEW_BACKGROUND_TAB) {
+ // When the user asks to open a link as a background tab, we show an
+ // activated window with the new activated tab after the user closes the
+ // launcher. So it's "background" relative to the launcher itself.
+ new_tab_params.disposition = WindowOpenDisposition::NEW_FOREGROUND_TAB;
+ new_tab_params.window_action = chrome::NavigateParams::SHOW_WINDOW_INACTIVE;
+ }
chrome::Navigate(&new_tab_params);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698