| 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 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 242 DCHECK_NE(content_type, CONTENT_SETTINGS_TYPE_AUTO_SELECT_CERTIFICATE); | 242 DCHECK_NE(content_type, CONTENT_SETTINGS_TYPE_AUTO_SELECT_CERTIFICATE); |
| 243 // If only one pattern was defined auto expand it to a pattern pair. | 243 // If only one pattern was defined auto expand it to a pattern pair. |
| 244 ContentSettingsPattern secondary_pattern = | 244 ContentSettingsPattern secondary_pattern = |
| 245 !pattern_pair.second.IsValid() ? ContentSettingsPattern::Wildcard() | 245 !pattern_pair.second.IsValid() ? ContentSettingsPattern::Wildcard() |
| 246 : pattern_pair.second; | 246 : pattern_pair.second; |
| 247 VLOG_IF(2, !pattern_pair.second.IsValid()) | 247 VLOG_IF(2, !pattern_pair.second.IsValid()) |
| 248 << "Replacing invalid secondary pattern '" | 248 << "Replacing invalid secondary pattern '" |
| 249 << pattern_pair.second.ToString() << "' with wildcard"; | 249 << pattern_pair.second.ToString() << "' with wildcard"; |
| 250 value_map->SetValue(pattern_pair.first, secondary_pattern, content_type, | 250 value_map->SetValue(pattern_pair.first, secondary_pattern, content_type, |
| 251 ResourceIdentifier(), | 251 ResourceIdentifier(), |
| 252 new base::FundamentalValue( | 252 new base::Value( |
| 253 kPrefsForManagedContentSettingsMap[i].setting)); | 253 kPrefsForManagedContentSettingsMap[i].setting)); |
| 254 } | 254 } |
| 255 } | 255 } |
| 256 } | 256 } |
| 257 | 257 |
| 258 void PolicyProvider::GetAutoSelectCertificateSettingsFromPreferences( | 258 void PolicyProvider::GetAutoSelectCertificateSettingsFromPreferences( |
| 259 OriginIdentifierValueMap* value_map) { | 259 OriginIdentifierValueMap* value_map) { |
| 260 const char* pref_name = prefs::kManagedAutoSelectCertificateForUrls; | 260 const char* pref_name = prefs::kManagedAutoSelectCertificateForUrls; |
| 261 | 261 |
| 262 if (!prefs_->HasPrefPath(pref_name)) { | 262 if (!prefs_->HasPrefPath(pref_name)) { |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 363 if (base::FeatureList::IsEnabled(kIgnoreDefaultPluginsSetting)) | 363 if (base::FeatureList::IsEnabled(kIgnoreDefaultPluginsSetting)) |
| 364 setting = CONTENT_SETTING_DEFAULT; | 364 setting = CONTENT_SETTING_DEFAULT; |
| 365 } | 365 } |
| 366 if (setting == CONTENT_SETTING_DEFAULT) { | 366 if (setting == CONTENT_SETTING_DEFAULT) { |
| 367 value_map_.DeleteValue(ContentSettingsPattern::Wildcard(), | 367 value_map_.DeleteValue(ContentSettingsPattern::Wildcard(), |
| 368 ContentSettingsPattern::Wildcard(), | 368 ContentSettingsPattern::Wildcard(), |
| 369 entry.content_type, std::string()); | 369 entry.content_type, std::string()); |
| 370 } else { | 370 } else { |
| 371 value_map_.SetValue(ContentSettingsPattern::Wildcard(), | 371 value_map_.SetValue(ContentSettingsPattern::Wildcard(), |
| 372 ContentSettingsPattern::Wildcard(), entry.content_type, | 372 ContentSettingsPattern::Wildcard(), entry.content_type, |
| 373 std::string(), new base::FundamentalValue(setting)); | 373 std::string(), new base::Value(setting)); |
| 374 } | 374 } |
| 375 } | 375 } |
| 376 | 376 |
| 377 | 377 |
| 378 void PolicyProvider::ReadManagedContentSettings(bool overwrite) { | 378 void PolicyProvider::ReadManagedContentSettings(bool overwrite) { |
| 379 base::AutoLock auto_lock(lock_); | 379 base::AutoLock auto_lock(lock_); |
| 380 if (overwrite) | 380 if (overwrite) |
| 381 value_map_.clear(); | 381 value_map_.clear(); |
| 382 GetContentSettingsFromPreferences(&value_map_); | 382 GetContentSettingsFromPreferences(&value_map_); |
| 383 GetAutoSelectCertificateSettingsFromPreferences(&value_map_); | 383 GetAutoSelectCertificateSettingsFromPreferences(&value_map_); |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 435 ReadManagedDefaultSettings(); | 435 ReadManagedDefaultSettings(); |
| 436 } | 436 } |
| 437 | 437 |
| 438 NotifyObservers(ContentSettingsPattern(), | 438 NotifyObservers(ContentSettingsPattern(), |
| 439 ContentSettingsPattern(), | 439 ContentSettingsPattern(), |
| 440 CONTENT_SETTINGS_TYPE_DEFAULT, | 440 CONTENT_SETTINGS_TYPE_DEFAULT, |
| 441 std::string()); | 441 std::string()); |
| 442 } | 442 } |
| 443 | 443 |
| 444 } // namespace content_settings | 444 } // namespace content_settings |
| OLD | NEW |