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

Side by Side Diff: chrome/browser/extensions/extension_prefs.cc

Issue 5441002: Clean up pref change notification handling. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix memory leaks in tests. Created 10 years 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) 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/extensions/extension_prefs.h" 5 #include "chrome/browser/extensions/extension_prefs.h"
6 6
7 #include "base/string_util.h" 7 #include "base/string_util.h"
8 #include "base/string_number_conversions.h" 8 #include "base/string_number_conversions.h"
9 #include "base/utf_string_conversions.h" 9 #include "base/utf_string_conversions.h"
10 #include "chrome/browser/prefs/pref_notifier.h" 10 #include "chrome/browser/prefs/pref_notifier.h"
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after
319 for (std::set<std::string>::const_iterator iter = new_value.begin(); 319 for (std::set<std::string>::const_iterator iter = new_value.begin();
320 iter != new_value.end(); ++iter) 320 iter != new_value.end(); ++iter)
321 value->Append(Value::CreateStringValue(*iter)); 321 value->Append(Value::CreateStringValue(*iter));
322 322
323 UpdateExtensionPref(extension_id, pref_key, value); 323 UpdateExtensionPref(extension_id, pref_key, value);
324 prefs_->ScheduleSavePersistentPrefs(); 324 prefs_->ScheduleSavePersistentPrefs();
325 } 325 }
326 326
327 void ExtensionPrefs::SavePrefsAndNotify() { 327 void ExtensionPrefs::SavePrefsAndNotify() {
328 prefs_->ScheduleSavePersistentPrefs(); 328 prefs_->ScheduleSavePersistentPrefs();
329 prefs_->pref_notifier()->OnUserPreferenceSet(kExtensionsPref); 329 // TODO(mnissler, danno): Don't use pref_notifier() here, but tell the
330 // PrefService by some other means that we changed the pref value.
331 prefs_->pref_notifier()->OnPreferenceChanged(kExtensionsPref);
330 } 332 }
331 333
332 bool ExtensionPrefs::IsBlacklistBitSet(DictionaryValue* ext) { 334 bool ExtensionPrefs::IsBlacklistBitSet(DictionaryValue* ext) {
333 return ReadBooleanFromPref(ext, kPrefBlacklist); 335 return ReadBooleanFromPref(ext, kPrefBlacklist);
334 } 336 }
335 337
336 bool ExtensionPrefs::IsExtensionBlacklisted(const std::string& extension_id) { 338 bool ExtensionPrefs::IsExtensionBlacklisted(const std::string& extension_id) {
337 return ReadExtensionPrefBoolean(extension_id, kPrefBlacklist); 339 return ReadExtensionPrefBoolean(extension_id, kPrefBlacklist);
338 } 340 }
339 341
(...skipping 754 matching lines...) Expand 10 before | Expand all | Expand 10 after
1094 void ExtensionPrefs::RegisterUserPrefs(PrefService* prefs) { 1096 void ExtensionPrefs::RegisterUserPrefs(PrefService* prefs) {
1095 prefs->RegisterDictionaryPref(kExtensionsPref); 1097 prefs->RegisterDictionaryPref(kExtensionsPref);
1096 prefs->RegisterListPref(kExtensionToolbar); 1098 prefs->RegisterListPref(kExtensionToolbar);
1097 prefs->RegisterIntegerPref(prefs::kExtensionToolbarSize, -1); 1099 prefs->RegisterIntegerPref(prefs::kExtensionToolbarSize, -1);
1098 prefs->RegisterDictionaryPref(kExtensionsBlacklistUpdate); 1100 prefs->RegisterDictionaryPref(kExtensionsBlacklistUpdate);
1099 prefs->RegisterListPref(prefs::kExtensionInstallAllowList); 1101 prefs->RegisterListPref(prefs::kExtensionInstallAllowList);
1100 prefs->RegisterListPref(prefs::kExtensionInstallDenyList); 1102 prefs->RegisterListPref(prefs::kExtensionInstallDenyList);
1101 prefs->RegisterListPref(prefs::kExtensionInstallForceList); 1103 prefs->RegisterListPref(prefs::kExtensionInstallForceList);
1102 prefs->RegisterStringPref(kWebStoreLogin, std::string() /* default_value */); 1104 prefs->RegisterStringPref(kWebStoreLogin, std::string() /* default_value */);
1103 } 1105 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698