OLD | NEW |
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/host_content_settings_map.h" | 5 #include "chrome/browser/content_settings/host_content_settings_map.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
327 ContentSettingsType(j), | 327 ContentSettingsType(j), |
328 std::string()); | 328 std::string()); |
329 } | 329 } |
330 } | 330 } |
331 return output; | 331 return output; |
332 } | 332 } |
333 | 333 |
334 void HostContentSettingsMap::GetSettingsForOneType( | 334 void HostContentSettingsMap::GetSettingsForOneType( |
335 ContentSettingsType content_type, | 335 ContentSettingsType content_type, |
336 const std::string& resource_identifier, | 336 const std::string& resource_identifier, |
337 SettingsForOneType* settings) const { | 337 ContentSettingsForOneType* settings) const { |
338 DCHECK(content_settings::SupportsResourceIdentifier(content_type) || | 338 DCHECK(content_settings::SupportsResourceIdentifier(content_type) || |
339 resource_identifier.empty()); | 339 resource_identifier.empty()); |
340 DCHECK(settings); | 340 DCHECK(settings); |
341 | 341 |
342 settings->clear(); | 342 settings->clear(); |
343 for (ConstProviderIterator provider = content_settings_providers_.begin(); | 343 for (ConstProviderIterator provider = content_settings_providers_.begin(); |
344 provider != content_settings_providers_.end(); | 344 provider != content_settings_providers_.end(); |
345 ++provider) { | 345 ++provider) { |
346 // For each provider, iterate first the incognito-specific rules, then the | 346 // For each provider, iterate first the incognito-specific rules, then the |
347 // normal rules. | 347 // normal rules. |
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
569 net::StaticCookiePolicy::BLOCK_SETTING_THIRD_PARTY_COOKIES); | 569 net::StaticCookiePolicy::BLOCK_SETTING_THIRD_PARTY_COOKIES); |
570 } | 570 } |
571 } | 571 } |
572 } | 572 } |
573 | 573 |
574 void HostContentSettingsMap::AddSettingsForOneType( | 574 void HostContentSettingsMap::AddSettingsForOneType( |
575 const content_settings::ProviderInterface* provider, | 575 const content_settings::ProviderInterface* provider, |
576 ProviderType provider_type, | 576 ProviderType provider_type, |
577 ContentSettingsType content_type, | 577 ContentSettingsType content_type, |
578 const std::string& resource_identifier, | 578 const std::string& resource_identifier, |
579 SettingsForOneType* settings, | 579 ContentSettingsForOneType* settings, |
580 bool incognito) const { | 580 bool incognito) const { |
581 scoped_ptr<content_settings::RuleIterator> rule_iterator( | 581 scoped_ptr<content_settings::RuleIterator> rule_iterator( |
582 provider->GetRuleIterator(content_type, | 582 provider->GetRuleIterator(content_type, |
583 resource_identifier, | 583 resource_identifier, |
584 incognito)); | 584 incognito)); |
585 ContentSettingsPattern wildcard = ContentSettingsPattern::Wildcard(); | 585 ContentSettingsPattern wildcard = ContentSettingsPattern::Wildcard(); |
586 while (rule_iterator->HasNext()) { | 586 while (rule_iterator->HasNext()) { |
587 const content_settings::Rule& rule = rule_iterator->Next(); | 587 const content_settings::Rule& rule = rule_iterator->Next(); |
588 // Filter out default settings. | 588 // Filter out default settings. |
589 if (rule.primary_pattern == wildcard && | 589 if (rule.primary_pattern == wildcard && |
590 rule.secondary_pattern == wildcard && | 590 rule.secondary_pattern == wildcard && |
591 (provider_type == POLICY_PROVIDER || | 591 (provider_type == POLICY_PROVIDER || |
592 provider_type == DEFAULT_PROVIDER)) { | 592 provider_type == DEFAULT_PROVIDER)) { |
593 continue; | 593 continue; |
594 } | 594 } |
595 settings->push_back(PatternSettingSourceTuple( | 595 settings->push_back(ContentSettingPatternSourceTuple( |
596 rule.primary_pattern, rule.secondary_pattern, | 596 rule.primary_pattern, rule.secondary_pattern, |
597 content_settings::ValueToContentSetting(rule.value.get()), | 597 content_settings::ValueToContentSetting(rule.value.get()), |
598 kProviderNames[provider_type], | 598 kProviderNames[provider_type], |
599 incognito)); | 599 incognito)); |
600 } | 600 } |
601 } | 601 } |
OLD | NEW |