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

Unified Diff: chrome/browser/ui/content_settings/content_setting_bubble_model.cc

Issue 7713034: HostContentSettingsMap refactoring. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Code review comments. Created 9 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/content_settings/content_setting_bubble_model.cc
diff --git a/chrome/browser/ui/content_settings/content_setting_bubble_model.cc b/chrome/browser/ui/content_settings/content_setting_bubble_model.cc
index fa182726f2de3da0102fb1330db14ba591f6e745..6d50cababc7ca09eaaede0974b93c7698095d267 100644
--- a/chrome/browser/ui/content_settings/content_setting_bubble_model.cc
+++ b/chrome/browser/ui/content_settings/content_setting_bubble_model.cc
@@ -6,6 +6,8 @@
#include "base/command_line.h"
#include "base/utf_string_conversions.h"
+#include "chrome/browser/content_settings/cookie_settings.h"
+#include "chrome/browser/content_settings/cookie_settings_factory.h"
#include "chrome/browser/content_settings/host_content_settings_map.h"
#include "chrome/browser/content_settings/tab_specific_content_settings.h"
#include "chrome/browser/favicon/favicon_tab_helper.h"
@@ -253,14 +255,25 @@ class ContentSettingSingleRadioGroup
radio_group.radio_items.push_back(radio_allow_label);
radio_group.radio_items.push_back(radio_block_label);
HostContentSettingsMap* map = profile()->GetHostContentSettingsMap();
- ContentSetting mostRestrictiveSetting;
+ CookieSettings* cookie_settings =
+ CookieSettingsFactory::GetForProfile(profile());
+ ContentSetting most_restrictive_setting;
if (resources.empty()) {
- mostRestrictiveSetting =
- content_type() == CONTENT_SETTINGS_TYPE_COOKIES ?
- map->GetCookieContentSetting(url, url, true) :
- map->GetContentSetting(url, url, content_type(), std::string());
+ if (content_type() == CONTENT_SETTINGS_TYPE_COOKIES) {
+ if (cookie_settings->IsSettingCookieAllowed(url, url)) {
+ if (cookie_settings->IsCookieSessionOnly(url))
+ most_restrictive_setting = CONTENT_SETTING_SESSION_ONLY;
+ else
+ most_restrictive_setting = CONTENT_SETTING_ALLOW;
+ } else {
+ most_restrictive_setting = CONTENT_SETTING_BLOCK;
+ }
+ } else {
+ most_restrictive_setting =
+ map->GetContentSetting(url, url, content_type(), std::string());
+ }
} else {
- mostRestrictiveSetting = CONTENT_SETTING_ALLOW;
+ most_restrictive_setting = CONTENT_SETTING_ALLOW;
for (std::set<std::string>::const_iterator it = resources.begin();
it != resources.end(); ++it) {
ContentSetting setting = map->GetContentSetting(url,
@@ -268,19 +281,19 @@ class ContentSettingSingleRadioGroup
content_type(),
*it);
if (setting == CONTENT_SETTING_BLOCK) {
- mostRestrictiveSetting = CONTENT_SETTING_BLOCK;
+ most_restrictive_setting = CONTENT_SETTING_BLOCK;
break;
}
if (setting == CONTENT_SETTING_ASK)
- mostRestrictiveSetting = CONTENT_SETTING_ASK;
+ most_restrictive_setting = CONTENT_SETTING_ASK;
}
}
- if (mostRestrictiveSetting == CONTENT_SETTING_ALLOW) {
+ if (most_restrictive_setting == CONTENT_SETTING_ALLOW) {
radio_group.default_item = 0;
// |block_setting_| is already set to |CONTENT_SETTING_BLOCK|.
} else {
radio_group.default_item = 1;
- block_setting_ = mostRestrictiveSetting;
+ block_setting_ = most_restrictive_setting;
}
selected_item_ = radio_group.default_item;
set_radio_group(radio_group);

Powered by Google App Engine
This is Rietveld 408576698