From cac407bd57b7f7b3f9d85e1951a07d68f8400d0a Mon Sep 17 00:00:00 2001 From: "huanr@chromium.org" Date: Tue, 4 Nov 2008 22:23:17 +0000 Subject: Refactoring master preference parsing code into installer util so it can be shared by first run and set up. There is no functionality change in this CL. Review URL: http://codereview.chromium.org/9338 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@4688 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/browser/first_run.h | 50 +++++++++------------------------------------- 1 file changed, 9 insertions(+), 41 deletions(-) (limited to 'chrome/browser/first_run.h') diff --git a/chrome/browser/first_run.h b/chrome/browser/first_run.h index 85bac8d..4cdd2b6 100644 --- a/chrome/browser/first_run.h +++ b/chrome/browser/first_run.h @@ -45,55 +45,24 @@ class FirstRun { // a visible UI depending on the cmdline parameters. static int ImportNow(Profile* profile, const CommandLine& cmdline); - // These are the possible results of calling ProcessMasterPreferences. - // Some of the results can be combined, so they are bit flags. - enum MasterPrefResult { - MASTER_PROFILE_NOT_FOUND = 0, - MASTER_PROFILE_ERROR = 1, - MASTER_PROFILE_SHOW_EULA = 2, - MASTER_PROFILE_NO_FIRST_RUN_UI = 4, - MASTER_PROFILE_DO_FIRST_RUN_UI = 8 - }; - // The master preferences is a JSON file with the same entries as the // 'Default\Preferences' file. This function locates this file from // master_pref_path or if that path is empty from the default location // which is '\master_preferences', and process it // so it becomes the default preferences in profile pointed by user_data_dir. + // After processing the file, the function returns true if showing the + // first run dialog is needed, and returns false if skipping first run + // dialogs. The detailed settings in the preference file is reported via + // preference_details. // // This function destroys any existing prefs file and it is meant to be // invoked only on first run. // - // A prototypical 'master_preferences' file looks like this: - // - // { - // "distribution": { - // "skip_first_run_ui": true, - // "show_welcome_page": true, - // "import_search_engine": true, - // "import_history": false - // }, - // "browser": { - // "show_home_button": true - // }, - // "bookmark_bar": { - // "show_on_all_tabs": true - // }, - // "homepage": "http://example.org", - // "homepage_is_newtabpage": false - // } - // - // A reserved "distribution" entry in the file is used to group related - // installation properties. This entry will be ignored at other times. - // - // Currently only the following return values are used: - // MASTER_PROFILE_NOT_FOUND : Typical outcome for organic installs. - // MASTER_PROFILE_ERROR : A critical error processing the master profile. - // MASTER_PROFILE_NO_FIRST_RUN_UI : skip first run dialogs. - // MASTER_PROFILE_DO_FIRST_RUN_UI : show the first run dialogs. - static MasterPrefResult ProcessMasterPreferences( - const std::wstring& user_data_dir, - const std::wstring& master_prefs_path); + // See chrome/installer/util/master_preferences.h for a description of + // 'master_preferences' file. + static bool ProcessMasterPreferences(const std::wstring& user_data_dir, + const std::wstring& master_prefs_path, + int* preference_details); // Sets the kShouldShowFirstRunBubble local state pref so that the browser // shows the bubble once the main message loop gets going. Returns false if @@ -145,4 +114,3 @@ class FirstRunBrowserProcess : public BrowserProcessImpl { void OpenFirstRunDialog(Profile* profile); #endif // CHROME_BROWSER_FIRST_RUN_H_ - -- cgit v1.1