Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(212)

Side by Side Diff: components/content_settings/core/browser/host_content_settings_map.cc

Issue 1575623002: Disable Web Notifications in Incognito (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@permfix
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/host_content_settings_map.h" 5 #include "components/content_settings/core/browser/host_content_settings_map.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <utility> 9 #include <utility>
10 10
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 bool SupportsResourceIdentifier(ContentSettingsType content_type) { 64 bool SupportsResourceIdentifier(ContentSettingsType content_type) {
65 return content_type == CONTENT_SETTINGS_TYPE_PLUGINS; 65 return content_type == CONTENT_SETTINGS_TYPE_PLUGINS;
66 } 66 }
67 67
68 bool SchemeCanBeWhitelisted(const std::string& scheme) { 68 bool SchemeCanBeWhitelisted(const std::string& scheme) {
69 return scheme == content_settings::kChromeDevToolsScheme || 69 return scheme == content_settings::kChromeDevToolsScheme ||
70 scheme == content_settings::kExtensionScheme || 70 scheme == content_settings::kExtensionScheme ||
71 scheme == content_settings::kChromeUIScheme; 71 scheme == content_settings::kChromeUIScheme;
72 } 72 }
73 73
74 // Prevents content settings marked INHERIT_IN_INCOGNITO_EXCEPT_ALLOW from 74 // Prevents content settings marked INHERIT_IN_INCOGNITO_EXCEPT_ALLOW or
75 // inheriting CONTENT_SETTING_ALLOW settings from regular to incognito. 75 // DENY_IN_INCOGNITO_AFTER_DELAY from inheriting CONTENT_SETTING_ALLOW settings
76 // from regular to incognito.
76 scoped_ptr<base::Value> CoerceSettingInheritedToIncognito( 77 scoped_ptr<base::Value> CoerceSettingInheritedToIncognito(
77 ContentSettingsType content_type, 78 ContentSettingsType content_type,
78 scoped_ptr<base::Value> value) { 79 scoped_ptr<base::Value> value) {
79 const content_settings::ContentSettingsInfo* info = 80 const content_settings::ContentSettingsInfo* info =
80 content_settings::ContentSettingsRegistry::GetInstance()->Get( 81 content_settings::ContentSettingsRegistry::GetInstance()->Get(
81 content_type); 82 content_type);
82 if (!info) 83 if (!info ||
84 info->incognito_behavior() ==
85 content_settings::ContentSettingsInfo::INHERIT_IN_INCOGNITO) {
83 return value; 86 return value;
84 if (info->incognito_behavior() != 87 }
85 content_settings::ContentSettingsInfo::INHERIT_IN_INCOGNITO_EXCEPT_ALLOW)
86 return value;
87 ContentSetting setting = content_settings::ValueToContentSetting(value.get()); 88 ContentSetting setting = content_settings::ValueToContentSetting(value.get());
88 if (setting != CONTENT_SETTING_ALLOW) 89 if (setting != CONTENT_SETTING_ALLOW)
89 return value; 90 return value;
90 DCHECK(info->IsSettingValid(CONTENT_SETTING_ASK)); 91 DCHECK(info->IsSettingValid(CONTENT_SETTING_ASK));
91 return content_settings::ContentSettingToValue(CONTENT_SETTING_ASK); 92 return content_settings::ContentSettingToValue(CONTENT_SETTING_ASK);
92 } 93 }
93 94
94 } // namespace 95 } // namespace
95 96
96 HostContentSettingsMap::HostContentSettingsMap(PrefService* prefs, 97 HostContentSettingsMap::HostContentSettingsMap(PrefService* prefs,
(...skipping 650 matching lines...) Expand 10 before | Expand all | Expand 10 after
747 rule.secondary_pattern.Matches(secondary_url)) { 748 rule.secondary_pattern.Matches(secondary_url)) {
748 if (primary_pattern) 749 if (primary_pattern)
749 *primary_pattern = rule.primary_pattern; 750 *primary_pattern = rule.primary_pattern;
750 if (secondary_pattern) 751 if (secondary_pattern)
751 *secondary_pattern = rule.secondary_pattern; 752 *secondary_pattern = rule.secondary_pattern;
752 return make_scoped_ptr(rule.value.get()->DeepCopy()); 753 return make_scoped_ptr(rule.value.get()->DeepCopy());
753 } 754 }
754 } 755 }
755 return scoped_ptr<base::Value>(); 756 return scoped_ptr<base::Value>();
756 } 757 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698