OLD | NEW |
1 // Copyright (c) 2010 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 #include "chrome/browser/pref_service.h" | 5 #include "chrome/browser/pref_service.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "app/l10n_util.h" | 10 #include "app/l10n_util.h" |
11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
12 #include "base/file_path.h" | 12 #include "base/file_path.h" |
| 13 #include "base/file_util.h" |
13 #include "base/histogram.h" | 14 #include "base/histogram.h" |
14 #include "base/logging.h" | 15 #include "base/logging.h" |
15 #include "base/message_loop.h" | 16 #include "base/message_loop.h" |
16 #include "base/stl_util-inl.h" | 17 #include "base/stl_util-inl.h" |
17 #include "base/string_number_conversions.h" | 18 #include "base/string_number_conversions.h" |
18 #include "base/string_util.h" | 19 #include "base/string_util.h" |
19 #include "base/sys_string_conversions.h" | 20 #include "base/sys_string_conversions.h" |
20 #include "base/utf_string_conversions.h" | 21 #include "base/utf_string_conversions.h" |
21 #include "build/build_config.h" | 22 #include "build/build_config.h" |
22 #include "chrome/browser/chrome_thread.h" | 23 #include "chrome/browser/chrome_thread.h" |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 Source<PrefService> source(pref); | 74 Source<PrefService> source(pref); |
74 NotificationService::current()->Notify(NotificationType::PROFILE_ERROR, | 75 NotificationService::current()->Notify(NotificationType::PROFILE_ERROR, |
75 source, Details<int>(&message_id)); | 76 source, Details<int>(&message_id)); |
76 } | 77 } |
77 | 78 |
78 } // namespace | 79 } // namespace |
79 | 80 |
80 // static | 81 // static |
81 PrefService* PrefService::CreatePrefService(const FilePath& pref_filename, | 82 PrefService* PrefService::CreatePrefService(const FilePath& pref_filename, |
82 Profile* profile) { | 83 Profile* profile) { |
| 84 #if defined(OS_LINUX) |
| 85 // We'd like to see what fraction of our users have the preferences |
| 86 // stored on a network file system, as we've had no end of troubles |
| 87 // with NFS/AFS. |
| 88 // TODO(evanm): remove this once we've collected state. |
| 89 file_util::FileSystemType fstype; |
| 90 if (file_util::GetFileSystemType(pref_filename.DirName(), &fstype)) { |
| 91 UMA_HISTOGRAM_ENUMERATION("PrefService.FileSystemType", |
| 92 static_cast<int>(fstype), |
| 93 file_util::FILE_SYSTEM_TYPE_COUNT); |
| 94 } |
| 95 #endif |
| 96 |
83 return new PrefService( | 97 return new PrefService( |
84 PrefValueStore::CreatePrefValueStore(pref_filename, profile, false)); | 98 PrefValueStore::CreatePrefValueStore(pref_filename, profile, false)); |
85 } | 99 } |
86 | 100 |
87 // static | 101 // static |
88 PrefService* PrefService::CreateUserPrefService(const FilePath& pref_filename) { | 102 PrefService* PrefService::CreateUserPrefService(const FilePath& pref_filename) { |
89 return new PrefService( | 103 return new PrefService( |
90 PrefValueStore::CreatePrefValueStore(pref_filename, NULL, true)); | 104 PrefValueStore::CreatePrefValueStore(pref_filename, NULL, true)); |
91 } | 105 } |
92 | 106 |
(...skipping 621 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
714 return pref_value_store_->PrefValueFromExtensionStore(name_.c_str()); | 728 return pref_value_store_->PrefValueFromExtensionStore(name_.c_str()); |
715 } | 729 } |
716 | 730 |
717 bool PrefService::Preference::IsUserControlled() const { | 731 bool PrefService::Preference::IsUserControlled() const { |
718 return pref_value_store_->PrefValueFromUserStore(name_.c_str()); | 732 return pref_value_store_->PrefValueFromUserStore(name_.c_str()); |
719 } | 733 } |
720 | 734 |
721 bool PrefService::Preference::IsUserModifiable() const { | 735 bool PrefService::Preference::IsUserModifiable() const { |
722 return pref_value_store_->PrefValueUserModifiable(name_.c_str()); | 736 return pref_value_store_->PrefValueUserModifiable(name_.c_str()); |
723 } | 737 } |
OLD | NEW |