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_policy_provi
der.h" | 5 #include "components/content_settings/core/browser/content_settings_policy_provi
der.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 ContentSettingsType content_type = | 228 ContentSettingsType content_type = |
229 kPrefsForManagedContentSettingsMap[i].content_type; | 229 kPrefsForManagedContentSettingsMap[i].content_type; |
230 DCHECK_NE(content_type, CONTENT_SETTINGS_TYPE_AUTO_SELECT_CERTIFICATE); | 230 DCHECK_NE(content_type, CONTENT_SETTINGS_TYPE_AUTO_SELECT_CERTIFICATE); |
231 // If only one pattern was defined auto expand it to a pattern pair. | 231 // If only one pattern was defined auto expand it to a pattern pair. |
232 ContentSettingsPattern secondary_pattern = | 232 ContentSettingsPattern secondary_pattern = |
233 !pattern_pair.second.IsValid() ? ContentSettingsPattern::Wildcard() | 233 !pattern_pair.second.IsValid() ? ContentSettingsPattern::Wildcard() |
234 : pattern_pair.second; | 234 : pattern_pair.second; |
235 VLOG_IF(2, !pattern_pair.second.IsValid()) | 235 VLOG_IF(2, !pattern_pair.second.IsValid()) |
236 << "Replacing invalid secondary pattern '" | 236 << "Replacing invalid secondary pattern '" |
237 << pattern_pair.second.ToString() << "' with wildcard"; | 237 << pattern_pair.second.ToString() << "' with wildcard"; |
238 value_map->SetValue(pattern_pair.first, secondary_pattern, content_type, | 238 value_map->SetValue( |
239 ResourceIdentifier(), | 239 pattern_pair.first, secondary_pattern, content_type, |
240 new base::FundamentalValue( | 240 ResourceIdentifier(), |
241 kPrefsForManagedContentSettingsMap[i].setting)); | 241 new base::Value(kPrefsForManagedContentSettingsMap[i].setting)); |
242 } | 242 } |
243 } | 243 } |
244 } | 244 } |
245 | 245 |
246 void PolicyProvider::GetAutoSelectCertificateSettingsFromPreferences( | 246 void PolicyProvider::GetAutoSelectCertificateSettingsFromPreferences( |
247 OriginIdentifierValueMap* value_map) { | 247 OriginIdentifierValueMap* value_map) { |
248 const char* pref_name = prefs::kManagedAutoSelectCertificateForUrls; | 248 const char* pref_name = prefs::kManagedAutoSelectCertificateForUrls; |
249 | 249 |
250 if (!prefs_->HasPrefPath(pref_name)) { | 250 if (!prefs_->HasPrefPath(pref_name)) { |
251 VLOG(2) << "Skipping unset preference: " << pref_name; | 251 VLOG(2) << "Skipping unset preference: " << pref_name; |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
351 if (base::FeatureList::IsEnabled(kIgnoreDefaultPluginsSetting)) | 351 if (base::FeatureList::IsEnabled(kIgnoreDefaultPluginsSetting)) |
352 setting = CONTENT_SETTING_DEFAULT; | 352 setting = CONTENT_SETTING_DEFAULT; |
353 } | 353 } |
354 if (setting == CONTENT_SETTING_DEFAULT) { | 354 if (setting == CONTENT_SETTING_DEFAULT) { |
355 value_map_.DeleteValue(ContentSettingsPattern::Wildcard(), | 355 value_map_.DeleteValue(ContentSettingsPattern::Wildcard(), |
356 ContentSettingsPattern::Wildcard(), | 356 ContentSettingsPattern::Wildcard(), |
357 entry.content_type, std::string()); | 357 entry.content_type, std::string()); |
358 } else { | 358 } else { |
359 value_map_.SetValue(ContentSettingsPattern::Wildcard(), | 359 value_map_.SetValue(ContentSettingsPattern::Wildcard(), |
360 ContentSettingsPattern::Wildcard(), entry.content_type, | 360 ContentSettingsPattern::Wildcard(), entry.content_type, |
361 std::string(), new base::FundamentalValue(setting)); | 361 std::string(), new base::Value(setting)); |
362 } | 362 } |
363 } | 363 } |
364 | 364 |
365 | 365 |
366 void PolicyProvider::ReadManagedContentSettings(bool overwrite) { | 366 void PolicyProvider::ReadManagedContentSettings(bool overwrite) { |
367 base::AutoLock auto_lock(lock_); | 367 base::AutoLock auto_lock(lock_); |
368 if (overwrite) | 368 if (overwrite) |
369 value_map_.clear(); | 369 value_map_.clear(); |
370 GetContentSettingsFromPreferences(&value_map_); | 370 GetContentSettingsFromPreferences(&value_map_); |
371 GetAutoSelectCertificateSettingsFromPreferences(&value_map_); | 371 GetAutoSelectCertificateSettingsFromPreferences(&value_map_); |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
421 ReadManagedDefaultSettings(); | 421 ReadManagedDefaultSettings(); |
422 } | 422 } |
423 | 423 |
424 NotifyObservers(ContentSettingsPattern(), | 424 NotifyObservers(ContentSettingsPattern(), |
425 ContentSettingsPattern(), | 425 ContentSettingsPattern(), |
426 CONTENT_SETTINGS_TYPE_DEFAULT, | 426 CONTENT_SETTINGS_TYPE_DEFAULT, |
427 std::string()); | 427 std::string()); |
428 } | 428 } |
429 | 429 |
430 } // namespace content_settings | 430 } // namespace content_settings |
OLD | NEW |