OLD | NEW |
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 "chrome/browser/content_settings/content_settings_pref_provider.h" | 5 #include "chrome/browser/content_settings/content_settings_pref_provider.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 #include <string> | 8 #include <string> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
11 #include "base/auto_reset.h" | 11 #include "base/auto_reset.h" |
12 #include "base/command_line.h" | 12 #include "base/command_line.h" |
13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
14 #include "base/metrics/histogram.h" | 14 #include "base/metrics/histogram.h" |
15 #include "chrome/browser/content_settings/content_settings_rule.h" | 15 #include "chrome/browser/content_settings/content_settings_rule.h" |
16 #include "chrome/browser/content_settings/content_settings_utils.h" | 16 #include "chrome/browser/content_settings/content_settings_utils.h" |
17 #include "chrome/browser/content_settings/host_content_settings_map.h" | 17 #include "chrome/browser/content_settings/host_content_settings_map.h" |
| 18 #include "chrome/browser/prefs/pref_registry_syncable.h" |
18 #include "chrome/browser/prefs/pref_service.h" | 19 #include "chrome/browser/prefs/pref_service.h" |
19 #include "chrome/browser/prefs/scoped_user_pref_update.h" | 20 #include "chrome/browser/prefs/scoped_user_pref_update.h" |
20 #include "chrome/common/chrome_notification_types.h" | 21 #include "chrome/common/chrome_notification_types.h" |
21 #include "chrome/common/chrome_switches.h" | 22 #include "chrome/common/chrome_switches.h" |
22 #include "chrome/common/content_settings.h" | 23 #include "chrome/common/content_settings.h" |
23 #include "chrome/common/content_settings_pattern.h" | 24 #include "chrome/common/content_settings_pattern.h" |
24 #include "chrome/common/pref_names.h" | 25 #include "chrome/common/pref_names.h" |
25 #include "content/public/browser/browser_thread.h" | 26 #include "content/public/browser/browser_thread.h" |
26 #include "content/public/browser/notification_details.h" | 27 #include "content/public/browser/notification_details.h" |
27 #include "content/public/browser/notification_source.h" | 28 #include "content/public/browser/notification_source.h" |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 | 65 |
65 } // namespace | 66 } // namespace |
66 | 67 |
67 namespace content_settings { | 68 namespace content_settings { |
68 | 69 |
69 // //////////////////////////////////////////////////////////////////////////// | 70 // //////////////////////////////////////////////////////////////////////////// |
70 // PrefProvider: | 71 // PrefProvider: |
71 // | 72 // |
72 | 73 |
73 // static | 74 // static |
74 void PrefProvider::RegisterUserPrefs(PrefServiceSyncable* prefs) { | 75 void PrefProvider::RegisterUserPrefs(PrefRegistrySyncable* registry) { |
75 prefs->RegisterIntegerPref( | 76 registry->RegisterIntegerPref( |
76 prefs::kContentSettingsVersion, | 77 prefs::kContentSettingsVersion, |
77 ContentSettingsPattern::kContentSettingsPatternVersion, | 78 ContentSettingsPattern::kContentSettingsPatternVersion, |
78 PrefServiceSyncable::UNSYNCABLE_PREF); | 79 PrefRegistrySyncable::UNSYNCABLE_PREF); |
79 prefs->RegisterDictionaryPref(prefs::kContentSettingsPatternPairs, | 80 registry->RegisterDictionaryPref(prefs::kContentSettingsPatternPairs, |
80 PrefServiceSyncable::SYNCABLE_PREF); | 81 PrefRegistrySyncable::SYNCABLE_PREF); |
81 } | 82 } |
82 | 83 |
83 PrefProvider::PrefProvider(PrefService* prefs, | 84 PrefProvider::PrefProvider(PrefService* prefs, |
84 bool incognito) | 85 bool incognito) |
85 : prefs_(prefs), | 86 : prefs_(prefs), |
86 is_incognito_(incognito), | 87 is_incognito_(incognito), |
87 updating_preferences_(false) { | 88 updating_preferences_(false) { |
88 DCHECK(prefs_); | 89 DCHECK(prefs_); |
89 // Verify preferences version. | 90 // Verify preferences version. |
90 if (!prefs_->HasPrefPath(prefs::kContentSettingsVersion)) { | 91 if (!prefs_->HasPrefPath(prefs::kContentSettingsVersion)) { |
(...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
566 | 567 |
567 void PrefProvider::AssertLockNotHeld() const { | 568 void PrefProvider::AssertLockNotHeld() const { |
568 #if !defined(NDEBUG) | 569 #if !defined(NDEBUG) |
569 // |Lock::Acquire()| will assert if the lock is held by this thread. | 570 // |Lock::Acquire()| will assert if the lock is held by this thread. |
570 lock_.Acquire(); | 571 lock_.Acquire(); |
571 lock_.Release(); | 572 lock_.Release(); |
572 #endif | 573 #endif |
573 } | 574 } |
574 | 575 |
575 } // namespace content_settings | 576 } // namespace content_settings |
OLD | NEW |