| OLD | NEW |
| 1 // Copyright (c) 2009 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 "base/file_path.h" | 11 #include "base/file_path.h" |
| 12 #include "base/values.h" | 12 #include "base/values.h" |
| 13 | 13 |
| 14 namespace installer_util { | 14 namespace installer_util { |
| 15 | 15 |
| 16 namespace master_preferences { | 16 namespace master_preferences { |
| 17 // All the preferences below are expected to be inside the JSON "distribution" | 17 // All the preferences below are expected to be inside the JSON "distribution" |
| 18 // block. Some of them also have equivalent command line option. If same option | 18 // block. Some of them also have equivalent command line option. If same option |
| 19 // is specified in master preference as well as command line, the commnd line | 19 // is specified in master preference as well as command line, the commnd line |
| 20 // value takes precedence. | 20 // value takes precedence. |
| 21 | 21 |
| 22 // Boolean. Use alternate text for the shortcut. Cmd line override present. | 22 // Boolean. Use alternate text for the shortcut. Cmd line override present. |
| 23 extern const wchar_t kAltShortcutText[]; | 23 extern const wchar_t kAltShortcutText[]; |
| 24 // Boolean. Use alternate smaller first run info bubble. | 24 // Boolean. Use alternate smaller first run info bubble. |
| 25 extern const wchar_t kAltFirstRunBubble[]; | 25 extern const wchar_t kAltFirstRunBubble[]; |
| 26 // Integer. Icon index from chrome.exe to use for shortcuts. |
| 27 extern const wchar_t kChromeShortcutIconIndex[]; |
| 26 // Boolean. Create Desktop and QuickLaunch shortcuts. Cmd line override present. | 28 // Boolean. Create Desktop and QuickLaunch shortcuts. Cmd line override present. |
| 27 extern const wchar_t kCreateAllShortcuts[]; | 29 extern const wchar_t kCreateAllShortcuts[]; |
| 28 // Boolean pref that triggers silent import of the default browser bookmarks. | 30 // Boolean pref that triggers silent import of the default browser bookmarks. |
| 29 extern const wchar_t kDistroImportBookmarksPref[]; | 31 extern const wchar_t kDistroImportBookmarksPref[]; |
| 30 // Boolean pref that triggers silent import of the default browser history. | 32 // Boolean pref that triggers silent import of the default browser history. |
| 31 extern const wchar_t kDistroImportHistoryPref[]; | 33 extern const wchar_t kDistroImportHistoryPref[]; |
| 32 // Boolean pref that triggers silent import of the default browser homepage. | 34 // Boolean pref that triggers silent import of the default browser homepage. |
| 33 extern const wchar_t kDistroImportHomePagePref[]; | 35 extern const wchar_t kDistroImportHomePagePref[]; |
| 34 // Boolean pref that triggers silent import of the default search engine. | 36 // Boolean pref that triggers silent import of the default search engine. |
| 35 extern const wchar_t kDistroImportSearchPref[]; | 37 extern const wchar_t kDistroImportSearchPref[]; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 57 // values in the user profile at first run. | 59 // values in the user profile at first run. |
| 58 const wchar_t kDefaultMasterPrefs[] = L"master_preferences"; | 60 const wchar_t kDefaultMasterPrefs[] = L"master_preferences"; |
| 59 | 61 |
| 60 // Gets the value of given boolean preference |name| from |prefs| dictionary | 62 // Gets the value of given boolean preference |name| from |prefs| dictionary |
| 61 // which is assumed to contain a dictionary named "distribution". | 63 // which is assumed to contain a dictionary named "distribution". |
| 62 bool GetDistroBooleanPreference(const DictionaryValue* prefs, | 64 bool GetDistroBooleanPreference(const DictionaryValue* prefs, |
| 63 const std::wstring& name); | 65 const std::wstring& name); |
| 64 | 66 |
| 65 // This function gets ping delay (ping_delay in the sample above) from master | 67 // This function gets ping delay (ping_delay in the sample above) from master |
| 66 // preferences. | 68 // preferences. |
| 67 bool GetDistributionPingDelay(const DictionaryValue* prefs, | 69 bool GetDistroIntegerPreference(const DictionaryValue* prefs, |
| 68 int* ping_delay); | 70 const std::wstring& name, |
| 71 int* value); |
| 69 | 72 |
| 70 // The master preferences is a JSON file with the same entries as the | 73 // The master preferences is a JSON file with the same entries as the |
| 71 // 'Default\Preferences' file. This function parses the distribution | 74 // 'Default\Preferences' file. This function parses the distribution |
| 72 // section of the preferences file. | 75 // section of the preferences file. |
| 73 // | 76 // |
| 74 // A prototypical 'master_preferences' file looks like this: | 77 // A prototypical 'master_preferences' file looks like this: |
| 75 // | 78 // |
| 76 // { | 79 // { |
| 77 // "distribution": { | 80 // "distribution": { |
| 78 // "alternate_shortcut_text": false, | 81 // "alternate_shortcut_text": false, |
| 79 // "oem_bubble": false, | 82 // "oem_bubble": false, |
| 83 // "chrome_shortcut_icon_index": 0, |
| 80 // "create_all_shortcuts": true, | 84 // "create_all_shortcuts": true, |
| 81 // "import_bookmarks": false, | 85 // "import_bookmarks": false, |
| 82 // "import_history": false, | 86 // "import_history": false, |
| 83 // "import_home_page": false, | 87 // "import_home_page": false, |
| 84 // "import_search_engine": true, | 88 // "import_search_engine": true, |
| 85 // "ping_delay": 40, | 89 // "ping_delay": 40, |
| 86 // "show_welcome_page": true, | 90 // "show_welcome_page": true, |
| 87 // "skip_first_run_ui": true, | 91 // "skip_first_run_ui": true, |
| 88 // "do_not_launch_chrome": false, | 92 // "do_not_launch_chrome": false, |
| 89 // "make_chrome_default": false, | 93 // "make_chrome_default": false, |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 std::vector<std::wstring> GetFirstRunTabs(const DictionaryValue* prefs); | 134 std::vector<std::wstring> GetFirstRunTabs(const DictionaryValue* prefs); |
| 131 | 135 |
| 132 // Sets the value of given boolean preference |name| in "distribution" | 136 // Sets the value of given boolean preference |name| in "distribution" |
| 133 // dictionary inside |prefs| dictionary. | 137 // dictionary inside |prefs| dictionary. |
| 134 bool SetDistroBooleanPreference(DictionaryValue* prefs, | 138 bool SetDistroBooleanPreference(DictionaryValue* prefs, |
| 135 const std::wstring& name, | 139 const std::wstring& name, |
| 136 bool value); | 140 bool value); |
| 137 } | 141 } |
| 138 | 142 |
| 139 #endif // CHROME_INSTALLER_UTIL_MASTER_PREFERENCES_H_ | 143 #endif // CHROME_INSTALLER_UTIL_MASTER_PREFERENCES_H_ |
| OLD | NEW |