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

Unified Diff: chrome/browser/prefs/pref_model_associator.cc

Issue 1252073002: Move pref names and default value into WebsiteSettingsInfo (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@website-settings-registry-simple
Patch Set: Created 5 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/prefs/pref_model_associator.cc
diff --git a/chrome/browser/prefs/pref_model_associator.cc b/chrome/browser/prefs/pref_model_associator.cc
index 4a3bd1f5ce5e4fec86871544ec8a67d63d901274..0c51a136d40ef6fc32273ad7204e45d475349e01 100644
--- a/chrome/browser/prefs/pref_model_associator.cc
+++ b/chrome/browser/prefs/pref_model_associator.cc
@@ -16,7 +16,8 @@
#include "chrome/browser/chrome_notification_types.h"
#include "chrome/browser/prefs/pref_service_syncable.h"
#include "chrome/common/pref_names.h"
-#include "components/content_settings/core/browser/content_settings_pref_provider.h"
+#include "components/content_settings/core/browser/website_settings_info.h"
+#include "components/content_settings/core/browser/website_settings_registry.h"
#include "sync/api/sync_change.h"
#include "sync/api/sync_error_factory.h"
#include "sync/protocol/preference_specifics.pb.h"
@@ -320,17 +321,19 @@ scoped_ptr<base::Value> PrefModelAssociator::MergePreference(
// to merge for all migrated values.
if (name == prefs::kURLsToRestoreOnStartup ||
name == prefs::kURLsToRestoreOnStartupOld) {
- return scoped_ptr<base::Value>(
- MergeListValues(local_value, server_value)).Pass();
+ return make_scoped_ptr(MergeListValues(local_value, server_value));
}
- if (content_settings::PrefProvider::IsContentSettingsExceptionsPref(name)) {
- return scoped_ptr<base::Value>(
- MergeDictionaryValues(local_value, server_value)).Pass();
+ content_settings::WebsiteSettingsRegistry* registry =
+ content_settings::WebsiteSettingsRegistry::GetInstance();
+ for (int i = 0; i < CONTENT_SETTINGS_NUM_TYPES; ++i) {
+ ContentSettingsType type = static_cast<ContentSettingsType>(i);
+ if (registry->Get(type)->pref_name() == name)
+ return make_scoped_ptr(MergeDictionaryValues(local_value, server_value));
}
// If this is not a specially handled preference, server wins.
- return scoped_ptr<base::Value>(server_value.DeepCopy()).Pass();
+ return make_scoped_ptr(server_value.DeepCopy());
}
bool PrefModelAssociator::CreatePrefSyncData(
« no previous file with comments | « chrome/browser/prefs/pref_functional_browsertest.cc ('k') | chrome/browser/prefs/pref_model_associator_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698