OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/pref_service.h" | 5 #include "chrome/browser/prefs/pref_service.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
11 #include "base/file_path.h" | 11 #include "base/file_path.h" |
12 #include "base/file_util.h" | 12 #include "base/file_util.h" |
13 #include "base/logging.h" | 13 #include "base/logging.h" |
14 #include "base/message_loop.h" | 14 #include "base/message_loop.h" |
15 #include "base/metrics/histogram.h" | 15 #include "base/metrics/histogram.h" |
16 #include "base/stl_util-inl.h" | 16 #include "base/stl_util-inl.h" |
17 #include "base/string_number_conversions.h" | 17 #include "base/string_number_conversions.h" |
18 #include "base/string_util.h" | 18 #include "base/string_util.h" |
19 #include "base/value_conversions.h" | 19 #include "base/value_conversions.h" |
20 #include "build/build_config.h" | 20 #include "build/build_config.h" |
21 #include "chrome/browser/browser_process.h" | 21 #include "chrome/browser/browser_process.h" |
22 #include "chrome/browser/extensions/extension_pref_store.h" | 22 #include "chrome/browser/extensions/extension_pref_store.h" |
23 #include "chrome/browser/policy/configuration_policy_pref_store.h" | 23 #include "chrome/browser/policy/configuration_policy_pref_store.h" |
24 #include "chrome/browser/prefs/command_line_pref_store.h" | 24 #include "chrome/browser/prefs/command_line_pref_store.h" |
25 #include "chrome/browser/prefs/default_pref_store.h" | 25 #include "chrome/browser/prefs/default_pref_store.h" |
26 #include "chrome/browser/prefs/overlay_persistent_pref_store.h" | 26 #include "chrome/browser/prefs/incognito_user_pref_store.h" |
27 #include "chrome/browser/prefs/pref_model_associator.h" | 27 #include "chrome/browser/prefs/pref_model_associator.h" |
28 #include "chrome/browser/prefs/pref_notifier_impl.h" | 28 #include "chrome/browser/prefs/pref_notifier_impl.h" |
29 #include "chrome/browser/prefs/pref_value_store.h" | 29 #include "chrome/browser/prefs/pref_value_store.h" |
30 #include "chrome/browser/ui/profile_error_dialog.h" | 30 #include "chrome/browser/ui/profile_error_dialog.h" |
31 #include "chrome/common/json_pref_store.h" | 31 #include "chrome/common/json_pref_store.h" |
32 #include "content/browser/browser_thread.h" | 32 #include "content/browser/browser_thread.h" |
33 #include "content/common/notification_service.h" | 33 #include "content/common/notification_service.h" |
34 #include "grit/chromium_strings.h" | 34 #include "grit/chromium_strings.h" |
35 #include "grit/generated_resources.h" | 35 #include "grit/generated_resources.h" |
36 #include "ui/base/l10n/l10n_util.h" | 36 #include "ui/base/l10n/l10n_util.h" |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 recommended_cloud_prefs, | 177 recommended_cloud_prefs, |
178 default_store, | 178 default_store, |
179 pref_sync_associator_.get(), | 179 pref_sync_associator_.get(), |
180 pref_notifier_.get())); | 180 pref_notifier_.get())); |
181 InitFromStorage(async); | 181 InitFromStorage(async); |
182 } | 182 } |
183 | 183 |
184 PrefService::PrefService(const PrefService& original, | 184 PrefService::PrefService(const PrefService& original, |
185 PrefStore* incognito_extension_prefs) | 185 PrefStore* incognito_extension_prefs) |
186 : user_pref_store_( | 186 : user_pref_store_( |
187 new OverlayPersistentPrefStore(original.user_pref_store_.get())), | 187 new IncognitoUserPrefStore(original.user_pref_store_.get())), |
188 default_store_(original.default_store_.get()) { | 188 default_store_(original.default_store_.get()) { |
189 // Incognito mode doesn't sync, so no need to create PrefModelAssociator. | 189 // Incognito mode doesn't sync, so no need to create PrefModelAssociator. |
190 pref_notifier_.reset(new PrefNotifierImpl(this)); | 190 pref_notifier_.reset(new PrefNotifierImpl(this)); |
191 pref_value_store_.reset(original.pref_value_store_->CloneAndSpecialize( | 191 pref_value_store_.reset(original.pref_value_store_->CloneAndSpecialize( |
192 NULL, // managed_platform_prefs | 192 NULL, // managed_platform_prefs |
193 NULL, // managed_cloud_prefs | 193 NULL, // managed_cloud_prefs |
194 incognito_extension_prefs, | 194 incognito_extension_prefs, |
195 NULL, // command_line_prefs | 195 NULL, // command_line_prefs |
196 user_pref_store_.get(), | 196 user_pref_store_.get(), |
197 NULL, // recommended_platform_prefs | 197 NULL, // recommended_platform_prefs |
(...skipping 688 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
886 return pref_value_store()->PrefValueFromDefaultStore(name_.c_str()); | 886 return pref_value_store()->PrefValueFromDefaultStore(name_.c_str()); |
887 } | 887 } |
888 | 888 |
889 bool PrefService::Preference::IsUserModifiable() const { | 889 bool PrefService::Preference::IsUserModifiable() const { |
890 return pref_value_store()->PrefValueUserModifiable(name_.c_str()); | 890 return pref_value_store()->PrefValueUserModifiable(name_.c_str()); |
891 } | 891 } |
892 | 892 |
893 bool PrefService::Preference::IsExtensionModifiable() const { | 893 bool PrefService::Preference::IsExtensionModifiable() const { |
894 return pref_value_store()->PrefValueExtensionModifiable(name_.c_str()); | 894 return pref_value_store()->PrefValueExtensionModifiable(name_.c_str()); |
895 } | 895 } |
OLD | NEW |