OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 std::string GetVariationsSeed() const; | 163 std::string GetVariationsSeed() const; |
164 | 164 |
165 // Returns the variations seed signature entry from the master prefs. | 165 // Returns the variations seed signature entry from the master prefs. |
166 std::string GetVariationsSeedSignature() const; | 166 std::string GetVariationsSeedSignature() const; |
167 | 167 |
168 // Returns true iff the master preferences were successfully read from a file. | 168 // Returns true iff the master preferences were successfully read from a file. |
169 bool read_from_file() const { | 169 bool read_from_file() const { |
170 return preferences_read_from_file_; | 170 return preferences_read_from_file_; |
171 } | 171 } |
172 | 172 |
173 bool install_chrome() const { | 173 bool install_chrome() const { return true; } |
174 return chrome_; | |
175 } | |
176 | 174 |
177 bool is_multi_install() const { | 175 bool is_multi_install() const { return false; } |
178 return multi_install_; | |
179 } | |
180 | 176 |
181 // Returns a reference to this MasterPreferences' root dictionary of values. | 177 // Returns a reference to this MasterPreferences' root dictionary of values. |
182 const base::DictionaryValue& master_dictionary() const { | 178 const base::DictionaryValue& master_dictionary() const { |
183 return *master_dictionary_.get(); | 179 return *master_dictionary_.get(); |
184 } | 180 } |
185 | 181 |
186 // Returns a static preference object that has been initialized with the | 182 // Returns a static preference object that has been initialized with the |
187 // CommandLine object for the current process. | 183 // CommandLine object for the current process. |
188 // NOTE: Must not be called before CommandLine::Init() is called! | 184 // NOTE: Must not be called before CommandLine::Init() is called! |
189 // OTHER NOTE: Not thread safe. | 185 // OTHER NOTE: Not thread safe. |
190 static const MasterPreferences& ForCurrentProcess(); | 186 static const MasterPreferences& ForCurrentProcess(); |
191 | 187 |
192 private: | 188 private: |
193 void InitializeFromCommandLine(const base::CommandLine& cmd_line); | 189 void InitializeFromCommandLine(const base::CommandLine& cmd_line); |
194 void InitializeFromFilePath(const base::FilePath& prefs_path); | 190 void InitializeFromFilePath(const base::FilePath& prefs_path); |
195 | 191 |
196 // Initializes the instance from a given JSON string, returning true if the | 192 // Initializes the instance from a given JSON string, returning true if the |
197 // string was successfully parsed. | 193 // string was successfully parsed. |
198 bool InitializeFromString(const std::string& json_data); | 194 bool InitializeFromString(const std::string& json_data); |
199 | 195 |
200 void InitializeProductFlags(); | |
201 | |
202 // Enforces legacy preferences that should no longer be used, but could be | 196 // Enforces legacy preferences that should no longer be used, but could be |
203 // found in older master_preferences files. | 197 // found in older master_preferences files. |
204 void EnforceLegacyPreferences(); | 198 void EnforceLegacyPreferences(); |
205 | 199 |
206 // Removes the specified string pref from the master preferences and returns | 200 // Removes the specified string pref from the master preferences and returns |
207 // its value. Should be used for master prefs that shouldn't be automatically | 201 // its value. Should be used for master prefs that shouldn't be automatically |
208 // copied over to profile preferences. | 202 // copied over to profile preferences. |
209 std::string ExtractPrefString(const std::string& name) const; | 203 std::string ExtractPrefString(const std::string& name) const; |
210 | 204 |
211 std::unique_ptr<base::DictionaryValue> master_dictionary_; | 205 std::unique_ptr<base::DictionaryValue> master_dictionary_; |
212 base::DictionaryValue* distribution_; | 206 base::DictionaryValue* distribution_ = nullptr; |
213 bool preferences_read_from_file_; | 207 bool preferences_read_from_file_ = false; |
214 bool chrome_; | |
215 bool multi_install_; | |
216 | 208 |
217 private: | 209 private: |
218 DISALLOW_COPY_AND_ASSIGN(MasterPreferences); | 210 DISALLOW_COPY_AND_ASSIGN(MasterPreferences); |
219 }; | 211 }; |
220 | 212 |
221 } // namespace installer | 213 } // namespace installer |
222 | 214 |
223 #endif // CHROME_INSTALLER_UTIL_MASTER_PREFERENCES_H_ | 215 #endif // CHROME_INSTALLER_UTIL_MASTER_PREFERENCES_H_ |
OLD | NEW |