summaryrefslogtreecommitdiffstats
path: root/chrome/browser
diff options
context:
space:
mode:
authorjochen@chromium.org <jochen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-07-02 12:09:35 +0000
committerjochen@chromium.org <jochen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-07-02 12:09:35 +0000
commitdcfb5c0db3c898441e6d1e1f38781a488816a0e4 (patch)
treea446debcf6430918e63ae049e46fbbb220274558 /chrome/browser
parenta40c8dbc97b4a8f8499b703300da65fe053e95c2 (diff)
downloadchromium_src-dcfb5c0db3c898441e6d1e1f38781a488816a0e4.zip
chromium_src-dcfb5c0db3c898441e6d1e1f38781a488816a0e4.tar.gz
chromium_src-dcfb5c0db3c898441e6d1e1f38781a488816a0e4.tar.bz2
Add a "session only" policy to the content settings.
session only is treated as allow, but the cookies will expire after this session (the actual code to expire non-html cookies will follow). BUG=47049 TEST=none Review URL: http://codereview.chromium.org/2858018 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@51522 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r--chrome/browser/appcache/chrome_appcache_service.cc4
-rw-r--r--chrome/browser/cocoa/content_exceptions_window_controller.mm4
-rw-r--r--chrome/browser/content_exceptions_table_model.cc2
-rw-r--r--chrome/browser/content_setting_combo_model.cc3
-rw-r--r--chrome/browser/cookie_modal_dialog.cc6
-rw-r--r--chrome/browser/in_process_webkit/dom_storage_area.cc5
-rw-r--r--chrome/browser/net/chrome_cookie_policy.cc2
-rw-r--r--chrome/browser/renderer_host/database_dispatcher_host.cc5
8 files changed, 21 insertions, 10 deletions
diff --git a/chrome/browser/appcache/chrome_appcache_service.cc b/chrome/browser/appcache/chrome_appcache_service.cc
index 1939a16..c2e41a0 100644
--- a/chrome/browser/appcache/chrome_appcache_service.cc
+++ b/chrome/browser/appcache/chrome_appcache_service.cc
@@ -82,8 +82,8 @@ bool ChromeAppCacheService::CanLoadAppCache(const GURL& manifest_url) {
ContentSetting setting = host_contents_settings_map_->GetContentSetting(
manifest_url, CONTENT_SETTINGS_TYPE_COOKIES);
DCHECK(setting != CONTENT_SETTING_DEFAULT);
- return setting == CONTENT_SETTING_ALLOW ||
- setting == CONTENT_SETTING_ASK; // we don't prompt for read access
+ // We don't prompt for read access.
+ return setting != CONTENT_SETTING_BLOCK;
}
int ChromeAppCacheService::CanCreateAppCache(
diff --git a/chrome/browser/cocoa/content_exceptions_window_controller.mm b/chrome/browser/cocoa/content_exceptions_window_controller.mm
index 692fe86..dd7bd55 100644
--- a/chrome/browser/cocoa/content_exceptions_window_controller.mm
+++ b/chrome/browser/cocoa/content_exceptions_window_controller.mm
@@ -130,6 +130,7 @@ const ContentSetting kNoAskSettings[] = { CONTENT_SETTING_ALLOW,
// The settings shown in the combobox if showAsk_ is true;
const ContentSetting kAskSettings[] = { CONTENT_SETTING_ALLOW,
CONTENT_SETTING_ASK,
+ CONTENT_SETTING_SESSION_ONLY,
CONTENT_SETTING_BLOCK };
} // namespace
@@ -504,6 +505,9 @@ static ContentExceptionsWindowController*
return l10n_util::GetNSStringWithFixup(IDS_EXCEPTIONS_BLOCK_BUTTON);
case CONTENT_SETTING_ASK:
return l10n_util::GetNSStringWithFixup(IDS_EXCEPTIONS_ASK_BUTTON);
+ case CONTENT_SETTING_SESSION_ONLY:
+ return l10n_util::GetNSStringWithFixup(
+ IDS_EXCEPTIONS_SESSION_ONLY_BUTTON);
default:
NOTREACHED();
}
diff --git a/chrome/browser/content_exceptions_table_model.cc b/chrome/browser/content_exceptions_table_model.cc
index e32bc81..d7f1bb6 100644
--- a/chrome/browser/content_exceptions_table_model.cc
+++ b/chrome/browser/content_exceptions_table_model.cc
@@ -101,6 +101,8 @@ std::wstring ContentExceptionsTableModel::GetText(int row, int column_id) {
return l10n_util::GetString(IDS_EXCEPTIONS_BLOCK_BUTTON);
case CONTENT_SETTING_ASK:
return l10n_util::GetString(IDS_EXCEPTIONS_ASK_BUTTON);
+ case CONTENT_SETTING_SESSION_ONLY:
+ return l10n_util::GetString(IDS_EXCEPTIONS_SESSION_ONLY_BUTTON);
default:
NOTREACHED();
}
diff --git a/chrome/browser/content_setting_combo_model.cc b/chrome/browser/content_setting_combo_model.cc
index e37c151..c6e990e 100644
--- a/chrome/browser/content_setting_combo_model.cc
+++ b/chrome/browser/content_setting_combo_model.cc
@@ -16,6 +16,7 @@ const ContentSetting kNoAskSettings[] = { CONTENT_SETTING_ALLOW,
// The settings shown in the combobox if show_ask_ is true;
const ContentSetting kAskSettings[] = { CONTENT_SETTING_ALLOW,
CONTENT_SETTING_ASK,
+ CONTENT_SETTING_SESSION_ONLY,
CONTENT_SETTING_BLOCK };
} // namespace
@@ -39,6 +40,8 @@ std::wstring ContentSettingComboModel::GetItemAt(int index) {
return l10n_util::GetString(IDS_EXCEPTIONS_BLOCK_BUTTON);
case CONTENT_SETTING_ASK:
return l10n_util::GetString(IDS_EXCEPTIONS_ASK_BUTTON);
+ case CONTENT_SETTING_SESSION_ONLY:
+ return l10n_util::GetString(IDS_EXCEPTIONS_SESSION_ONLY_BUTTON);
default:
NOTREACHED();
}
diff --git a/chrome/browser/cookie_modal_dialog.cc b/chrome/browser/cookie_modal_dialog.cc
index 575ace5..b83e93e 100644
--- a/chrome/browser/cookie_modal_dialog.cc
+++ b/chrome/browser/cookie_modal_dialog.cc
@@ -86,8 +86,9 @@ bool CookiePromptModalDialog::IsValid() {
origin_, CONTENT_SETTINGS_TYPE_COOKIES);
if (content_setting != CONTENT_SETTING_ASK) {
if (content_setting == CONTENT_SETTING_ALLOW) {
- // If it's remembered as allow, then we assume session_expire is false.
AllowSiteData(false, false);
+ } else if (content_setting == CONTENT_SETTING_SESSION_ONLY) {
+ AllowSiteData(false, true);
} else {
DCHECK(content_setting == CONTENT_SETTING_BLOCK);
BlockSiteData(false);
@@ -107,7 +108,8 @@ void CookiePromptModalDialog::AllowSiteData(bool remember,
CONTENT_SETTINGS_TYPE_COOKIES, CONTENT_SETTING_DEFAULT);
host_content_settings_map_->SetContentSetting(
HostContentSettingsMap::Pattern::FromURL(origin_),
- CONTENT_SETTINGS_TYPE_COOKIES, CONTENT_SETTING_ALLOW);
+ CONTENT_SETTINGS_TYPE_COOKIES,
+ session_expire ? CONTENT_SETTING_SESSION_ONLY : CONTENT_SETTING_ALLOW);
}
if (delegate_) {
diff --git a/chrome/browser/in_process_webkit/dom_storage_area.cc b/chrome/browser/in_process_webkit/dom_storage_area.cc
index a0ef9b9..6aefa21 100644
--- a/chrome/browser/in_process_webkit/dom_storage_area.cc
+++ b/chrome/browser/in_process_webkit/dom_storage_area.cc
@@ -113,8 +113,5 @@ bool DOMStorageArea::CheckContentSetting(
content_setting = request.WaitOnResponse();
}
- if (content_setting == CONTENT_SETTING_ALLOW)
- return true;
- DCHECK(content_setting == CONTENT_SETTING_BLOCK);
- return false;
+ return (content_setting != CONTENT_SETTING_BLOCK);
}
diff --git a/chrome/browser/net/chrome_cookie_policy.cc b/chrome/browser/net/chrome_cookie_policy.cc
index a3d583a..552fec7 100644
--- a/chrome/browser/net/chrome_cookie_policy.cc
+++ b/chrome/browser/net/chrome_cookie_policy.cc
@@ -144,6 +144,8 @@ int ChromeCookiePolicy::CheckPolicy(const GURL& url) const {
return net::ERR_ACCESS_DENIED;
if (setting == CONTENT_SETTING_ALLOW)
return net::OK;
+ if (setting == CONTENT_SETTING_SESSION_ONLY)
+ return net::OK_FOR_SESSION_ONLY;
return net::ERR_IO_PENDING; // Need to prompt.
}
diff --git a/chrome/browser/renderer_host/database_dispatcher_host.cc b/chrome/browser/renderer_host/database_dispatcher_host.cc
index eb51fb9..8973881 100644
--- a/chrome/browser/renderer_host/database_dispatcher_host.cc
+++ b/chrome/browser/renderer_host/database_dispatcher_host.cc
@@ -421,9 +421,10 @@ void DatabaseDispatcherHost::OnAllowDatabase(const std::string& origin_url,
void DatabaseDispatcherHost::AllowDatabaseResponse(
IPC::Message* reply_msg, ContentSetting content_setting) {
DCHECK((content_setting == CONTENT_SETTING_ALLOW) ||
- (content_setting == CONTENT_SETTING_BLOCK));
+ (content_setting == CONTENT_SETTING_BLOCK) ||
+ (content_setting == CONTENT_SETTING_SESSION_ONLY));
ViewHostMsg_AllowDatabase::WriteReplyParams(
- reply_msg, content_setting == CONTENT_SETTING_ALLOW);
+ reply_msg, content_setting != CONTENT_SETTING_BLOCK);
Send(reply_msg);
}