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" |
11 #include "chrome/browser/prefs/default_pref_store.h" | 11 #include "chrome/browser/prefs/in_memory_pref_store.h" |
12 #include "chrome/common/json_pref_store.h" | 12 #include "chrome/common/json_pref_store.h" |
13 #include "chrome/common/notification_service.h" | 13 #include "chrome/common/notification_service.h" |
14 | 14 |
15 namespace { | 15 namespace { |
16 | 16 |
17 // Returns true if the actual value is a valid type for the expected type when | 17 // Returns true if the actual value is a valid type for the expected type when |
18 // found in the given store. | 18 // found in the given store. |
19 bool IsValidType(Value::ValueType expected, Value::ValueType actual, | 19 bool IsValidType(Value::ValueType expected, Value::ValueType actual, |
20 PrefNotifier::PrefStoreType store) { | 20 PrefNotifier::PrefStoreType store) { |
21 if (expected == actual) | 21 if (expected == actual) |
(...skipping 19 matching lines...) Expand all Loading... |
41 using policy::ConfigurationPolicyPrefStore; | 41 using policy::ConfigurationPolicyPrefStore; |
42 ConfigurationPolicyPrefStore* managed = NULL; | 42 ConfigurationPolicyPrefStore* managed = NULL; |
43 ConfigurationPolicyPrefStore* device_management = NULL; | 43 ConfigurationPolicyPrefStore* device_management = NULL; |
44 ExtensionPrefStore* extension = NULL; | 44 ExtensionPrefStore* extension = NULL; |
45 CommandLinePrefStore* command_line = NULL; | 45 CommandLinePrefStore* command_line = NULL; |
46 ConfigurationPolicyPrefStore* recommended = NULL; | 46 ConfigurationPolicyPrefStore* recommended = NULL; |
47 | 47 |
48 JsonPrefStore* user = new JsonPrefStore( | 48 JsonPrefStore* user = new JsonPrefStore( |
49 pref_filename, | 49 pref_filename, |
50 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE)); | 50 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE)); |
51 DefaultPrefStore* default_store = new DefaultPrefStore(); | 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, PrefNotifier::EXTENSION_STORE); |
60 command_line = new CommandLinePrefStore(CommandLine::ForCurrentProcess()); | 60 command_line = new CommandLinePrefStore(CommandLine::ForCurrentProcess()); |
61 recommended = | 61 recommended = |
(...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
478 pref_stores_[PrefNotifier::MANAGED_PLATFORM_STORE].reset( | 478 pref_stores_[PrefNotifier::MANAGED_PLATFORM_STORE].reset( |
479 managed_platform_prefs); | 479 managed_platform_prefs); |
480 pref_stores_[PrefNotifier::DEVICE_MANAGEMENT_STORE].reset( | 480 pref_stores_[PrefNotifier::DEVICE_MANAGEMENT_STORE].reset( |
481 device_management_prefs); | 481 device_management_prefs); |
482 pref_stores_[PrefNotifier::EXTENSION_STORE].reset(extension_prefs); | 482 pref_stores_[PrefNotifier::EXTENSION_STORE].reset(extension_prefs); |
483 pref_stores_[PrefNotifier::COMMAND_LINE_STORE].reset(command_line_prefs); | 483 pref_stores_[PrefNotifier::COMMAND_LINE_STORE].reset(command_line_prefs); |
484 pref_stores_[PrefNotifier::USER_STORE].reset(user_prefs); | 484 pref_stores_[PrefNotifier::USER_STORE].reset(user_prefs); |
485 pref_stores_[PrefNotifier::RECOMMENDED_STORE].reset(recommended_prefs); | 485 pref_stores_[PrefNotifier::RECOMMENDED_STORE].reset(recommended_prefs); |
486 pref_stores_[PrefNotifier::DEFAULT_STORE].reset(default_prefs); | 486 pref_stores_[PrefNotifier::DEFAULT_STORE].reset(default_prefs); |
487 } | 487 } |
OLD | NEW |