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 #include "chrome/browser/protector/protected_prefs_watcher.h" | 5 #include "chrome/browser/protector/protected_prefs_watcher.h" |
6 | 6 |
7 #include "base/base64.h" | 7 #include "base/base64.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
10 #include "base/stringprintf.h" | 10 #include "base/stringprintf.h" |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
225 kProtectorHistogramPrefs, | 225 kProtectorHistogramPrefs, |
226 kProtectorErrorValueValidZero, | 226 kProtectorErrorValueValidZero, |
227 kProtectorErrorCount); | 227 kProtectorErrorCount); |
228 } else if (IsSignatureValid()) { | 228 } else if (IsSignatureValid()) { |
229 UMA_HISTOGRAM_ENUMERATION( | 229 UMA_HISTOGRAM_ENUMERATION( |
230 kProtectorHistogramPrefs, | 230 kProtectorHistogramPrefs, |
231 kProtectorErrorValueValid, | 231 kProtectorErrorValueValid, |
232 kProtectorErrorCount); | 232 kProtectorErrorCount); |
233 } else { | 233 } else { |
234 LOG(WARNING) << "Invalid backup signature"; | 234 LOG(WARNING) << "Invalid backup signature"; |
235 // Further changes to protected prefs will overwrite the signature. | |
236 is_backup_valid_ = false; | 235 is_backup_valid_ = false; |
| 236 // The whole backup has been compromised, overwrite it. |
| 237 InitBackup(); |
237 UMA_HISTOGRAM_ENUMERATION( | 238 UMA_HISTOGRAM_ENUMERATION( |
238 kProtectorHistogramPrefs, | 239 kProtectorHistogramPrefs, |
239 kProtectorErrorBackupInvalid, | 240 kProtectorErrorBackupInvalid, |
240 kProtectorErrorCount); | 241 kProtectorErrorCount); |
241 } | 242 } |
242 } | 243 } |
243 | 244 |
244 std::string ProtectedPrefsWatcher::GetSignatureData(PrefService* prefs) const { | 245 std::string ProtectedPrefsWatcher::GetSignatureData(PrefService* prefs) const { |
245 // std::stringstream data; | 246 // std::stringstream data; |
246 std::string data = base::StringPrintf( | 247 std::string data = base::StringPrintf( |
(...skipping 15 matching lines...) Expand all Loading... |
262 // a consistent (sorted) order. | 263 // a consistent (sorted) order. |
263 for (ExtensionPrefs::ExtensionIdSet::const_iterator it = | 264 for (ExtensionPrefs::ExtensionIdSet::const_iterator it = |
264 cached_extension_ids_.begin(); | 265 cached_extension_ids_.begin(); |
265 it != cached_extension_ids_.end(); ++it) { | 266 it != cached_extension_ids_.end(); ++it) { |
266 base::StringAppendF(&data, "|%s", it->c_str()); | 267 base::StringAppendF(&data, "|%s", it->c_str()); |
267 } | 268 } |
268 return data; | 269 return data; |
269 } | 270 } |
270 | 271 |
271 } // namespace protector | 272 } // namespace protector |
OLD | NEW |