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

Side by Side Diff: chrome/browser/content_settings/content_settings_pref_provider.cc

Issue 6905044: Refactor preference syncing. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Really fix. And rebase Created 9 years, 7 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/content_settings/content_settings_pref_provider.h" 5 #include "chrome/browser/content_settings/content_settings_pref_provider.h"
6 6
7 #include <string> 7 #include <string>
8 #include <utility> 8 #include <utility>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
306 void PrefDefaultProvider::RegisterUserPrefs(PrefService* prefs) { 306 void PrefDefaultProvider::RegisterUserPrefs(PrefService* prefs) {
307 // The registration of the preference prefs::kDefaultContentSettings should 307 // The registration of the preference prefs::kDefaultContentSettings should
308 // also include the default values for default content settings. This allows 308 // also include the default values for default content settings. This allows
309 // functional tests to get default content settings by reading the preference 309 // functional tests to get default content settings by reading the preference
310 // prefs::kDefaultContentSettings via pyauto. 310 // prefs::kDefaultContentSettings via pyauto.
311 // TODO(markusheintz): Write pyauto hooks for the content settings map as 311 // TODO(markusheintz): Write pyauto hooks for the content settings map as
312 // content settings should be read from the host content settings map. 312 // content settings should be read from the host content settings map.
313 DictionaryValue* default_content_settings = new DictionaryValue(); 313 DictionaryValue* default_content_settings = new DictionaryValue();
314 SetDefaultContentSettings(default_content_settings); 314 SetDefaultContentSettings(default_content_settings);
315 prefs->RegisterDictionaryPref(prefs::kDefaultContentSettings, 315 prefs->RegisterDictionaryPref(prefs::kDefaultContentSettings,
316 default_content_settings); 316 default_content_settings,
317 PrefService::SYNCABLE_PREF);
317 318
318 // Obsolete prefs, for migrations: 319 // Obsolete prefs, for migrations:
319 prefs->RegisterIntegerPref( 320 prefs->RegisterIntegerPref(
320 prefs::kDesktopNotificationDefaultContentSetting, 321 prefs::kDesktopNotificationDefaultContentSetting,
321 kDefaultSettings[CONTENT_SETTINGS_TYPE_NOTIFICATIONS]); 322 kDefaultSettings[CONTENT_SETTINGS_TYPE_NOTIFICATIONS],
323 PrefService::SYNCABLE_PREF);
322 } 324 }
323 325
324 // //////////////////////////////////////////////////////////////////////////// 326 // ////////////////////////////////////////////////////////////////////////////
325 // PrefProvider: 327 // PrefProvider:
326 // 328 //
327 329
328 // static 330 // static
329 void PrefProvider::RegisterUserPrefs(PrefService* prefs) { 331 void PrefProvider::RegisterUserPrefs(PrefService* prefs) {
330 prefs->RegisterIntegerPref(prefs::kContentSettingsVersion, 332 prefs->RegisterIntegerPref(
331 ContentSettingsPattern::kContentSettingsPatternVersion); 333 prefs::kContentSettingsVersion,
332 prefs->RegisterDictionaryPref(prefs::kContentSettingsPatterns); 334 ContentSettingsPattern::kContentSettingsPatternVersion,
335 PrefService::UNSYNCABLE_PREF);
336 prefs->RegisterDictionaryPref(prefs::kContentSettingsPatterns,
337 PrefService::SYNCABLE_PREF);
333 338
334 // Obsolete prefs, for migration: 339 // Obsolete prefs, for migration:
335 prefs->RegisterListPref(prefs::kPopupWhitelistedHosts); 340 prefs->RegisterListPref(prefs::kPopupWhitelistedHosts,
336 prefs->RegisterDictionaryPref(prefs::kPerHostContentSettings); 341 PrefService::UNSYNCABLE_PREF);
342 prefs->RegisterDictionaryPref(prefs::kPerHostContentSettings,
343 PrefService::UNSYNCABLE_PREF);
337 } 344 }
338 345
339 PrefProvider::PrefProvider(Profile* profile) 346 PrefProvider::PrefProvider(Profile* profile)
340 : BaseProvider(profile->IsOffTheRecord()), 347 : BaseProvider(profile->IsOffTheRecord()),
341 profile_(profile), 348 profile_(profile),
342 updating_preferences_(false) { 349 updating_preferences_(false) {
343 Init(); 350 Init();
344 } 351 }
345 352
346 void PrefProvider::Init() { 353 void PrefProvider::Init() {
(...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after
827 ContentSettingsPattern(host), 834 ContentSettingsPattern(host),
828 CONTENT_SETTINGS_TYPE_POPUPS, 835 CONTENT_SETTINGS_TYPE_POPUPS,
829 "", 836 "",
830 CONTENT_SETTING_ALLOW); 837 CONTENT_SETTING_ALLOW);
831 } 838 }
832 prefs->ClearPref(prefs::kPopupWhitelistedHosts); 839 prefs->ClearPref(prefs::kPopupWhitelistedHosts);
833 } 840 }
834 } 841 }
835 842
836 } // namespace content_settings 843 } // namespace content_settings
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698