Chromium Code Reviews| 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 <list> | 7 #include <list> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 224 const GURL& secondary_url, | 224 const GURL& secondary_url, |
| 225 ContentSettingsType content_type, | 225 ContentSettingsType content_type, |
| 226 const std::string& resource_identifier) const { | 226 const std::string& resource_identifier) const { |
| 227 DCHECK_NE(CONTENT_SETTINGS_TYPE_COOKIES, content_type); | 227 DCHECK_NE(CONTENT_SETTINGS_TYPE_COOKIES, content_type); |
| 228 DCHECK_NE(content_settings::RequiresResourceIdentifier(content_type), | 228 DCHECK_NE(content_settings::RequiresResourceIdentifier(content_type), |
| 229 resource_identifier.empty()); | 229 resource_identifier.empty()); |
| 230 return GetContentSettingInternal( | 230 return GetContentSettingInternal( |
| 231 primary_url, secondary_url, content_type, resource_identifier); | 231 primary_url, secondary_url, content_type, resource_identifier); |
| 232 } | 232 } |
| 233 | 233 |
| 234 Value* HostContentSettingsMap::GetContentSettingValue( | |
| 235 const GURL& primary_url, | |
| 236 const GURL& secondary_url, | |
| 237 ContentSettingsType content_type, | |
| 238 const std::string& resource_identifier) const { | |
| 239 if (ShouldAllowAllContent(secondary_url, content_type)) | |
| 240 return Value::CreateIntegerValue(CONTENT_SETTING_ALLOW); | |
| 241 | |
| 242 // Iterate through the list of providers and break when the first non NULL | |
| 243 // value is returned. | |
| 244 Value* value = NULL; | |
|
wtc
2011/09/01 22:42:34
Nit: move the declaration of |value| inside the fo
markusheintz_
2011/09/02 14:55:59
Done.
| |
| 245 for (ConstProviderIterator provider = content_settings_providers_.begin(); | |
| 246 provider != content_settings_providers_.end(); | |
| 247 ++provider) { | |
| 248 value= (*provider)->GetContentSettingValue( | |
|
Pam (message me for reviews)
2011/09/02 11:05:29
Nit: space before =
markusheintz_
2011/09/02 14:55:59
Done.
| |
| 249 primary_url, secondary_url, content_type, resource_identifier); | |
| 250 if (value) | |
| 251 return value; | |
| 252 } | |
| 253 | |
| 254 // TODO(markusheintz): Add a comment. | |
|
Pam (message me for reviews)
2011/09/02 11:05:29
Please do todo.
markusheintz_
2011/09/02 14:55:59
Done.
| |
| 255 if (content_type == CONTENT_SETTINGS_TYPE_AUTO_SELECT_CERTIFICATE) | |
| 256 return NULL; | |
| 257 return Value::CreateIntegerValue(GetDefaultContentSetting(content_type)); | |
|
wtc
2011/09/01 22:42:34
It seems like you have four cases in this function
markusheintz_
2011/09/02 14:55:59
I added some comments. I hope they answer you ques
| |
| 258 } | |
| 259 | |
| 234 ContentSetting HostContentSettingsMap::GetContentSettingInternal( | 260 ContentSetting HostContentSettingsMap::GetContentSettingInternal( |
| 235 const GURL& primary_url, | 261 const GURL& primary_url, |
| 236 const GURL& secondary_url, | 262 const GURL& secondary_url, |
| 237 ContentSettingsType content_type, | 263 ContentSettingsType content_type, |
| 238 const std::string& resource_identifier) const { | 264 const std::string& resource_identifier) const { |
| 239 ContentSetting setting = GetNonDefaultContentSetting( | 265 ContentSetting setting = GetNonDefaultContentSetting( |
| 240 primary_url, secondary_url, content_type, resource_identifier); | 266 primary_url, secondary_url, content_type, resource_identifier); |
| 241 if (setting == CONTENT_SETTING_DEFAULT) | 267 if (setting == CONTENT_SETTING_DEFAULT) |
| 242 return GetDefaultContentSetting(content_type); | 268 return GetDefaultContentSetting(content_type); |
| 243 return setting; | 269 return setting; |
| (...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 543 SetDefaultContentSetting(CONTENT_SETTINGS_TYPE_COOKIES, | 569 SetDefaultContentSetting(CONTENT_SETTINGS_TYPE_COOKIES, |
| 544 (cookie_behavior == net::StaticCookiePolicy::BLOCK_ALL_COOKIES) ? | 570 (cookie_behavior == net::StaticCookiePolicy::BLOCK_ALL_COOKIES) ? |
| 545 CONTENT_SETTING_BLOCK : CONTENT_SETTING_ALLOW); | 571 CONTENT_SETTING_BLOCK : CONTENT_SETTING_ALLOW); |
| 546 } | 572 } |
| 547 if (!prefs_->HasPrefPath(prefs::kBlockThirdPartyCookies)) { | 573 if (!prefs_->HasPrefPath(prefs::kBlockThirdPartyCookies)) { |
| 548 SetBlockThirdPartyCookies(cookie_behavior == | 574 SetBlockThirdPartyCookies(cookie_behavior == |
| 549 net::StaticCookiePolicy::BLOCK_SETTING_THIRD_PARTY_COOKIES); | 575 net::StaticCookiePolicy::BLOCK_SETTING_THIRD_PARTY_COOKIES); |
| 550 } | 576 } |
| 551 } | 577 } |
| 552 } | 578 } |
| OLD | NEW |