Index: chrome/browser/extensions/extension_pref_store.cc |
diff --git a/chrome/browser/extensions/extension_pref_store.cc b/chrome/browser/extensions/extension_pref_store.cc |
index 27719ed3a69345009a2b73be9c7c7156c619e99e..b590307e5d4fb7294527b493bd6cf900ffcada78 100644 |
--- a/chrome/browser/extensions/extension_pref_store.cc |
+++ b/chrome/browser/extensions/extension_pref_store.cc |
@@ -12,11 +12,9 @@ |
#include "chrome/common/extensions/extension.h" |
#include "chrome/common/notification_service.h" |
-ExtensionPrefStore::ExtensionPrefStore(Profile* profile, |
- PrefNotifier::PrefStoreType type) |
+ExtensionPrefStore::ExtensionPrefStore(Profile* profile) |
: prefs_(new DictionaryValue()), |
- profile_(profile), |
- type_(type) { |
+ profile_(profile) { |
RegisterObservers(); |
} |
@@ -36,23 +34,16 @@ void ExtensionPrefStore::InstallExtensionPref(const Extension* extension, |
// If this extension is not already in the stack, add it. Otherwise, update |
// or add the value of this preference, but don't change the extension's |
- // position in the stack. We store the extension even if this preference |
- // isn't registered with our PrefService, so that the ordering of extensions |
- // is consistent among all local-state and user ExtensionPrefStores. |
- PrefService* pref_service = GetPrefService(); |
- // The pref_service may be NULL in unit testing. |
- bool is_registered_pref = (pref_service == NULL || |
- pref_service->FindPreference(new_pref_path) != NULL); |
+ // position in the stack. |
PrefValueMap* pref_values; |
if (i == extension_stack_.end()) { |
pref_values = new PrefValueMap(); |
- if (is_registered_pref) |
- (*pref_values)[new_pref_path] = new_pref_value; |
+ (*pref_values)[new_pref_path] = new_pref_value; |
ExtensionPrefs* extension_prefs = new ExtensionPrefs(extension, |
pref_values); |
extension_stack_.push_front(extension_prefs); |
- } else if (is_registered_pref) { |
+ } else { |
pref_values = (*i)->pref_values; |
delete (*pref_values)[new_pref_path]; |
(*pref_values)[new_pref_path] = new_pref_value; |
@@ -87,16 +78,6 @@ void ExtensionPrefStore::GetExtensionIDs(std::vector<std::string>* result) { |
// installed extensions will be trying to control any preferences, so stick |
// with this simpler algorithm until it causes a problem. |
void ExtensionPrefStore::UpdateOnePref(const char* path) { |
- PrefService* pref_service = GetPrefService(); |
- |
- // There are at least two PrefServices, one for local state and one for |
- // user prefs. (See browser_main.cc.) Different preferences are registered |
- // in each; if this one doesn't have the desired pref registered, we ignore |
- // it and let the other one handle it. |
- // The pref_service may be NULL in unit testing. |
- if (pref_service && !pref_service->FindPreference(path)) |
- return; |
- |
// Save the old value before removing it from the local cache. |
Value* my_old_value_ptr = NULL; |
prefs_->Get(path, &my_old_value_ptr); |
@@ -120,19 +101,17 @@ void ExtensionPrefStore::UpdateOnePref(const char* path) { |
} |
} |
- if (pref_service) { |
- bool value_changed = true; |
- if (!my_old_value.get() && !my_new_value) { |
- value_changed = false; |
- } else if (my_old_value.get() && |
- my_new_value && |
- my_old_value->Equals(my_new_value)) { |
- value_changed = false; |
- } |
- |
- if (value_changed) |
- pref_service->pref_notifier()->OnPreferenceSet(path, type_); |
+ bool value_changed = true; |
+ if (!my_old_value.get() && !my_new_value) { |
+ value_changed = false; |
+ } else if (my_old_value.get() && |
+ my_new_value && |
+ my_old_value->Equals(my_new_value)) { |
+ value_changed = false; |
} |
+ |
+ if (value_changed) |
+ NotifyPrefValueChanged(path); |
} |
void ExtensionPrefStore::UpdatePrefs(const PrefValueMap* pref_values) { |
@@ -145,12 +124,6 @@ void ExtensionPrefStore::UpdatePrefs(const PrefValueMap* pref_values) { |
} |
} |
-PrefService* ExtensionPrefStore::GetPrefService() { |
- if (profile_) |
- return profile_->GetPrefs(); |
- return g_browser_process->local_state(); |
-} |
- |
void ExtensionPrefStore::RegisterObservers() { |
notification_registrar_.Add(this, |
NotificationType::EXTENSION_PREF_CHANGED, |