diff options
author | cpu@google.com <cpu@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-09 00:27:42 +0000 |
---|---|---|
committer | cpu@google.com <cpu@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-09 00:27:42 +0000 |
commit | 1188a6c0b9025c6ccb9eff833599b951fc778a9a (patch) | |
tree | 708039afa2f370b36708d59437db2bb3c706bb36 /chrome/browser/browser_main.cc | |
parent | 93184db7daf6946d5b61263bc4d0eb7626d67988 (diff) | |
download | chromium_src-1188a6c0b9025c6ccb9eff833599b951fc778a9a.zip chromium_src-1188a6c0b9025c6ccb9eff833599b951fc778a9a.tar.gz chromium_src-1188a6c0b9025c6ccb9eff833599b951fc778a9a.tar.bz2 |
Add customized first run tabs
- More refactor of BrowserInit and LaunchWithProfile
- hardcoded magic names : new_tab_page and welcome_page
BUG=9706
TEST=see the bug for detailed instructions.
Review URL: http://codereview.chromium.org/115139
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@15701 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/browser_main.cc')
-rw-r--r-- | chrome/browser/browser_main.cc | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/chrome/browser/browser_main.cc b/chrome/browser/browser_main.cc index 28b8144..1bde447 100644 --- a/chrome/browser/browser_main.cc +++ b/chrome/browser/browser_main.cc @@ -187,6 +187,24 @@ void SIGCHLDHandler(int signal) { } #endif +#if defined(OS_WIN) +void AddFirstRunNewTabs(BrowserInit* browser_init, + const std::vector<std::wstring>& new_tabs) { + std::vector<std::wstring>::const_iterator it = new_tabs.begin(); + while (it != new_tabs.end()) { + GURL url(*it); + if (url.is_valid()) + browser_init->AddFirstRunTab(url); + ++it; + } +} +#else +// TODO(cpu): implement first run experience for other platforms. +void AddFirstRunNewTabs(BrowserInit* browser_init, + const std::vector<std::wstring>& new_tabs) { +} +#endif + } // namespace // Main routine for running as the Browser process. @@ -317,12 +335,19 @@ int BrowserMain(const MainFunctionParams& parameters) { ResourceBundle::GetSharedInstance().LoadThemeResources(); } + BrowserInit browser_init; + if (is_first_run) { // On first run, we need to process the master preferences before the // browser's profile_manager object is created, but after ResourceBundle // is initialized. + std::vector<std::wstring> first_run_tabs; first_run_ui_bypass = - !FirstRun::ProcessMasterPreferences(user_data_dir, FilePath(), NULL); + !FirstRun::ProcessMasterPreferences(user_data_dir, FilePath(), NULL, + &first_run_tabs); + // The master prefs might specify a set of urls to display. + if (first_run_tabs.size()) + AddFirstRunNewTabs(&browser_init, first_run_tabs); // If we are running in App mode, we do not want to show the importer // (first run) UI. @@ -445,7 +470,6 @@ int BrowserMain(const MainFunctionParams& parameters) { return ResultCodes::MACHINE_LEVEL_INSTALL_EXISTS; process_singleton.Create(); - BrowserInit browser_init; // Show the First Run UI if this is the first time Chrome has been run on // this computer, or we're being compelled to do so by a command line flag. |