Chromium Code Reviews| Index: chrome/browser/ui/browser_init.cc |
| diff --git a/chrome/browser/ui/browser_init.cc b/chrome/browser/ui/browser_init.cc |
| index 7e703efbe5a1a966b4d8408ebf55ea1b387e6733..a4cffc2982200bf766d9ba7aab2c634c47af3ca6 100644 |
| --- a/chrome/browser/ui/browser_init.cc |
| +++ b/chrome/browser/ui/browser_init.cc |
| @@ -1288,11 +1288,32 @@ void BrowserInit::LaunchWithProfile::AddStartupURLs( |
| } |
| } |
| - // If the sync promo page is going to be displayed then replace the first |
| - // startup URL with the sync promo page. |
| + // If the sync promo page is going to be displayed then insert it at the front |
| + // of the list. |
| if (SyncPromoUI::ShouldShowSyncPromoAtStartup(profile_, is_first_run_)) { |
| SyncPromoUI::DidShowSyncPromoAtStartup(profile_); |
| - (*startup_urls)[0] = SyncPromoUI::GetSyncPromoURL((*startup_urls)[0], true); |
| + GURL old_url = (*startup_urls)[0]; |
| + (*startup_urls)[0] = |
| + SyncPromoUI::GetSyncPromoURL(GURL(chrome::kChromeUINewTabURL), true); |
| + |
| + // An empty URL means to go to the home page. |
| + if (old_url.is_empty() && Browser::GetHomePageForProfile(profile_) == |
| + GURL(chrome::kChromeUINewTabURL)) { |
| + old_url = GURL(chrome::kChromeUINewTabURL); |
| + } |
| + |
| + // If the old URL is not the NTP then insert it right after the sync promo. |
| + if (old_url != GURL(chrome::kChromeUINewTabURL)) |
| + startup_urls->insert(startup_urls->begin() + 1, old_url); |
| + |
| + // If we have more than two startup tabs then skip the welcome page. |
| + if (startup_urls->size() > 2) { |
| + std::vector<GURL>::iterator it = std::find( |
| + startup_urls->begin(), startup_urls->end(), GetWelcomePageURL()); |
| + if (it != startup_urls->end()) { |
|
sky
2011/10/28 16:05:59
nit: no {}
sail
2011/10/28 17:50:57
Done.
|
| + startup_urls->erase(it); |
| + } |
| + } |
| } |
| } |