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

Side by Side Diff: base/prefs/pref_service.cc

Issue 24533002: Added the AutomaticProfileResetter service. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 3 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 "base/prefs/pref_service.h" 5 #include "base/prefs/pref_service.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 base::DictionaryValue* out = new base::DictionaryValue; 182 base::DictionaryValue* out = new base::DictionaryValue;
183 PrefRegistry::const_iterator i = pref_registry_->begin(); 183 PrefRegistry::const_iterator i = pref_registry_->begin();
184 for (; i != pref_registry_->end(); ++i) { 184 for (; i != pref_registry_->end(); ++i) {
185 const base::Value* value = GetPreferenceValue(i->first); 185 const base::Value* value = GetPreferenceValue(i->first);
186 DCHECK(value); 186 DCHECK(value);
187 out->Set(i->first, value->DeepCopy()); 187 out->Set(i->first, value->DeepCopy());
188 } 188 }
189 return out; 189 return out;
190 } 190 }
191 191
192 base::DictionaryValue* PrefService::GetPreferenceValuesWithoutPathExpansion()
193 const {
194 DCHECK(CalledOnValidThread());
195 base::DictionaryValue* out = new base::DictionaryValue;
196 PrefRegistry::const_iterator i = pref_registry_->begin();
197 for (; i != pref_registry_->end(); ++i) {
198 const base::Value* value = GetPreferenceValue(i->first);
199 DCHECK(value);
200 out->SetWithoutPathExpansion(i->first, value->DeepCopy());
201 }
202 return out;
203 }
204
192 const PrefService::Preference* PrefService::FindPreference( 205 const PrefService::Preference* PrefService::FindPreference(
193 const char* pref_name) const { 206 const char* pref_name) const {
194 DCHECK(CalledOnValidThread()); 207 DCHECK(CalledOnValidThread());
195 PreferenceMap::iterator it = prefs_map_.find(pref_name); 208 PreferenceMap::iterator it = prefs_map_.find(pref_name);
196 if (it != prefs_map_.end()) 209 if (it != prefs_map_.end())
197 return &(it->second); 210 return &(it->second);
198 const base::Value* default_value = NULL; 211 const base::Value* default_value = NULL;
199 if (!pref_registry_->defaults()->GetValue(pref_name, &default_value)) 212 if (!pref_registry_->defaults()->GetValue(pref_name, &default_value))
200 return NULL; 213 return NULL;
201 it = prefs_map_.insert( 214 it = prefs_map_.insert(
(...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after
582 DCHECK(found_value->IsType(default_type)); 595 DCHECK(found_value->IsType(default_type));
583 return found_value; 596 return found_value;
584 } else { 597 } else {
585 // Every registered preference has at least a default value. 598 // Every registered preference has at least a default value.
586 NOTREACHED() << "no valid value found for registered pref " << path; 599 NOTREACHED() << "no valid value found for registered pref " << path;
587 } 600 }
588 } 601 }
589 602
590 return NULL; 603 return NULL;
591 } 604 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698