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 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
309 ContentSettingsType(j), | 309 ContentSettingsType(j), |
310 std::string()); | 310 std::string()); |
311 } | 311 } |
312 } | 312 } |
313 return output; | 313 return output; |
314 } | 314 } |
315 | 315 |
316 void HostContentSettingsMap::GetSettingsForOneType( | 316 void HostContentSettingsMap::GetSettingsForOneType( |
317 ContentSettingsType content_type, | 317 ContentSettingsType content_type, |
318 const std::string& resource_identifier, | 318 const std::string& resource_identifier, |
319 SettingsForOneType* settings) const { | 319 ContentSettingsForOneType* settings) const { |
320 DCHECK(content_settings::SupportsResourceIdentifier(content_type) || | 320 DCHECK(content_settings::SupportsResourceIdentifier(content_type) || |
321 resource_identifier.empty()); | 321 resource_identifier.empty()); |
322 DCHECK(settings); | 322 DCHECK(settings); |
323 | 323 |
324 settings->clear(); | 324 settings->clear(); |
325 for (ConstProviderIterator provider = content_settings_providers_.begin(); | 325 for (ConstProviderIterator provider = content_settings_providers_.begin(); |
326 provider != content_settings_providers_.end(); | 326 provider != content_settings_providers_.end(); |
327 ++provider) { | 327 ++provider) { |
328 // For each provider, iterate first the incognito-specific rules, then the | 328 // For each provider, iterate first the incognito-specific rules, then the |
329 // normal rules. | 329 // normal rules. |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
545 net::StaticCookiePolicy::BLOCK_SETTING_THIRD_PARTY_COOKIES); | 545 net::StaticCookiePolicy::BLOCK_SETTING_THIRD_PARTY_COOKIES); |
546 } | 546 } |
547 } | 547 } |
548 } | 548 } |
549 | 549 |
550 void HostContentSettingsMap::AddSettingsForOneType( | 550 void HostContentSettingsMap::AddSettingsForOneType( |
551 const content_settings::ProviderInterface* provider, | 551 const content_settings::ProviderInterface* provider, |
552 ProviderType provider_type, | 552 ProviderType provider_type, |
553 ContentSettingsType content_type, | 553 ContentSettingsType content_type, |
554 const std::string& resource_identifier, | 554 const std::string& resource_identifier, |
555 SettingsForOneType* settings, | 555 ContentSettingsForOneType* settings, |
556 bool incognito) const { | 556 bool incognito) const { |
557 scoped_ptr<content_settings::RuleIterator> rule_iterator( | 557 scoped_ptr<content_settings::RuleIterator> rule_iterator( |
558 provider->GetRuleIterator(content_type, | 558 provider->GetRuleIterator(content_type, |
559 resource_identifier, | 559 resource_identifier, |
560 incognito)); | 560 incognito)); |
561 ContentSettingsPattern wildcard = ContentSettingsPattern::Wildcard(); | 561 ContentSettingsPattern wildcard = ContentSettingsPattern::Wildcard(); |
562 while (rule_iterator->HasNext()) { | 562 while (rule_iterator->HasNext()) { |
563 const content_settings::Rule& rule = rule_iterator->Next(); | 563 const content_settings::Rule& rule = rule_iterator->Next(); |
564 settings->push_back(PatternSettingSourceTuple( | 564 settings->push_back(ContentSettingPatternSource( |
565 rule.primary_pattern, rule.secondary_pattern, | 565 rule.primary_pattern, rule.secondary_pattern, |
566 content_settings::ValueToContentSetting(rule.value.get()), | 566 content_settings::ValueToContentSetting(rule.value.get()), |
567 kProviderNames[provider_type], | 567 kProviderNames[provider_type], |
568 incognito)); | 568 incognito)); |
569 } | 569 } |
570 } | 570 } |
OLD | NEW |