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 ...@@ -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."> <message name="IDS_WEBSITE_SETTINGS_EDIT_TITLE" desc="Title for Website Settings site edit dialog.">
Site settings Site settings
</message> </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."> <message name="IDS_WEBSITE_SETTINGS_LOCATION_DESCRIPTION" desc="Label for granting geolocation permission on the Website Settings single site view dialog.">
Knows device location Knows device location
</message> </message>
......
...@@ -16,7 +16,8 @@ cr.define('options.WebsiteSettings', function() { ...@@ -16,7 +16,8 @@ cr.define('options.WebsiteSettings', function() {
Page.call(this, 'websiteEdit', Page.call(this, 'websiteEdit',
loadTimeData.getString('websitesOptionsPageTabTitle'), loadTimeData.getString('websitesOptionsPageTabTitle'),
'website-settings-edit-page'); 'website-settings-edit-page');
this.permissions = ['geolocation', 'notifications', 'media-stream']; this.permissions = ['geolocation', 'notifications', 'media-stream',
'cookies'];
} }
cr.addSingletonGetter(WebsiteSettingsEditor); cr.addSingletonGetter(WebsiteSettingsEditor);
......
...@@ -34,6 +34,12 @@ ...@@ -34,6 +34,12 @@
<select id="media-stream-select-option" <select id="media-stream-select-option"
class="weaktrl permission-selection-option"></select> class="weaktrl permission-selection-option"></select>
</div> </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> </list>
</div> </div>
<div class="action-area"> <div class="action-area">
......
...@@ -31,9 +31,11 @@ const int kHttpPort = 80; ...@@ -31,9 +31,11 @@ const int kHttpPort = 80;
const int kHttpsPort = 443; const int kHttpsPort = 443;
const char kPreferencesSource[] = "preference"; const char kPreferencesSource[] = "preference";
const char kStorage[] = "storage"; const char kStorage[] = "storage";
const ContentSettingsType kValidTypes[] = {CONTENT_SETTINGS_TYPE_GEOLOCATION, const ContentSettingsType kValidTypes[] = {
CONTENT_SETTINGS_TYPE_NOTIFICATIONS, CONTENT_SETTINGS_TYPE_GEOLOCATION,
CONTENT_SETTINGS_TYPE_MEDIASTREAM}; CONTENT_SETTINGS_TYPE_NOTIFICATIONS,
CONTENT_SETTINGS_TYPE_MEDIASTREAM,
CONTENT_SETTINGS_TYPE_COOKIES};
const size_t kValidTypesLength = arraysize(kValidTypes); const size_t kValidTypesLength = arraysize(kValidTypes);
} // namespace } // namespace
...@@ -59,6 +61,7 @@ void WebsiteSettingsHandler::GetLocalizedValues( ...@@ -59,6 +61,7 @@ void WebsiteSettingsHandler::GetLocalizedValues(
{"websitesLabelMediaStream", IDS_WEBSITE_SETTINGS_TYPE_MEDIASTREAM}, {"websitesLabelMediaStream", IDS_WEBSITE_SETTINGS_TYPE_MEDIASTREAM},
{"websitesLabelNotifications", IDS_WEBSITE_SETTINGS_TYPE_NOTIFICATIONS}, {"websitesLabelNotifications", IDS_WEBSITE_SETTINGS_TYPE_NOTIFICATIONS},
{"websitesLabelStorage", IDS_WEBSITE_SETTINGS_TYPE_STORAGE}, {"websitesLabelStorage", IDS_WEBSITE_SETTINGS_TYPE_STORAGE},
{"websitesCookiesDescription", IDS_WEBSITE_SETTINGS_COOKIES_DESCRIPTION},
{"websitesLocationDescription", {"websitesLocationDescription",
IDS_WEBSITE_SETTINGS_LOCATION_DESCRIPTION}, IDS_WEBSITE_SETTINGS_LOCATION_DESCRIPTION},
{"websitesMediastreamDescription", {"websitesMediastreamDescription",
...@@ -319,6 +322,10 @@ void WebsiteSettingsHandler::HandleSetOriginPermission( ...@@ -319,6 +322,10 @@ void WebsiteSettingsHandler::HandleSetOriginPermission(
ContentSettingsPattern primary_pattern; ContentSettingsPattern primary_pattern;
ContentSettingsPattern secondary_pattern; ContentSettingsPattern secondary_pattern;
switch (settings_type) { 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: case CONTENT_SETTINGS_TYPE_NOTIFICATIONS:
primary_pattern = ContentSettingsPattern::FromURLNoWildcard(last_site_); primary_pattern = ContentSettingsPattern::FromURLNoWildcard(last_site_);
secondary_pattern = ContentSettingsPattern::Wildcard(); secondary_pattern = ContentSettingsPattern::Wildcard();
...@@ -400,6 +407,10 @@ void WebsiteSettingsHandler::GetInfoForOrigin(const GURL& site_url, ...@@ -400,6 +407,10 @@ void WebsiteSettingsHandler::GetInfoForOrigin(const GURL& site_url,
content_settings::ContentSettingToString(CONTENT_SETTING_ALLOW)); content_settings::ContentSettingToString(CONTENT_SETTING_ALLOW));
options->AppendString( options->AppendString(
content_settings::ContentSettingToString(CONTENT_SETTING_BLOCK)); content_settings::ContentSettingToString(CONTENT_SETTING_BLOCK));
if (permission_type == CONTENT_SETTINGS_TYPE_COOKIES) {
options->AppendString(content_settings::ContentSettingToString(
CONTENT_SETTING_SESSION_ONLY));
}
ContentSetting permission; ContentSetting permission;
content_settings::SettingInfo info; 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