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 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
306 // baseline on the success rate in addition to the error distribution. | 306 // baseline on the success rate in addition to the error distribution. |
307 UMA_HISTOGRAM_ENUMERATION("PrefService.ReadError", error, | 307 UMA_HISTOGRAM_ENUMERATION("PrefService.ReadError", error, |
308 PersistentPrefStore::PREF_READ_ERROR_MAX_ENUM); | 308 PersistentPrefStore::PREF_READ_ERROR_MAX_ENUM); |
309 | 309 |
310 if (error != PersistentPrefStore::PREF_READ_ERROR_NONE) { | 310 if (error != PersistentPrefStore::PREF_READ_ERROR_NONE) { |
311 #if !defined(OS_CHROMEOS) | 311 #if !defined(OS_CHROMEOS) |
312 // Failing to load prefs on startup is a bad thing(TM). See bug 38352 for | 312 // Failing to load prefs on startup is a bad thing(TM). See bug 38352 for |
313 // an example problem that this can cause. | 313 // an example problem that this can cause. |
314 // Do some diagnosis and try to avoid losing data. | 314 // Do some diagnosis and try to avoid losing data. |
315 int message_id = 0; | 315 int message_id = 0; |
316 if (error <= PersistentPrefStore::PREF_READ_ERROR_JSON_TYPE || | 316 if (error <= PersistentPrefStore::PREF_READ_ERROR_JSON_TYPE) { |
317 error == PersistentPrefStore::PREF_READ_ERROR_LEVELDB_CORRUPTION) { | |
318 message_id = IDS_PREFERENCES_CORRUPT_ERROR; | 317 message_id = IDS_PREFERENCES_CORRUPT_ERROR; |
319 } else if (error != PersistentPrefStore::PREF_READ_ERROR_NO_FILE) { | 318 } else if (error != PersistentPrefStore::PREF_READ_ERROR_NO_FILE) { |
320 message_id = IDS_PREFERENCES_UNREADABLE_ERROR; | 319 message_id = IDS_PREFERENCES_UNREADABLE_ERROR; |
321 } | 320 } |
322 | 321 |
323 if (message_id) { | 322 if (message_id) { |
324 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, | 323 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, |
325 base::Bind(&ShowProfileErrorDialog, | 324 base::Bind(&ShowProfileErrorDialog, |
326 PROFILE_ERROR_PREFERENCES, | 325 PROFILE_ERROR_PREFERENCES, |
327 message_id)); | 326 message_id)); |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
535 | 534 |
536 void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry) { | 535 void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry) { |
537 ProfilePrefStoreManager::RegisterProfilePrefs(registry); | 536 ProfilePrefStoreManager::RegisterProfilePrefs(registry); |
538 } | 537 } |
539 | 538 |
540 void RegisterPrefs(PrefRegistrySimple* registry) { | 539 void RegisterPrefs(PrefRegistrySimple* registry) { |
541 ProfilePrefStoreManager::RegisterPrefs(registry); | 540 ProfilePrefStoreManager::RegisterPrefs(registry); |
542 } | 541 } |
543 | 542 |
544 } // namespace chrome_prefs | 543 } // namespace chrome_prefs |
OLD | NEW |