OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 #include <vector> | 12 #include <vector> |
13 | 13 |
| 14 #include "base/file_util.h" |
| 15 |
14 namespace installer_util { | 16 namespace installer_util { |
15 | 17 |
16 // This is the default name for the master preferences file used to pre-set | 18 // This is the default name for the master preferences file used to pre-set |
17 // values in the user profile at first run. | 19 // values in the user profile at first run. |
18 const wchar_t kDefaultMasterPrefs[] = L"master_preferences"; | 20 const wchar_t kDefaultMasterPrefs[] = L"master_preferences"; |
19 | 21 |
20 // These are the possible results of calling ParseDistributionPreferences. | 22 // These are the possible results of calling ParseDistributionPreferences. |
21 // Some of the results can be combined, so they are bit flags. | 23 // Some of the results can be combined, so they are bit flags. |
22 enum MasterPrefResult { | 24 enum MasterPrefResult { |
23 MASTER_PROFILE_NOT_FOUND = 0x1, | 25 MASTER_PROFILE_NOT_FOUND = 0x1, |
(...skipping 29 matching lines...) Expand all Loading... |
53 // Show the EULA and do not install if not accepted. | 55 // Show the EULA and do not install if not accepted. |
54 MASTER_PROFILE_REQUIRE_EULA = 0x1 << 13, | 56 MASTER_PROFILE_REQUIRE_EULA = 0x1 << 13, |
55 // Use an alternate description text for some shortcuts. | 57 // Use an alternate description text for some shortcuts. |
56 MASTER_PROFILE_ALT_SHORTCUT_TXT = 0x1 << 14, | 58 MASTER_PROFILE_ALT_SHORTCUT_TXT = 0x1 << 14, |
57 // Use a smaller OEM info bubble on first run. | 59 // Use a smaller OEM info bubble on first run. |
58 MASTER_PROFILE_OEM_FIRST_RUN_BUBBLE = 0x1 << 15, | 60 MASTER_PROFILE_OEM_FIRST_RUN_BUBBLE = 0x1 << 15, |
59 // Import home page from the default browser. | 61 // Import home page from the default browser. |
60 MASTER_PROFILE_IMPORT_HOME_PAGE = 0x1 << 16 | 62 MASTER_PROFILE_IMPORT_HOME_PAGE = 0x1 << 16 |
61 }; | 63 }; |
62 | 64 |
| 65 // This function gets ping delay (ping_delay in the sample above) from master |
| 66 // preferences. |
| 67 bool GetDistributionPingDelay(const FilePath& master_prefs_path, |
| 68 int& delay); |
| 69 |
63 // The master preferences is a JSON file with the same entries as the | 70 // The master preferences is a JSON file with the same entries as the |
64 // 'Default\Preferences' file. This function parses the distribution | 71 // 'Default\Preferences' file. This function parses the distribution |
65 // section of the preferences file. | 72 // section of the preferences file. |
66 // | 73 // |
67 // A prototypical 'master_preferences' file looks like this: | 74 // A prototypical 'master_preferences' file looks like this: |
68 // | 75 // |
69 // { | 76 // { |
70 // "distribution": { | 77 // "distribution": { |
71 // "skip_first_run_ui": true, | 78 // "skip_first_run_ui": true, |
72 // "show_welcome_page": true, | 79 // "show_welcome_page": true, |
73 // "import_search_engine": true, | 80 // "import_search_engine": true, |
74 // "import_history": false, | 81 // "import_history": false, |
75 // "import_bookmarks": false, | 82 // "import_bookmarks": false, |
76 // "import_home_page": false, | 83 // "import_home_page": false, |
77 // "create_all_shortcuts": true, | 84 // "create_all_shortcuts": true, |
78 // "do_not_launch_chrome": false, | 85 // "do_not_launch_chrome": false, |
79 // "make_chrome_default": false, | 86 // "make_chrome_default": false, |
80 // "make_chrome_default_for_user": true, | 87 // "make_chrome_default_for_user": true, |
81 // "system_level": false, | 88 // "system_level": false, |
82 // "verbose_logging": true, | 89 // "verbose_logging": true, |
83 // "require_eula": true, | 90 // "require_eula": true, |
84 // "alternate_shortcut_text": false | 91 // "alternate_shortcut_text": false, |
| 92 // "ping_delay": 40 |
85 // }, | 93 // }, |
86 // "browser": { | 94 // "browser": { |
87 // "show_home_button": true | 95 // "show_home_button": true |
88 // }, | 96 // }, |
89 // "bookmark_bar": { | 97 // "bookmark_bar": { |
90 // "show_on_all_tabs": true | 98 // "show_on_all_tabs": true |
91 // }, | 99 // }, |
92 // "first_run_tabs": [ | 100 // "first_run_tabs": [ |
93 // "http://gmail.com", | 101 // "http://gmail.com", |
94 // "https://igoogle.com" | 102 // "https://igoogle.com" |
(...skipping 17 matching lines...) Expand all Loading... |
112 // "https://google.com/f2" | 120 // "https://google.com/f2" |
113 // ] | 121 // ] |
114 // } | 122 // } |
115 // | 123 // |
116 // Note that the entries are usually urls but they don't have to. | 124 // Note that the entries are usually urls but they don't have to. |
117 // | 125 // |
118 // This function retuns the list as a vector of strings. If the master | 126 // This function retuns the list as a vector of strings. If the master |
119 // preferences file does not contain such list the vector is empty. | 127 // preferences file does not contain such list the vector is empty. |
120 std::vector<std::wstring> ParseFirstRunTabs( | 128 std::vector<std::wstring> ParseFirstRunTabs( |
121 const std::wstring& master_prefs_path); | 129 const std::wstring& master_prefs_path); |
122 | |
123 } | 130 } |
124 | 131 |
125 #endif // CHROME_INSTALLER_UTIL_MASTER_PREFERENCES_H__ | 132 #endif // CHROME_INSTALLER_UTIL_MASTER_PREFERENCES_H_ |
OLD | NEW |