summaryrefslogtreecommitdiffstats
path: root/chrome/browser/ui/browser_init.cc
diff options
context:
space:
mode:
authorsail@chromium.org <sail@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-10-28 19:22:07 +0000
committersail@chromium.org <sail@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-10-28 19:22:07 +0000
commit671f9c69bd919fa9f67648b63a57c14c0a614819 (patch)
tree0cae1351653b76500a48cf2743dd7ceca5ebd551 /chrome/browser/ui/browser_init.cc
parent5cfa8647a81e13078563025c6ae9040faff02bed (diff)
downloadchromium_src-671f9c69bd919fa9f67648b63a57c14c0a614819.zip
chromium_src-671f9c69bd919fa9f67648b63a57c14c0a614819.tar.gz
chromium_src-671f9c69bd919fa9f67648b63a57c14c0a614819.tar.bz2
Sync Promo: Tweak first tabs
Some small tweaks which tabs we show during first launch: - Previously the sync promo was the first tab. Completing the promo would navigate to the original first startup URL. With this change completing the sync promo always navigates to the new tab page. - The original first startup URL is now the 2nd tab (and the original 2nd tab is now the 3rd, etc...). - If we have more than two tabs then we suppress the welcome page. BUG= TEST= Review URL: http://codereview.chromium.org/8343052 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@107770 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/ui/browser_init.cc')
-rw-r--r--chrome/browser/ui/browser_init.cc26
1 files changed, 23 insertions, 3 deletions
diff --git a/chrome/browser/ui/browser_init.cc b/chrome/browser/ui/browser_init.cc
index 9ca04f9a..7aad216 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);
+ }
}
}