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/prefs/chrome_pref_service_factory.h" | 5 #include "chrome/browser/prefs/chrome_pref_service_factory.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
274 // baseline on the success rate in addition to the error distribution. | 274 // baseline on the success rate in addition to the error distribution. |
275 UMA_HISTOGRAM_ENUMERATION("PrefService.ReadError", error, | 275 UMA_HISTOGRAM_ENUMERATION("PrefService.ReadError", error, |
276 PersistentPrefStore::PREF_READ_ERROR_MAX_ENUM); | 276 PersistentPrefStore::PREF_READ_ERROR_MAX_ENUM); |
277 | 277 |
278 if (error != PersistentPrefStore::PREF_READ_ERROR_NONE) { | 278 if (error != PersistentPrefStore::PREF_READ_ERROR_NONE) { |
279 #if !defined(OS_CHROMEOS) | 279 #if !defined(OS_CHROMEOS) |
280 // Failing to load prefs on startup is a bad thing(TM). See bug 38352 for | 280 // Failing to load prefs on startup is a bad thing(TM). See bug 38352 for |
281 // an example problem that this can cause. | 281 // an example problem that this can cause. |
282 // Do some diagnosis and try to avoid losing data. | 282 // Do some diagnosis and try to avoid losing data. |
283 int message_id = 0; | 283 int message_id = 0; |
284 if (error <= PersistentPrefStore::PREF_READ_ERROR_JSON_TYPE) { | 284 if (error <= PersistentPrefStore::PREF_READ_ERROR_JSON_TYPE || |
| 285 error >= PersistentPrefStore::PREF_READ_ERROR_LEVELDB_CORRUPTION) { |
285 message_id = IDS_PREFERENCES_CORRUPT_ERROR; | 286 message_id = IDS_PREFERENCES_CORRUPT_ERROR; |
286 } else if (error != PersistentPrefStore::PREF_READ_ERROR_NO_FILE) { | 287 } else if (error != PersistentPrefStore::PREF_READ_ERROR_NO_FILE) { |
287 message_id = IDS_PREFERENCES_UNREADABLE_ERROR; | 288 message_id = IDS_PREFERENCES_UNREADABLE_ERROR; |
288 } | 289 } |
289 | 290 |
290 if (message_id) { | 291 if (message_id) { |
291 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, | 292 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, |
292 base::Bind(&ShowProfileErrorDialog, | 293 base::Bind(&ShowProfileErrorDialog, |
293 PROFILE_ERROR_PREFERENCES, | 294 PROFILE_ERROR_PREFERENCES, |
294 message_id)); | 295 message_id)); |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
495 | 496 |
496 void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry) { | 497 void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry) { |
497 ProfilePrefStoreManager::RegisterProfilePrefs(registry); | 498 ProfilePrefStoreManager::RegisterProfilePrefs(registry); |
498 } | 499 } |
499 | 500 |
500 void RegisterPrefs(PrefRegistrySimple* registry) { | 501 void RegisterPrefs(PrefRegistrySimple* registry) { |
501 ProfilePrefStoreManager::RegisterPrefs(registry); | 502 ProfilePrefStoreManager::RegisterPrefs(registry); |
502 } | 503 } |
503 | 504 |
504 } // namespace chrome_prefs | 505 } // namespace chrome_prefs |
OLD | NEW |