Bug 1201398 - Web Notification management interface. r=MattN,dolske

This commit is contained in:
Jared Wein 2015-10-02 18:37:19 -04:00
parent 15c74d3a3b
commit ca08287ee7
4 changed files with 53 additions and 0 deletions

View File

@ -32,6 +32,8 @@ var gContentPane = {
setEventListener("font.language.group", "change",
gContentPane._rebuildFonts);
setEventListener("notificationsPolicyButton", "command",
gContentPane.showNotificationExceptions);
setEventListener("popupPolicyButton", "command",
gContentPane.showPopupExceptions);
setEventListener("advancedFonts", "command",
@ -83,6 +85,28 @@ var gContentPane = {
* - true if popups are blocked by default, false otherwise
*/
// NOTIFICATIONS
/**
* Displays the notifications exceptions dialog where specific site notification
* preferences can be set.
*/
showNotificationExceptions()
{
let bundlePreferences = document.getElementById("bundlePreferences");
let params = { blockVisible: true,
sessionVisible: false,
allowVisible: true,
prefilledHost: "",
permissionType: "desktop-notification" };
params.windowTitle = bundlePreferences.getString("notificationspermissionstitle");
params.introText = bundlePreferences.getString("notificationspermissionstext");
gSubDialog.open("chrome://browser/content/preferences/permissions.xul",
"resizable=yes", params);
},
// POP-UPS
/**

View File

@ -60,6 +60,27 @@
</grid>
</groupbox>
<groupbox id="notificationsGroup" data-category="paneContent" hidden="true">
<caption><label>&notificationsPolicy.label;</label></caption>
<grid>
<columns>
<column flex="1"/>
<column/>
</columns>
<rows>
<row id="notificationsPolicyRow">
<vbox align="start">
<label id="notificationsPolicy">&notificationsPolicyDesc.label;</label>
</vbox>
<hbox pack="end">
<button id="notificationsPolicyButton" label="&notificationsPolicyButton.label;"
accesskey="&notificationsPolicyButton.accesskey;"/>
</hbox>
</row>
</rows>
</grid>
</groupbox>
<groupbox id="miscGroup" data-category="paneContent" hidden="true">
<caption><label>&popups.label;</label></caption>
<grid id="contentGrid">

View File

@ -6,6 +6,12 @@
<!ENTITY blockPopups.label "Block pop-up windows">
<!ENTITY blockPopups.accesskey "B">
<!ENTITY notificationsPolicy.label "Notifications">
<!ENTITY notificationsPolicyDesc.label "Choose which sites are allowed to show notifications">
<!ENTITY notificationsPolicyButton.accesskey "h">
<!ENTITY notificationsPolicyButton.label "Choose…">
<!ENTITY popupExceptions.label "Exceptions…">
<!ENTITY popupExceptions.accesskey "E">

View File

@ -25,6 +25,8 @@ addonspermissionstext=You can specify which websites are allowed to install add-
addons_permissions_title=Allowed Sites - Add-ons Installation
popuppermissionstext=You can specify which websites are allowed to open pop-up windows. Type the exact address of the site you want to allow and then click Allow.
popuppermissionstitle=Allowed Sites - Pop-ups
notificationspermissionstext=You can specify which websites are always or never allowed to show notifications. Type the exact address of the site you want to manage and then click Block or Allow.
notificationspermissionstitle=Notification Permissions
invalidURI=Please enter a valid hostname
invalidURITitle=Invalid Hostname Entered