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

Unified Diff: chrome/browser/ui/browser_tabstrip.cc

Issue 1397673004: Make opening a new tab with the NTP use PAGE_TRANSITION_AUTO_TOPLEVEL. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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 | « chrome/browser/ui/browser_browsertest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/browser_tabstrip.cc
diff --git a/chrome/browser/ui/browser_tabstrip.cc b/chrome/browser/ui/browser_tabstrip.cc
index 995e0de1a4ecf609711db7b6108d8a513a4722cf..289f555686ddda70777e2f23c35a090f292d34b8 100644
--- a/chrome/browser/ui/browser_tabstrip.cc
+++ b/chrome/browser/ui/browser_tabstrip.cc
@@ -24,11 +24,17 @@ void AddTabAt(Browser* browser, const GURL& url, int idx, bool foreground) {
// WebContents, but we want to include the time it takes to create the
// WebContents object too.
base::TimeTicks new_tab_start_time = base::TimeTicks::Now();
+ bool show_ntp = url.is_empty();
chrome::NavigateParams params(browser,
- url.is_empty() ? GURL(chrome::kChromeUINewTabURL) : url,
- ui::PAGE_TRANSITION_TYPED);
+ show_ntp ? GURL(chrome::kChromeUINewTabURL) : url,
+ show_ntp ? ui::PAGE_TRANSITION_AUTO_TOPLEVEL : ui::PAGE_TRANSITION_TYPED);
params.disposition = foreground ? NEW_FOREGROUND_TAB : NEW_BACKGROUND_TAB;
params.tabstrip_index = idx;
+ // Explicitly ensure new tabs will return to the previous focused tabs when
msw 2016/02/02 01:57:46 nit: "Ensure the previously active tab regains foc
+ // closed.
+ if (show_ntp)
msw 2016/02/02 01:57:46 Why is this only applied if |show_ntp| is true? (d
+ params.tabstrip_add_types |= TabStripModel::ADD_INHERIT_GROUP;
+
chrome::Navigate(&params);
CoreTabHelper* core_tab_helper =
CoreTabHelper::FromWebContents(params.target_contents);
« no previous file with comments | « chrome/browser/ui/browser_browsertest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698