Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(294)

Side by Side Diff: chrome/browser/prefs/chrome_pref_service_factory.cc

Issue 11741003: Remove PrefServiceSimple, replacing it with PrefService and PrefRegistrySimple. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix double registration in Chrome Frame test. Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/chrome_pref_service_factory.h" 5 #include "chrome/browser/prefs/chrome_pref_service_factory.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/file_path.h" 8 #include "base/file_path.h"
9 #include "base/file_util.h" 9 #include "base/file_util.h"
10 #include "base/metrics/histogram.h" 10 #include "base/metrics/histogram.h"
11 #include "base/prefs/default_pref_store.h" 11 #include "base/prefs/default_pref_store.h"
12 #include "base/prefs/json_pref_store.h" 12 #include "base/prefs/json_pref_store.h"
13 #include "chrome/browser/policy/configuration_policy_pref_store.h" 13 #include "chrome/browser/policy/configuration_policy_pref_store.h"
14 #include "chrome/browser/prefs/command_line_pref_store.h" 14 #include "chrome/browser/prefs/command_line_pref_store.h"
15 #include "chrome/browser/prefs/pref_model_associator.h" 15 #include "chrome/browser/prefs/pref_model_associator.h"
16 #include "chrome/browser/prefs/pref_notifier_impl.h" 16 #include "chrome/browser/prefs/pref_notifier_impl.h"
17 #include "chrome/browser/prefs/pref_registry.h"
17 #include "chrome/browser/prefs/pref_service.h" 18 #include "chrome/browser/prefs/pref_service.h"
18 #include "chrome/browser/prefs/pref_service_syncable_builder.h" 19 #include "chrome/browser/prefs/pref_service_syncable_builder.h"
19 #include "chrome/browser/prefs/pref_value_store.h" 20 #include "chrome/browser/prefs/pref_value_store.h"
20 #include "chrome/browser/profiles/profile.h" 21 #include "chrome/browser/profiles/profile.h"
21 #include "chrome/browser/ui/profile_error_dialog.h" 22 #include "chrome/browser/ui/profile_error_dialog.h"
22 #include "content/public/browser/browser_context.h" 23 #include "content/public/browser/browser_context.h"
23 #include "content/public/browser/browser_thread.h" 24 #include "content/public/browser/browser_thread.h"
24 #include "grit/chromium_strings.h" 25 #include "grit/chromium_strings.h"
25 #include "grit/generated_resources.h" 26 #include "grit/generated_resources.h"
26 27
(...skipping 22 matching lines...) Expand all
49 UMA_HISTOGRAM_ENUMERATION("PrefService.ReadError", error, 50 UMA_HISTOGRAM_ENUMERATION("PrefService.ReadError", error,
50 PersistentPrefStore::PREF_READ_ERROR_MAX_ENUM); 51 PersistentPrefStore::PREF_READ_ERROR_MAX_ENUM);
51 } 52 }
52 } 53 }
53 54
54 void PrepareBuilder( 55 void PrepareBuilder(
55 PrefServiceSyncableBuilder* builder, 56 PrefServiceSyncableBuilder* builder,
56 const FilePath& pref_filename, 57 const FilePath& pref_filename,
57 base::SequencedTaskRunner* pref_io_task_runner, 58 base::SequencedTaskRunner* pref_io_task_runner,
58 policy::PolicyService* policy_service, 59 policy::PolicyService* policy_service,
59 PrefStore* extension_prefs, 60 const scoped_refptr<PrefStore>& extension_prefs,
60 bool async) { 61 bool async) {
61 #if defined(OS_LINUX) 62 #if defined(OS_LINUX)
62 // We'd like to see what fraction of our users have the preferences 63 // We'd like to see what fraction of our users have the preferences
63 // stored on a network file system, as we've had no end of troubles 64 // stored on a network file system, as we've had no end of troubles
64 // with NFS/AFS. 65 // with NFS/AFS.
65 // TODO(evanm): remove this once we've collected state. 66 // TODO(evanm): remove this once we've collected state.
66 file_util::FileSystemType fstype; 67 file_util::FileSystemType fstype;
67 if (file_util::GetFileSystemType(pref_filename.DirName(), &fstype)) { 68 if (file_util::GetFileSystemType(pref_filename.DirName(), &fstype)) {
68 UMA_HISTOGRAM_ENUMERATION("PrefService.FileSystemType", 69 UMA_HISTOGRAM_ENUMERATION("PrefService.FileSystemType",
69 static_cast<int>(fstype), 70 static_cast<int>(fstype),
(...skipping 21 matching lines...) Expand all
91 92
92 } // namespace 93 } // namespace
93 94
94 // TODO(joi): Find a better home for this. 95 // TODO(joi): Find a better home for this.
95 PrefServiceBase* PrefServiceBase::FromBrowserContext(BrowserContext* context) { 96 PrefServiceBase* PrefServiceBase::FromBrowserContext(BrowserContext* context) {
96 return static_cast<Profile*>(context)->GetPrefs(); 97 return static_cast<Profile*>(context)->GetPrefs();
97 } 98 }
98 99
99 namespace chrome_prefs { 100 namespace chrome_prefs {
100 101
101 PrefServiceSimple* CreateLocalState( 102 PrefService* CreateLocalState(
102 const FilePath& pref_filename, 103 const FilePath& pref_filename,
103 base::SequencedTaskRunner* pref_io_task_runner, 104 base::SequencedTaskRunner* pref_io_task_runner,
104 policy::PolicyService* policy_service, 105 policy::PolicyService* policy_service,
105 PrefStore* extension_prefs, 106 const scoped_refptr<PrefStore>& extension_prefs,
107 const scoped_refptr<PrefRegistry>& pref_registry,
106 bool async) { 108 bool async) {
107 PrefServiceSyncableBuilder builder; 109 PrefServiceSyncableBuilder builder;
108 PrepareBuilder(&builder, 110 PrepareBuilder(&builder,
109 pref_filename, 111 pref_filename,
110 pref_io_task_runner, 112 pref_io_task_runner,
111 policy_service, 113 policy_service,
112 extension_prefs, 114 extension_prefs,
113 async); 115 async);
114 return builder.CreateSimple(); 116 return builder.Create(pref_registry);
115 } 117 }
116 118
117 PrefServiceSyncable* CreateProfilePrefs( 119 PrefServiceSyncable* CreateProfilePrefs(
118 const FilePath& pref_filename, 120 const FilePath& pref_filename,
119 base::SequencedTaskRunner* pref_io_task_runner, 121 base::SequencedTaskRunner* pref_io_task_runner,
120 policy::PolicyService* policy_service, 122 policy::PolicyService* policy_service,
121 PrefStore* extension_prefs, 123 const scoped_refptr<PrefStore>& extension_prefs,
122 bool async) { 124 bool async) {
123 PrefServiceSyncableBuilder builder; 125 PrefServiceSyncableBuilder builder;
124 PrepareBuilder(&builder, 126 PrepareBuilder(&builder,
125 pref_filename, 127 pref_filename,
126 pref_io_task_runner, 128 pref_io_task_runner,
127 policy_service, 129 policy_service,
128 extension_prefs, 130 extension_prefs,
129 async); 131 async);
130 return builder.CreateSyncable(); 132 return builder.CreateSyncable();
131 } 133 }
132 134
133 } // namespace chrome_prefs 135 } // namespace chrome_prefs
OLDNEW
« no previous file with comments | « chrome/browser/prefs/chrome_pref_service_factory.h ('k') | chrome/browser/prefs/pref_notifier_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698