Commit 65ba59b3 authored by dhnishi's avatar dhnishi Committed by Commit bot

Add Cookie permission to Website Settings single side view.

BUG=372607

Review URL: https://codereview.chromium.org/504773004

Cr-Commit-Position: refs/heads/master@{#291966}
parent 7707e972
......@@ -7959,6 +7959,9 @@ Keep your key file in a safe place. You will need it to create new versions of y
<message name="IDS_WEBSITE_SETTINGS_EDIT_TITLE" desc="Title for Website Settings site edit dialog.">
Site settings
</message>
<message name="IDS_WEBSITE_SETTINGS_COOKIES_DESCRIPTION" desc="Label for granting cookies permission on the Website Settings single site view dialog.">
Stores data
</message>
<message name="IDS_WEBSITE_SETTINGS_LOCATION_DESCRIPTION" desc="Label for granting geolocation permission on the Website Settings single site view dialog.">
Knows device location
</message>
......
......@@ -16,7 +16,8 @@ cr.define('options.WebsiteSettings', function() {
Page.call(this, 'websiteEdit',
loadTimeData.getString('websitesOptionsPageTabTitle'),
'website-settings-edit-page');
this.permissions = ['geolocation', 'notifications', 'media-stream'];
this.permissions = ['geolocation', 'notifications', 'media-stream',
'cookies'];
}
cr.addSingletonGetter(WebsiteSettingsEditor);
......
......@@ -34,6 +34,12 @@
<select id="media-stream-select-option"
class="weaktrl permission-selection-option"></select>
</div>
<div class="permission-option">
<span class="permission-name"
i18n-content="websitesCookiesDescription"></span>
<select id="cookies-select-option"
class="weaktrl permission-selection-option"></select>
</div>
</list>
</div>
<div class="action-area">
......
......@@ -31,9 +31,11 @@ const int kHttpPort = 80;
const int kHttpsPort = 443;
const char kPreferencesSource[] = "preference";
const char kStorage[] = "storage";
const ContentSettingsType kValidTypes[] = {CONTENT_SETTINGS_TYPE_GEOLOCATION,
CONTENT_SETTINGS_TYPE_NOTIFICATIONS,
CONTENT_SETTINGS_TYPE_MEDIASTREAM};
const ContentSettingsType kValidTypes[] = {
CONTENT_SETTINGS_TYPE_GEOLOCATION,
CONTENT_SETTINGS_TYPE_NOTIFICATIONS,
CONTENT_SETTINGS_TYPE_MEDIASTREAM,
CONTENT_SETTINGS_TYPE_COOKIES};
const size_t kValidTypesLength = arraysize(kValidTypes);
} // namespace
......@@ -59,6 +61,7 @@ void WebsiteSettingsHandler::GetLocalizedValues(
{"websitesLabelMediaStream", IDS_WEBSITE_SETTINGS_TYPE_MEDIASTREAM},
{"websitesLabelNotifications", IDS_WEBSITE_SETTINGS_TYPE_NOTIFICATIONS},
{"websitesLabelStorage", IDS_WEBSITE_SETTINGS_TYPE_STORAGE},
{"websitesCookiesDescription", IDS_WEBSITE_SETTINGS_COOKIES_DESCRIPTION},
{"websitesLocationDescription",
IDS_WEBSITE_SETTINGS_LOCATION_DESCRIPTION},
{"websitesMediastreamDescription",
......@@ -319,6 +322,10 @@ void WebsiteSettingsHandler::HandleSetOriginPermission(
ContentSettingsPattern primary_pattern;
ContentSettingsPattern secondary_pattern;
switch (settings_type) {
case CONTENT_SETTINGS_TYPE_COOKIES:
primary_pattern = ContentSettingsPattern::FromURLNoWildcard(last_site_);
secondary_pattern = ContentSettingsPattern::FromURLNoWildcard(last_site_);
break;
case CONTENT_SETTINGS_TYPE_NOTIFICATIONS:
primary_pattern = ContentSettingsPattern::FromURLNoWildcard(last_site_);
secondary_pattern = ContentSettingsPattern::Wildcard();
......@@ -400,6 +407,10 @@ void WebsiteSettingsHandler::GetInfoForOrigin(const GURL& site_url,
content_settings::ContentSettingToString(CONTENT_SETTING_ALLOW));
options->AppendString(
content_settings::ContentSettingToString(CONTENT_SETTING_BLOCK));
if (permission_type == CONTENT_SETTINGS_TYPE_COOKIES) {
options->AppendString(content_settings::ContentSettingToString(
CONTENT_SETTING_SESSION_ONLY));
}
ContentSetting permission;
content_settings::SettingInfo info;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment