OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "extensions/shell/browser/shell_prefs.h" | 5 #include "extensions/shell/browser/shell_prefs.h" |
6 | 6 |
7 #include "base/prefs/json_pref_store.h" | 7 #include "base/prefs/json_pref_store.h" |
8 #include "base/prefs/pref_filter.h" | 8 #include "base/prefs/pref_filter.h" |
9 #include "base/prefs/pref_registry_simple.h" | 9 #include "base/prefs/pref_registry_simple.h" |
10 #include "base/prefs/pref_service.h" | 10 #include "base/prefs/pref_service.h" |
11 #include "base/prefs/pref_service_factory.h" | 11 #include "base/prefs/pref_service_factory.h" |
12 #include "components/pref_registry/pref_registry_syncable.h" | 12 #include "components/pref_registry/pref_registry_syncable.h" |
13 #include "components/user_prefs/user_prefs.h" | 13 #include "components/user_prefs/user_prefs.h" |
14 #include "content/public/browser/browser_context.h" | 14 #include "content/public/browser/browser_context.h" |
15 #include "content/public/browser/browser_thread.h" | 15 #include "content/public/browser/browser_thread.h" |
16 #include "extensions/browser/extension_prefs.h" | 16 #include "extensions/browser/extension_prefs.h" |
17 | 17 |
18 #if defined(OS_CHROMEOS) | 18 #if defined(OS_CHROMEOS) |
19 #include "chromeos/audio/audio_devices_pref_handler_impl.h" | 19 #include "chromeos/audio/audio_devices_pref_handler_impl.h" |
20 #endif | 20 #endif |
21 | 21 |
22 using base::FilePath; | 22 using base::FilePath; |
23 using user_prefs::PrefRegistrySyncable; | 23 using user_prefs::PrefRegistrySyncable; |
24 | 24 |
25 namespace extensions { | 25 namespace extensions { |
26 namespace { | 26 namespace { |
27 | 27 |
28 void RegisterLocalStatePrefs(PrefRegistrySimple* registry) { | 28 void RegisterLocalStatePrefs(PrefRegistrySimple* registry) { |
29 #if defined(OS_CHROMEOS) | 29 #if defined(OS_CHROMEOS) |
30 chromeos::AudioDevicesPrefHandlerImpl::RegisterPrefs(registry, ""); | 30 chromeos::AudioDevicesPrefHandlerImpl::RegisterPrefs(registry); |
31 #endif | 31 #endif |
32 } | 32 } |
33 | 33 |
34 // Creates a JsonPrefStore from a file at |filepath| and synchronously loads | 34 // Creates a JsonPrefStore from a file at |filepath| and synchronously loads |
35 // the preferences. | 35 // the preferences. |
36 scoped_refptr<JsonPrefStore> CreateAndLoadPrefStore(const FilePath& filepath) { | 36 scoped_refptr<JsonPrefStore> CreateAndLoadPrefStore(const FilePath& filepath) { |
37 scoped_refptr<base::SequencedTaskRunner> task_runner = | 37 scoped_refptr<base::SequencedTaskRunner> task_runner = |
38 JsonPrefStore::GetTaskRunnerForFile( | 38 JsonPrefStore::GetTaskRunnerForFile( |
39 filepath, content::BrowserThread::GetBlockingPool()); | 39 filepath, content::BrowserThread::GetBlockingPool()); |
40 scoped_refptr<JsonPrefStore> pref_store = | 40 scoped_refptr<JsonPrefStore> pref_store = |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 ExtensionPrefs::RegisterProfilePrefs(pref_registry); | 81 ExtensionPrefs::RegisterProfilePrefs(pref_registry); |
82 | 82 |
83 scoped_ptr<PrefService> pref_service = factory.Create(pref_registry); | 83 scoped_ptr<PrefService> pref_service = factory.Create(pref_registry); |
84 user_prefs::UserPrefs::Set(browser_context, pref_service.get()); | 84 user_prefs::UserPrefs::Set(browser_context, pref_service.get()); |
85 return pref_service; | 85 return pref_service; |
86 } | 86 } |
87 | 87 |
88 } // namespace shell_prefs | 88 } // namespace shell_prefs |
89 | 89 |
90 } // namespace extensions | 90 } // namespace extensions |
OLD | NEW |