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

Side by Side Diff: chrome/browser/prefs/pref_service_builder.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/pref_service_builder.h" 5 #include "chrome/browser/prefs/pref_service_builder.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/prefs/default_pref_store.h" 8 #include "base/prefs/default_pref_store.h"
9 #include "base/prefs/json_pref_store.h" 9 #include "base/prefs/json_pref_store.h"
10 #include "chrome/browser/prefs/pref_notifier_impl.h" 10 #include "chrome/browser/prefs/pref_notifier_impl.h"
11 #include "chrome/browser/prefs/pref_service.h" 11 #include "chrome/browser/prefs/pref_service.h"
12 #include "chrome/browser/prefs/pref_service_simple.h" 12
13 #include "chrome/browser/prefs/pref_value_store.h" 13 #include "chrome/browser/prefs/pref_value_store.h"
14 14
15 namespace { 15 namespace {
16 16
17 // Do-nothing default implementation. 17 // Do-nothing default implementation.
18 void DoNothingHandleReadError(PersistentPrefStore::PrefReadError error) { 18 void DoNothingHandleReadError(PersistentPrefStore::PrefReadError error) {
19 } 19 }
20 20
21 } // namespace 21 } // namespace
22 22
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 base::SequencedTaskRunner* task_runner) { 65 base::SequencedTaskRunner* task_runner) {
66 user_prefs_ = new JsonPrefStore(prefs_file, task_runner); 66 user_prefs_ = new JsonPrefStore(prefs_file, task_runner);
67 return *this; 67 return *this;
68 } 68 }
69 69
70 PrefServiceBuilder& PrefServiceBuilder::WithAsync(bool async) { 70 PrefServiceBuilder& PrefServiceBuilder::WithAsync(bool async) {
71 async_ = async; 71 async_ = async;
72 return *this; 72 return *this;
73 } 73 }
74 74
75 PrefServiceSimple* PrefServiceBuilder::CreateSimple() { 75 PrefService* PrefServiceBuilder::Create(PrefRegistry* pref_registry) {
76 DefaultPrefStore* default_pref_store = new DefaultPrefStore();
77 PrefNotifierImpl* pref_notifier = new PrefNotifierImpl(); 76 PrefNotifierImpl* pref_notifier = new PrefNotifierImpl();
78 PrefServiceSimple* pref_service = new PrefServiceSimple( 77 PrefService* pref_service = new PrefService(
79 pref_notifier, 78 pref_notifier,
80 new PrefValueStore( 79 new PrefValueStore(
81 managed_prefs_.get(), 80 managed_prefs_.get(),
82 extension_prefs_.get(), 81 extension_prefs_.get(),
83 command_line_prefs_.get(), 82 command_line_prefs_.get(),
84 user_prefs_.get(), 83 user_prefs_.get(),
85 recommended_prefs_.get(), 84 recommended_prefs_.get(),
86 default_pref_store, 85 pref_registry->defaults(),
87 pref_notifier), 86 pref_notifier),
88 user_prefs_.get(), 87 user_prefs_.get(),
89 default_pref_store, 88 pref_registry,
90 read_error_callback_, 89 read_error_callback_,
91 async_); 90 async_);
92 ResetDefaultState(); 91 ResetDefaultState();
93 return pref_service; 92 return pref_service;
94 } 93 }
95 94
96 void PrefServiceBuilder::ResetDefaultState() { 95 void PrefServiceBuilder::ResetDefaultState() {
97 managed_prefs_ = NULL; 96 managed_prefs_ = NULL;
98 extension_prefs_ = NULL; 97 extension_prefs_ = NULL;
99 command_line_prefs_ = NULL; 98 command_line_prefs_ = NULL;
100 user_prefs_ = NULL; 99 user_prefs_ = NULL;
101 recommended_prefs_ = NULL; 100 recommended_prefs_ = NULL;
102 read_error_callback_ = base::Bind(&DoNothingHandleReadError); 101 read_error_callback_ = base::Bind(&DoNothingHandleReadError);
103 async_ = false; 102 async_ = false;
104 } 103 }
OLDNEW
« no previous file with comments | « chrome/browser/prefs/pref_service_builder.h ('k') | chrome/browser/prefs/pref_service_mock_builder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698