OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 // | 4 // |
5 // This file contains functions processing master preference file used by | 5 // This file contains functions processing master preference file used by |
6 // setup and first run. | 6 // setup and first run. |
7 | 7 |
8 #ifndef CHROME_INSTALLER_UTIL_MASTER_PREFERENCES_H__ | 8 #ifndef CHROME_INSTALLER_UTIL_MASTER_PREFERENCES_H__ |
9 #define CHROME_INSTALLER_UTIL_MASTER_PREFERENCES_H__ | 9 #define CHROME_INSTALLER_UTIL_MASTER_PREFERENCES_H__ |
10 | 10 |
11 #include <string> | 11 #include <string> |
12 | 12 |
13 namespace installer_util { | 13 namespace installer_util { |
14 | 14 |
15 // This is the default name for the master preferences file used to pre-set | 15 // This is the default name for the master preferences file used to pre-set |
16 // values in the user profile at first run. | 16 // values in the user profile at first run. |
17 const wchar_t kDefaultMasterPrefs[] = L"master_preferences"; | 17 const wchar_t kDefaultMasterPrefs[] = L"master_preferences"; |
18 | 18 |
19 // These are the possible results of calling ParseDistributionPreferences. | 19 // These are the possible results of calling ParseDistributionPreferences. |
20 // Some of the results can be combined, so they are bit flags. | 20 // Some of the results can be combined, so they are bit flags. |
21 enum MasterPrefResult { | 21 enum MasterPrefResult { |
22 MASTER_PROFILE_NOT_FOUND = 0x1, | 22 MASTER_PROFILE_NOT_FOUND = 0x1, |
23 // A critical error processing the master profile. | 23 // A critical error processing the master profile. |
24 MASTER_PROFILE_ERROR = 0x1 << 1, | 24 MASTER_PROFILE_ERROR = 0x1 << 1, |
25 // Skip first run dialogs. | 25 // Skip first run dialogs. |
26 MASTER_PROFILE_NO_FIRST_RUN_UI = 0x1 << 2, | 26 MASTER_PROFILE_NO_FIRST_RUN_UI = 0x1 << 2, |
27 // Show welcome page. | 27 // Show welcome page. |
28 MASTER_PROFILE_SHOW_WELCOME = 0x1 << 3, | 28 MASTER_PROFILE_SHOW_WELCOME = 0x1 << 3, |
29 // Import search engine setting from the default browser. | 29 // Import search engine setting from the default browser. |
30 MASTER_PROFILE_IMPORT_SEARCH_ENGINE = 0x1 << 4, | 30 MASTER_PROFILE_IMPORT_SEARCH_ENGINE = 0x1 << 4, |
31 // Import history from the default browser. | 31 // Import history from the default browser. |
32 MASTER_PROFILE_IMPORT_HISTORY = 0x1 << 5, | 32 MASTER_PROFILE_IMPORT_HISTORY = 0x1 << 5, |
| 33 // Import bookmarks from the default browser. |
| 34 MASTER_PROFILE_IMPORT_BOOKMARKS = 0x1 << 6, |
| 35 // Register Chrome as default browser for the current user. This option is |
| 36 // different than MAKE_CHROME_DEFAULT as installer ignores this option and |
| 37 // Chrome on first run makes itself default. |
| 38 MASTER_PROFILE_MAKE_CHROME_DEFAULT_FOR_USER = 0x1 << 7, |
33 // The following boolean prefs have the same semantics as the corresponding | 39 // The following boolean prefs have the same semantics as the corresponding |
34 // setup command line switches. See chrome/installer/util/util_constants.cc | 40 // setup command line switches. See chrome/installer/util/util_constants.cc |
35 // for more info. | 41 // for more info. |
36 // Create Desktop and QuickLaunch shortcuts. | 42 // Create Desktop and QuickLaunch shortcuts. |
37 MASTER_PROFILE_CREATE_ALL_SHORTCUTS = 0x1 << 6, | 43 MASTER_PROFILE_CREATE_ALL_SHORTCUTS = 0x1 << 8, |
38 // Prevent installer from launching Chrome after a successful first install. | 44 // Prevent installer from launching Chrome after a successful first install. |
39 MASTER_PROFILE_DO_NOT_LAUNCH_CHROME = 0x1 << 7, | 45 MASTER_PROFILE_DO_NOT_LAUNCH_CHROME = 0x1 << 9, |
40 // Register Chrome as default browser on the system. | 46 // Register Chrome as default browser on the system. |
41 MASTER_PROFILE_MAKE_CHROME_DEFAULT = 0x1 << 8, | 47 MASTER_PROFILE_MAKE_CHROME_DEFAULT = 0x1 << 10, |
42 // Install Chrome to system wise location. | 48 // Install Chrome to system wise location. |
43 MASTER_PROFILE_SYSTEM_LEVEL = 0x1 << 9, | 49 MASTER_PROFILE_SYSTEM_LEVEL = 0x1 << 11, |
44 // Run installer in verbose mode. | 50 // Run installer in verbose mode. |
45 MASTER_PROFILE_VERBOSE_LOGGING = 0x1 << 10, | 51 MASTER_PROFILE_VERBOSE_LOGGING = 0x1 << 12, |
46 // Show the EULA and do not install if not accepted. | 52 // Show the EULA and do not install if not accepted. |
47 MASTER_PROFILE_REQUIRE_EULA = 0x1 << 11, | 53 MASTER_PROFILE_REQUIRE_EULA = 0x1 << 13, |
48 // Use an alternate description text for some shortcuts. | 54 // Use an alternate description text for some shortcuts. |
49 MASTER_PROFILE_ALT_SHORTCUT_TXT = 0x1 << 12 | 55 MASTER_PROFILE_ALT_SHORTCUT_TXT = 0x1 << 14 |
50 }; | 56 }; |
51 | 57 |
52 // The master preferences is a JSON file with the same entries as the | 58 // The master preferences is a JSON file with the same entries as the |
53 // 'Default\Preferences' file. This function parses the distribution | 59 // 'Default\Preferences' file. This function parses the distribution |
54 // section of the preferences file. | 60 // section of the preferences file. |
55 // | 61 // |
56 // A prototypical 'master_preferences' file looks like this: | 62 // A prototypical 'master_preferences' file looks like this: |
57 // | 63 // |
58 // { | 64 // { |
59 // "distribution": { | 65 // "distribution": { |
60 // "skip_first_run_ui": true, | 66 // "skip_first_run_ui": true, |
61 // "show_welcome_page": true, | 67 // "show_welcome_page": true, |
62 // "import_search_engine": true, | 68 // "import_search_engine": true, |
63 // "import_history": false, | 69 // "import_history": false, |
| 70 // "import_bookmarks": false, |
64 // "create_all_shortcuts": true, | 71 // "create_all_shortcuts": true, |
65 // "do_not_launch_chrome": false, | 72 // "do_not_launch_chrome": false, |
66 // "make_chrome_default": false, | 73 // "make_chrome_default": false, |
| 74 // "make_chrome_default_for_user": true, |
67 // "system_level": false, | 75 // "system_level": false, |
68 // "verbose_logging": true, | 76 // "verbose_logging": true, |
69 // "require_eula": true, | 77 // "require_eula": true, |
70 // "alternate_shortcut_text": false | 78 // "alternate_shortcut_text": false |
71 // }, | 79 // }, |
72 // "browser": { | 80 // "browser": { |
73 // "show_home_button": true | 81 // "show_home_button": true |
74 // }, | 82 // }, |
75 // "bookmark_bar": { | 83 // "bookmark_bar": { |
76 // "show_on_all_tabs": true | 84 // "show_on_all_tabs": true |
77 // }, | 85 // }, |
78 // "homepage": "http://example.org", | 86 // "homepage": "http://example.org", |
79 // "homepage_is_newtabpage": false | 87 // "homepage_is_newtabpage": false |
80 // } | 88 // } |
81 // | 89 // |
82 // A reserved "distribution" entry in the file is used to group related | 90 // A reserved "distribution" entry in the file is used to group related |
83 // installation properties. This entry will be ignored at other times. | 91 // installation properties. This entry will be ignored at other times. |
84 // This function parses the 'distribution' entry and returns a combination | 92 // This function parses the 'distribution' entry and returns a combination |
85 // of MasterPrefResult. | 93 // of MasterPrefResult. |
86 int ParseDistributionPreferences(const std::wstring& master_prefs_path); | 94 int ParseDistributionPreferences(const std::wstring& master_prefs_path); |
87 | 95 |
88 } | 96 } |
89 | 97 |
90 #endif // CHROME_INSTALLER_UTIL_MASTER_PREFERENCES_H__ | 98 #endif // CHROME_INSTALLER_UTIL_MASTER_PREFERENCES_H__ |
OLD | NEW |