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

Unified Diff: chrome/browser/app_controller_mac.mm

Issue 240273002: Close the ntp during startup when opening a link on Mac. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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/app_controller_mac.mm
diff --git a/chrome/browser/app_controller_mac.mm b/chrome/browser/app_controller_mac.mm
index 6e113ada6a80c491aed16f40fff63b9d2fed0103..280bf33da19e0428b81e0c3f7926a105da543018 100644
--- a/chrome/browser/app_controller_mac.mm
+++ b/chrome/browser/app_controller_mac.mm
@@ -729,8 +729,22 @@ class AppControllerProfileObserver : public ProfileInfoCacheObserver {
// |BrowserMain()|, i.e., this list of startup URLs should be appended to the
// (probably-empty) list of URLs from the command line.
if (startupUrls_.size()) {
+ // The browser is already loaded at this point with the new tab page.
Alexei Svitkine (slow) 2014/04/16 14:35:30 Could you make a new method wrapping all of this l
+ int ntp_index;
Alexei Svitkine (slow) 2014/04/16 14:35:30 Nit: Init this to a dummy value.
+ Browser* browser = chrome::GetLastActiveBrowser();
+ if (browser) {
+ DCHECK(browser->tab_strip_model()->count() == 1);
Alexei Svitkine (slow) 2014/04/16 14:35:30 DCHECK_EQ? Also, are you sure this will always be
+ ntp_index = browser->tab_strip_model()->active_index();
+ }
+
[self openUrls:startupUrls_];
[self clearStartupUrls];
+
+ // Close the new tab page after opening urls to prevent from closing the
Alexei Svitkine (slow) 2014/04/16 14:35:30 Nit: Remove "from".
+ // browser window.
+ if (browser)
Alexei Svitkine (slow) 2014/04/16 14:35:30 Nit: add {}'s
+ browser->tab_strip_model()->CloseWebContentsAt(ntp_index,
+ TabStripModel::CLOSE_NONE);
}
PrefService* localState = g_browser_process->local_state();
« 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