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(); |