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

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

Issue 8343052: Sync Promo: Tweak first tabs (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 2 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
« chrome/browser/ui/browser.cc ('K') | « chrome/browser/ui/browser.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_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);
+ }
+ }
}
}
« chrome/browser/ui/browser.cc ('K') | « chrome/browser/ui/browser.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698