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

Side by Side Diff: chrome/browser/content_settings/host_content_settings_map.cc

Issue 8462003: Exempt chrome-extension:// from third-party cookie rules, but not from regular content settings (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: updates Created 9 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/content_settings/host_content_settings_map.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 const GURL& primary_url, 177 const GURL& primary_url,
178 const GURL& secondary_url, 178 const GURL& secondary_url,
179 ContentSettingsType content_type, 179 ContentSettingsType content_type,
180 const std::string& resource_identifier, 180 const std::string& resource_identifier,
181 ContentSettingsPattern* primary_pattern, 181 ContentSettingsPattern* primary_pattern,
182 ContentSettingsPattern* secondary_pattern) const { 182 ContentSettingsPattern* secondary_pattern) const {
183 DCHECK(content_settings::SupportsResourceIdentifier(content_type) || 183 DCHECK(content_settings::SupportsResourceIdentifier(content_type) ||
184 resource_identifier.empty()); 184 resource_identifier.empty());
185 185
186 // Check if the scheme of the requesting url is whitelisted. 186 // Check if the scheme of the requesting url is whitelisted.
187 if (ShouldAllowAllContent(secondary_url, content_type)) 187 if (ShouldAllowAllContent(primary_url, secondary_url, content_type))
188 return Value::CreateIntegerValue(CONTENT_SETTING_ALLOW); 188 return Value::CreateIntegerValue(CONTENT_SETTING_ALLOW);
189 189
190 // The list of |content_settings_providers_| is ordered according to their 190 // The list of |content_settings_providers_| is ordered according to their
191 // precedence. 191 // precedence.
192 for (ConstProviderIterator provider = content_settings_providers_.begin(); 192 for (ConstProviderIterator provider = content_settings_providers_.begin();
193 provider != content_settings_providers_.end(); 193 provider != content_settings_providers_.end();
194 ++provider) { 194 ++provider) {
195 base::Value* value = content_settings::GetContentSettingValueAndPatterns( 195 base::Value* value = content_settings::GetContentSettingValueAndPatterns(
196 provider->second, primary_url, secondary_url, content_type, 196 provider->second, primary_url, secondary_url, content_type,
197 resource_identifier, is_off_the_record_, 197 resource_identifier, is_off_the_record_,
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
398 const content_settings::Rule& rule = rule_iterator->Next(); 398 const content_settings::Rule& rule = rule_iterator->Next();
399 settings->push_back(ContentSettingPatternSource( 399 settings->push_back(ContentSettingPatternSource(
400 rule.primary_pattern, rule.secondary_pattern, 400 rule.primary_pattern, rule.secondary_pattern,
401 content_settings::ValueToContentSetting(rule.value.get()), 401 content_settings::ValueToContentSetting(rule.value.get()),
402 kProviderNames[provider_type], 402 kProviderNames[provider_type],
403 incognito)); 403 incognito));
404 } 404 }
405 } 405 }
406 406
407 bool HostContentSettingsMap::ShouldAllowAllContent( 407 bool HostContentSettingsMap::ShouldAllowAllContent(
408 const GURL& first_party_url,
Bernhard Bauer 2011/11/04 12:12:42 I think we should swap these parameters, no? IIRC
jochen (gone - plz use gerrit) 2011/11/04 12:24:25 I still don't like this primary/secondary naming s
408 const GURL& url, 409 const GURL& url,
409 ContentSettingsType content_type) { 410 ContentSettingsType content_type) {
410 if (content_type == CONTENT_SETTINGS_TYPE_NOTIFICATIONS) 411 if (content_type == CONTENT_SETTINGS_TYPE_NOTIFICATIONS)
411 return false; 412 return false;
413 if (url.SchemeIs(chrome::kExtensionScheme)) {
414 return content_type != CONTENT_SETTINGS_TYPE_COOKIES ||
415 first_party_url.SchemeIs(chrome::kExtensionScheme);
416 }
412 return url.SchemeIs(chrome::kChromeDevToolsScheme) || 417 return url.SchemeIs(chrome::kChromeDevToolsScheme) ||
413 url.SchemeIs(chrome::kChromeInternalScheme) || 418 url.SchemeIs(chrome::kChromeInternalScheme) ||
414 url.SchemeIs(chrome::kChromeUIScheme) || 419 url.SchemeIs(chrome::kChromeUIScheme);
415 url.SchemeIs(chrome::kExtensionScheme);
416 } 420 }
OLDNEW
« no previous file with comments | « chrome/browser/content_settings/host_content_settings_map.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698