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

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: diff against correct branch 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
« no previous file with comments | « chrome/browser/ui/browser_browsertest.cc ('k') | chrome/browser/ui/browser_navigator.cc » ('j') | 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..883fb7df87668ed4d0d3979a11857e57a88f2a71 100644
--- a/chrome/browser/ui/browser_init.cc
+++ b/chrome/browser/ui/browser_init.cc
@@ -1288,11 +1288,31 @@ 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() &&
+ profile_->GetHomePage() == 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())
+ startup_urls->erase(it);
+ }
}
}
« no previous file with comments | « chrome/browser/ui/browser_browsertest.cc ('k') | chrome/browser/ui/browser_navigator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698