OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #pragma once | 10 #pragma once |
11 | 11 |
(...skipping 13 matching lines...) Expand all Loading... |
25 | 25 |
26 // Parse command line and read master preferences, if present, to get | 26 // Parse command line and read master preferences, if present, to get |
27 // distribution related install options. Merge them if any command line | 27 // distribution related install options. Merge them if any command line |
28 // options present (command line value takes precedence). | 28 // options present (command line value takes precedence). |
29 DictionaryValue* GetInstallPreferences(const CommandLine& cmd_line); | 29 DictionaryValue* GetInstallPreferences(const CommandLine& cmd_line); |
30 | 30 |
31 // Gets the value of given boolean preference |name| from |prefs| dictionary | 31 // Gets the value of given boolean preference |name| from |prefs| dictionary |
32 // which is assumed to contain a dictionary named "distribution". Returns | 32 // which is assumed to contain a dictionary named "distribution". Returns |
33 // true if the value is read successfully, otherwise false. | 33 // true if the value is read successfully, otherwise false. |
34 bool GetDistroBooleanPreference(const DictionaryValue* prefs, | 34 bool GetDistroBooleanPreference(const DictionaryValue* prefs, |
35 const std::wstring& name, | 35 const std::string& name, |
36 bool* value); | 36 bool* value); |
37 | 37 |
38 // This function gets value of a string preference from master | 38 // This function gets value of a string preference from master |
39 // preferences. Returns true if the value is read successfully, otherwise false. | 39 // preferences. Returns true if the value is read successfully, otherwise false. |
40 bool GetDistroStringPreference(const DictionaryValue* prefs, | 40 bool GetDistroStringPreference(const DictionaryValue* prefs, |
41 const std::wstring& name, | 41 const std::string& name, |
42 std::wstring* value); | 42 std::string* value); |
43 | 43 |
44 // This function gets value of an integer preference from master | 44 // This function gets value of an integer preference from master |
45 // preferences. Returns true if the value is read successfully, otherwise false. | 45 // preferences. Returns true if the value is read successfully, otherwise false. |
46 bool GetDistroIntegerPreference(const DictionaryValue* prefs, | 46 bool GetDistroIntegerPreference(const DictionaryValue* prefs, |
47 const std::wstring& name, | 47 const std::string& name, |
48 int* value); | 48 int* value); |
49 | 49 |
50 // The master preferences is a JSON file with the same entries as the | 50 // The master preferences is a JSON file with the same entries as the |
51 // 'Default\Preferences' file. This function parses the distribution | 51 // 'Default\Preferences' file. This function parses the distribution |
52 // section of the preferences file. | 52 // section of the preferences file. |
53 // | 53 // |
54 // A prototypical 'master_preferences' file looks like this: | 54 // A prototypical 'master_preferences' file looks like this: |
55 // | 55 // |
56 // { | 56 // { |
57 // "distribution": { | 57 // "distribution": { |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 // | 107 // |
108 // Note that the entries are usually urls but they don't have to. | 108 // Note that the entries are usually urls but they don't have to. |
109 // | 109 // |
110 // This function retuns the list as a vector of GURLs. If the master | 110 // This function retuns the list as a vector of GURLs. If the master |
111 // preferences file does not contain such list the vector is empty. | 111 // preferences file does not contain such list the vector is empty. |
112 std::vector<GURL> GetFirstRunTabs(const DictionaryValue* prefs); | 112 std::vector<GURL> GetFirstRunTabs(const DictionaryValue* prefs); |
113 | 113 |
114 // Sets the value of given boolean preference |name| in "distribution" | 114 // Sets the value of given boolean preference |name| in "distribution" |
115 // dictionary inside |prefs| dictionary. | 115 // dictionary inside |prefs| dictionary. |
116 bool SetDistroBooleanPreference(DictionaryValue* prefs, | 116 bool SetDistroBooleanPreference(DictionaryValue* prefs, |
117 const std::wstring& name, | 117 const std::string& name, |
118 bool value); | 118 bool value); |
119 | 119 |
120 // The master preferences can also contain a regular extensions | 120 // The master preferences can also contain a regular extensions |
121 // preference block. If so, the extensions referenced there will be | 121 // preference block. If so, the extensions referenced there will be |
122 // installed during the first run experience. | 122 // installed during the first run experience. |
123 // An extension can go in the master prefs needs just the basic | 123 // An extension can go in the master prefs needs just the basic |
124 // elements such as: | 124 // elements such as: |
125 // 1- An extension entry under settings, assigned by the gallery | 125 // 1- An extension entry under settings, assigned by the gallery |
126 // 2- The "location" : 1 entry | 126 // 2- The "location" : 1 entry |
127 // 3- A minimal "manifest" block with key, name, permissions, update url | 127 // 3- A minimal "manifest" block with key, name, permissions, update url |
(...skipping 23 matching lines...) Expand all Loading... |
151 // } | 151 // } |
152 // } | 152 // } |
153 // } | 153 // } |
154 // | 154 // |
155 bool HasExtensionsBlock(const DictionaryValue* prefs, | 155 bool HasExtensionsBlock(const DictionaryValue* prefs, |
156 DictionaryValue** extensions); | 156 DictionaryValue** extensions); |
157 | 157 |
158 } // namespace installer_util | 158 } // namespace installer_util |
159 | 159 |
160 #endif // CHROME_INSTALLER_UTIL_MASTER_PREFERENCES_H_ | 160 #endif // CHROME_INSTALLER_UTIL_MASTER_PREFERENCES_H_ |
OLD | NEW |