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 "components/content_settings/core/browser/content_settings_pref_provide
r.h" | 5 #include "components/content_settings/core/browser/content_settings_pref_provide
r.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <map> | 9 #include <map> |
10 #include <memory> | 10 #include <memory> |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 return; | 88 return; |
89 } | 89 } |
90 | 90 |
91 pref_change_registrar_.Init(prefs_); | 91 pref_change_registrar_.Init(prefs_); |
92 | 92 |
93 WebsiteSettingsRegistry* website_settings = | 93 WebsiteSettingsRegistry* website_settings = |
94 WebsiteSettingsRegistry::GetInstance(); | 94 WebsiteSettingsRegistry::GetInstance(); |
95 for (const WebsiteSettingsInfo* info : *website_settings) { | 95 for (const WebsiteSettingsInfo* info : *website_settings) { |
96 content_settings_prefs_.insert(std::make_pair( | 96 content_settings_prefs_.insert(std::make_pair( |
97 info->type(), | 97 info->type(), |
98 base::WrapUnique(new ContentSettingsPref( | 98 base::MakeUnique<ContentSettingsPref>( |
99 info->type(), prefs_, &pref_change_registrar_, info->pref_name(), | 99 info->type(), prefs_, &pref_change_registrar_, info->pref_name(), |
100 is_incognito_, | 100 is_incognito_, |
101 base::Bind(&PrefProvider::Notify, base::Unretained(this)))))); | 101 base::Bind(&PrefProvider::Notify, base::Unretained(this))))); |
102 } | 102 } |
103 | 103 |
104 if (!is_incognito_) { | 104 if (!is_incognito_) { |
105 size_t num_exceptions = 0; | 105 size_t num_exceptions = 0; |
106 for (const auto& pref : content_settings_prefs_) | 106 for (const auto& pref : content_settings_prefs_) |
107 num_exceptions += pref.second->GetNumExceptions(); | 107 num_exceptions += pref.second->GetNumExceptions(); |
108 | 108 |
109 UMA_HISTOGRAM_COUNTS("ContentSettings.NumberOfExceptions", | 109 UMA_HISTOGRAM_COUNTS("ContentSettings.NumberOfExceptions", |
110 num_exceptions); | 110 num_exceptions); |
111 } | 111 } |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 content_type, | 209 content_type, |
210 resource_identifier); | 210 resource_identifier); |
211 } | 211 } |
212 | 212 |
213 void PrefProvider::DiscardObsoletePreferences() { | 213 void PrefProvider::DiscardObsoletePreferences() { |
214 prefs_->ClearPref(kObsoleteMetroSwitchToDesktopExceptions); | 214 prefs_->ClearPref(kObsoleteMetroSwitchToDesktopExceptions); |
215 prefs_->ClearPref(kObsoleteMediaStreamExceptions); | 215 prefs_->ClearPref(kObsoleteMediaStreamExceptions); |
216 } | 216 } |
217 | 217 |
218 } // namespace content_settings | 218 } // namespace content_settings |
OLD | NEW |