| 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/prefs/pref_value_store.h" | 5 #include "chrome/browser/prefs/pref_value_store.h" |
| 6 | 6 |
| 7 #include "chrome/browser/browser_thread.h" | 7 #include "chrome/browser/browser_thread.h" |
| 8 #include "chrome/browser/extensions/extension_pref_store.h" | 8 #include "chrome/browser/extensions/extension_pref_store.h" |
| 9 #include "chrome/browser/policy/configuration_policy_pref_store.h" | 9 #include "chrome/browser/policy/configuration_policy_pref_store.h" |
| 10 #include "chrome/browser/prefs/command_line_pref_store.h" | 10 #include "chrome/browser/prefs/command_line_pref_store.h" |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 pref_filename, | 49 pref_filename, |
| 50 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE)); | 50 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE)); |
| 51 InMemoryPrefStore* default_store = new InMemoryPrefStore(); | 51 InMemoryPrefStore* default_store = new InMemoryPrefStore(); |
| 52 | 52 |
| 53 if (!user_only) { | 53 if (!user_only) { |
| 54 managed = | 54 managed = |
| 55 ConfigurationPolicyPrefStore::CreateManagedPlatformPolicyPrefStore(); | 55 ConfigurationPolicyPrefStore::CreateManagedPlatformPolicyPrefStore(); |
| 56 device_management = | 56 device_management = |
| 57 ConfigurationPolicyPrefStore::CreateDeviceManagementPolicyPrefStore( | 57 ConfigurationPolicyPrefStore::CreateDeviceManagementPolicyPrefStore( |
| 58 profile); | 58 profile); |
| 59 extension = new ExtensionPrefStore(profile, PrefNotifier::EXTENSION_STORE); | 59 extension = new ExtensionPrefStore(profile); |
| 60 command_line = new CommandLinePrefStore(CommandLine::ForCurrentProcess()); | 60 command_line = new CommandLinePrefStore(CommandLine::ForCurrentProcess()); |
| 61 recommended = | 61 recommended = |
| 62 ConfigurationPolicyPrefStore::CreateRecommendedPolicyPrefStore(); | 62 ConfigurationPolicyPrefStore::CreateRecommendedPolicyPrefStore(); |
| 63 } | 63 } |
| 64 return new PrefValueStore(managed, device_management, extension, | 64 return new PrefValueStore(managed, device_management, extension, |
| 65 command_line, user, recommended, default_store, | 65 command_line, user, recommended, default_store, |
| 66 profile); | 66 profile); |
| 67 } | 67 } |
| 68 | 68 |
| 69 PrefValueStore::~PrefValueStore() {} | 69 PrefValueStore::~PrefValueStore() {} |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 | 147 |
| 148 bool PrefValueStore::PrefHasChanged(const char* path, | 148 bool PrefValueStore::PrefHasChanged(const char* path, |
| 149 PrefNotifier::PrefStoreType new_store) { | 149 PrefNotifier::PrefStoreType new_store) { |
| 150 DCHECK(new_store != PrefNotifier::INVALID_STORE); | 150 DCHECK(new_store != PrefNotifier::INVALID_STORE); |
| 151 // Replying that the pref has changed may cause problems, but it's the safer | 151 // Replying that the pref has changed may cause problems, but it's the safer |
| 152 // choice. | 152 // choice. |
| 153 if (new_store == PrefNotifier::INVALID_STORE) | 153 if (new_store == PrefNotifier::INVALID_STORE) |
| 154 return true; | 154 return true; |
| 155 | 155 |
| 156 PrefNotifier::PrefStoreType controller = ControllingPrefStoreForPref(path); | 156 PrefNotifier::PrefStoreType controller = ControllingPrefStoreForPref(path); |
| 157 DCHECK(controller != PrefNotifier::INVALID_STORE); | 157 DCHECK(controller != PrefNotifier::INVALID_STORE) |
| 158 << "Invalid controller for path " << path; |
| 158 if (controller == PrefNotifier::INVALID_STORE) | 159 if (controller == PrefNotifier::INVALID_STORE) |
| 159 return true; | 160 return true; |
| 160 | 161 |
| 161 // If the pref is controlled by a higher-priority store, its effective value | 162 // If the pref is controlled by a higher-priority store, its effective value |
| 162 // cannot have changed. | 163 // cannot have changed. |
| 163 if (controller < new_store) | 164 if (controller < new_store) |
| 164 return false; | 165 return false; |
| 165 | 166 |
| 166 // Otherwise, we take the pref store's word that something changed. | 167 // Otherwise, we take the pref store's word that something changed. |
| 167 return true; | 168 return true; |
| (...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 478 pref_stores_[PrefNotifier::MANAGED_PLATFORM_STORE].reset( | 479 pref_stores_[PrefNotifier::MANAGED_PLATFORM_STORE].reset( |
| 479 managed_platform_prefs); | 480 managed_platform_prefs); |
| 480 pref_stores_[PrefNotifier::DEVICE_MANAGEMENT_STORE].reset( | 481 pref_stores_[PrefNotifier::DEVICE_MANAGEMENT_STORE].reset( |
| 481 device_management_prefs); | 482 device_management_prefs); |
| 482 pref_stores_[PrefNotifier::EXTENSION_STORE].reset(extension_prefs); | 483 pref_stores_[PrefNotifier::EXTENSION_STORE].reset(extension_prefs); |
| 483 pref_stores_[PrefNotifier::COMMAND_LINE_STORE].reset(command_line_prefs); | 484 pref_stores_[PrefNotifier::COMMAND_LINE_STORE].reset(command_line_prefs); |
| 484 pref_stores_[PrefNotifier::USER_STORE].reset(user_prefs); | 485 pref_stores_[PrefNotifier::USER_STORE].reset(user_prefs); |
| 485 pref_stores_[PrefNotifier::RECOMMENDED_STORE].reset(recommended_prefs); | 486 pref_stores_[PrefNotifier::RECOMMENDED_STORE].reset(recommended_prefs); |
| 486 pref_stores_[PrefNotifier::DEFAULT_STORE].reset(default_prefs); | 487 pref_stores_[PrefNotifier::DEFAULT_STORE].reset(default_prefs); |
| 487 } | 488 } |
| OLD | NEW |