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 "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/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
286 secondary_pattern, | 286 secondary_pattern, |
287 content_type, | 287 content_type, |
288 resource_identifier, | 288 resource_identifier, |
289 value)) { | 289 value)) { |
290 return; | 290 return; |
291 } | 291 } |
292 } | 292 } |
293 NOTREACHED(); | 293 NOTREACHED(); |
294 } | 294 } |
295 | 295 |
296 void HostContentSettingsMap::SetNarrowestWebsiteSetting( | |
297 const ContentSettingsPattern& primary_pattern, | |
298 const ContentSettingsPattern& secondary_pattern, | |
299 ContentSettingsType content_type, | |
300 const std::string& resource_identifier, | |
301 ContentSetting setting, | |
302 content_settings::SettingInfo existing_info) { | |
303 ContentSettingsPattern narrow_primary = primary_pattern; | |
304 ContentSettingsPattern narrow_secondary = secondary_pattern; | |
305 | |
306 DCHECK_EQ(existing_info.source, content_settings::SETTING_SOURCE_USER); | |
Bernhard Bauer
2014/08/15 17:13:04
If you swap the arguments, the error message on fa
Daniel Nishi
2014/08/15 17:33:46
Done.
| |
307 ContentSettingsPattern::Relation r1 = | |
308 existing_info.primary_pattern.Compare(primary_pattern); | |
309 if (r1 == ContentSettingsPattern::PREDECESSOR) { | |
310 narrow_primary = existing_info.primary_pattern; | |
311 } else if (r1 == ContentSettingsPattern::IDENTITY) { | |
312 ContentSettingsPattern::Relation r2 = | |
313 existing_info.secondary_pattern.Compare(secondary_pattern); | |
314 DCHECK(r2 != ContentSettingsPattern::DISJOINT_ORDER_POST && | |
315 r2 != ContentSettingsPattern::DISJOINT_ORDER_PRE); | |
316 if (r2 == ContentSettingsPattern::PREDECESSOR) | |
317 narrow_secondary = existing_info.secondary_pattern; | |
318 } | |
319 | |
320 SetContentSetting( | |
321 narrow_primary, narrow_secondary, content_type, std::string(), setting); | |
322 } | |
323 | |
296 void HostContentSettingsMap::SetContentSetting( | 324 void HostContentSettingsMap::SetContentSetting( |
297 const ContentSettingsPattern& primary_pattern, | 325 const ContentSettingsPattern& primary_pattern, |
298 const ContentSettingsPattern& secondary_pattern, | 326 const ContentSettingsPattern& secondary_pattern, |
299 ContentSettingsType content_type, | 327 ContentSettingsType content_type, |
300 const std::string& resource_identifier, | 328 const std::string& resource_identifier, |
301 ContentSetting setting) { | 329 ContentSetting setting) { |
302 DCHECK(!ContentTypeHasCompoundValue(content_type)); | 330 DCHECK(!ContentTypeHasCompoundValue(content_type)); |
303 | 331 |
304 if (setting == CONTENT_SETTING_ALLOW && | 332 if (setting == CONTENT_SETTING_ALLOW && |
305 (content_type == CONTENT_SETTINGS_TYPE_GEOLOCATION || | 333 (content_type == CONTENT_SETTINGS_TYPE_GEOLOCATION || |
(...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
728 } | 756 } |
729 | 757 |
730 NOTREACHED(); | 758 NOTREACHED(); |
731 return DEFAULT_PROVIDER; | 759 return DEFAULT_PROVIDER; |
732 } | 760 } |
733 | 761 |
734 content_settings::PrefProvider* HostContentSettingsMap::GetPrefProvider() { | 762 content_settings::PrefProvider* HostContentSettingsMap::GetPrefProvider() { |
735 return static_cast<content_settings::PrefProvider*>( | 763 return static_cast<content_settings::PrefProvider*>( |
736 content_settings_providers_[PREF_PROVIDER]); | 764 content_settings_providers_[PREF_PROVIDER]); |
737 } | 765 } |
OLD | NEW |