diff options
author | kuchhal@chromium.org <kuchhal@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-31 21:58:12 +0000 |
---|---|---|
committer | kuchhal@chromium.org <kuchhal@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-31 21:58:12 +0000 |
commit | d23c9b7b8ddf903fee60da371c902a3fec8f66e7 (patch) | |
tree | ebfe1a887d6e7195676f159ef4f2f0ce2077bc9d /chrome/browser | |
parent | cec4a2709d524929d1da9a0ad806644274e36b12 (diff) | |
download | chromium_src-d23c9b7b8ddf903fee60da371c902a3fec8f66e7.zip chromium_src-d23c9b7b8ddf903fee60da371c902a3fec8f66e7.tar.gz chromium_src-d23c9b7b8ddf903fee60da371c902a3fec8f66e7.tar.bz2 |
Refactoring of master preferences parsing before adding a new preference.
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@22198 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r-- | chrome/browser/browser_main.cc | 12 | ||||
-rw-r--r-- | chrome/browser/first_run.h | 4 | ||||
-rw-r--r-- | chrome/browser/first_run_win.cc | 48 |
3 files changed, 34 insertions, 30 deletions
diff --git a/chrome/browser/browser_main.cc b/chrome/browser/browser_main.cc index 302385d..e54471c 100644 --- a/chrome/browser/browser_main.cc +++ b/chrome/browser/browser_main.cc @@ -445,14 +445,16 @@ int BrowserMain(const MainFunctionParams& parameters) { BrowserInit browser_init; + int ping_delay = 0; 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, - &first_run_tabs); + first_run_ui_bypass = !FirstRun::ProcessMasterPreferences(user_data_dir, + FilePath(), + &first_run_tabs, + &ping_delay); // The master prefs might specify a set of urls to display. if (first_run_tabs.size()) AddFirstRunNewTabs(&browser_init, first_run_tabs); @@ -658,12 +660,10 @@ int BrowserMain(const MainFunctionParams& parameters) { win_util::ScopedCOMInitializer com_initializer; - int delay = 0; - installer_util::GetDistributionPingDelay(FilePath(), delay); // Init the RLZ library. This just binds the dll and schedules a task on the // file thread to be run sometime later. If this is the first run we record // the installation event. - RLZTracker::InitRlzDelayed(base::DIR_MODULE, is_first_run, delay); + RLZTracker::InitRlzDelayed(base::DIR_MODULE, is_first_run, ping_delay); #endif // Config the network module so it has access to resources. diff --git a/chrome/browser/first_run.h b/chrome/browser/first_run.h index 030c535..3bf1ce3 100644 --- a/chrome/browser/first_run.h +++ b/chrome/browser/first_run.h @@ -69,8 +69,8 @@ class FirstRun { // 'master_preferences' file. static bool ProcessMasterPreferences(const FilePath& user_data_dir, const FilePath& master_prefs_path, - int* preference_details, - std::vector<std::wstring>* new_tabs); + std::vector<std::wstring>* new_tabs, + int* ping_delay); // Sets the kShouldShowFirstRunBubble local state pref so that the browser // shows the bubble once the main message loop gets going. Returns false if diff --git a/chrome/browser/first_run_win.cc b/chrome/browser/first_run_win.cc index a00f456..f14a3ea 100644 --- a/chrome/browser/first_run_win.cc +++ b/chrome/browser/first_run_win.cc @@ -167,12 +167,9 @@ bool FirstRun::CreateChromeQuickLaunchShortcut() { bool FirstRun::ProcessMasterPreferences(const FilePath& user_data_dir, const FilePath& master_prefs_path, - int* preference_details, - std::vector<std::wstring>* new_tabs) { + std::vector<std::wstring>* new_tabs, + int* ping_delay) { DCHECK(!user_data_dir.empty()); - if (preference_details) - *preference_details = 0; - FilePath master_prefs = master_prefs_path; if (master_prefs.empty()) { // The default location of the master prefs is next to the chrome exe. @@ -182,18 +179,18 @@ bool FirstRun::ProcessMasterPreferences(const FilePath& user_data_dir, master_prefs = master_prefs.Append(installer_util::kDefaultMasterPrefs); } - int parse_result = installer_util::ParseDistributionPreferences( - master_prefs.ToWStringHack()); - if (preference_details) - *preference_details = parse_result; - - if (parse_result & installer_util::MASTER_PROFILE_ERROR) + scoped_ptr<DictionaryValue> prefs( + installer_util::ParseDistributionPreferences(master_prefs)); + if (!prefs.get()) return true; if (new_tabs) - *new_tabs = installer_util::ParseFirstRunTabs(master_prefs.ToWStringHack()); + *new_tabs = installer_util::ParseFirstRunTabs(prefs.get()); + if (ping_delay) + installer_util::GetDistributionPingDelay(prefs.get(), ping_delay); - if (parse_result & installer_util::MASTER_PROFILE_REQUIRE_EULA) { + if (installer_util::GetBooleanPreference(prefs.get(), + installer_util::master_preferences::kRequireEula)) { // Show the post-installation EULA. This is done by setup.exe and the // result determines if we continue or not. We wait here until the user // dismisses the dialog. @@ -219,7 +216,8 @@ bool FirstRun::ProcessMasterPreferences(const FilePath& user_data_dir, } } - if (parse_result & installer_util::MASTER_PROFILE_OEM_FIRST_RUN_BUBBLE) + if (installer_util::GetBooleanPreference(prefs.get(), + installer_util::master_preferences::kAltFirstRunBubble)) FirstRun::SetOEMFirstRunBubblePref(); FilePath user_prefs = GetDefaultPrefFilePath(true, user_data_dir); @@ -231,7 +229,8 @@ bool FirstRun::ProcessMasterPreferences(const FilePath& user_data_dir, if (!file_util::CopyFile(master_prefs, user_prefs)) return true; - if (!(parse_result & installer_util::MASTER_PROFILE_NO_FIRST_RUN_UI)) + if (!installer_util::GetBooleanPreference(prefs.get(), + installer_util::master_preferences::kDistroSkipFirstRunPref)) return true; // From here on we won't show first run so we need to do the work to set the @@ -244,17 +243,22 @@ bool FirstRun::ProcessMasterPreferences(const FilePath& user_data_dir, if (!FirstRun::CreateSentinel()) return false; - if (parse_result & installer_util::MASTER_PROFILE_SHOW_WELCOME) + if (installer_util::GetBooleanPreference(prefs.get(), + installer_util::master_preferences::kDistroShowWelcomePage)) FirstRun::SetShowWelcomePagePref(); int import_items = 0; - if (parse_result & installer_util::MASTER_PROFILE_IMPORT_SEARCH_ENGINE) + if (installer_util::GetBooleanPreference(prefs.get(), + installer_util::master_preferences::kDistroImportSearchPref)) import_items += SEARCH_ENGINES; - if (parse_result & installer_util::MASTER_PROFILE_IMPORT_HISTORY) + if (installer_util::GetBooleanPreference(prefs.get(), + installer_util::master_preferences::kDistroImportHistoryPref)) import_items += HISTORY; - if (parse_result & installer_util::MASTER_PROFILE_IMPORT_BOOKMARKS) + if (installer_util::GetBooleanPreference(prefs.get(), + installer_util::master_preferences::kDistroImportBookmarksPref)) import_items += FAVORITES; - if (parse_result & installer_util::MASTER_PROFILE_IMPORT_HOME_PAGE) + if (installer_util::GetBooleanPreference(prefs.get(), + installer_util::master_preferences::kDistroImportHomePagePref)) import_items += HOME_PAGE; if (import_items) { @@ -268,8 +272,8 @@ bool FirstRun::ProcessMasterPreferences(const FilePath& user_data_dir, } } - if (parse_result & - installer_util::MASTER_PROFILE_MAKE_CHROME_DEFAULT_FOR_USER) + if (installer_util::GetBooleanPreference(prefs.get(), + installer_util::master_preferences::kMakeChromeDefaultForUser)) ShellIntegration::SetAsDefaultBrowser(); return false; |