diff options
author | janekptacijarabaci <janekptacijarabaci@seznam.cz> | 2018-04-26 06:17:52 +0200 |
---|---|---|
committer | janekptacijarabaci <janekptacijarabaci@seznam.cz> | 2018-04-26 06:17:52 +0200 |
commit | 43caa48ecba88a60b7b0b84d19d928ada8b22b09 (patch) | |
tree | 11eeb7813247332ae621140dab41e6f1ea033b08 /application/palemoon | |
parent | c86fbfd0313ae6bd6c54ea8f4a28b42f7852b38c (diff) | |
download | UXP-43caa48ecba88a60b7b0b84d19d928ada8b22b09.tar UXP-43caa48ecba88a60b7b0b84d19d928ada8b22b09.tar.gz UXP-43caa48ecba88a60b7b0b84d19d928ada8b22b09.tar.lz UXP-43caa48ecba88a60b7b0b84d19d928ada8b22b09.tar.xz UXP-43caa48ecba88a60b7b0b84d19d928ada8b22b09.zip |
Bug 1038811 - Push Notifications - Firefox front end changes for preferences, and permission notification
Diffstat (limited to 'application/palemoon')
22 files changed, 129 insertions, 3 deletions
diff --git a/application/palemoon/app/profile/palemoon.js b/application/palemoon/app/profile/palemoon.js index ee4a95d38..20919eca4 100644 --- a/application/palemoon/app/profile/palemoon.js +++ b/application/palemoon/app/profile/palemoon.js @@ -756,6 +756,7 @@ pref("goanna.handlerService.allowRegisterFromDifferentHost", false); pref("browser.geolocation.warning.infoURL", "http://www.palemoon.org/info-url/geolocation.shtml"); pref("browser.mixedcontent.warning.infoURL", "http://www.palemoon.org/info-url/mixedcontent.shtml"); +pref("browser.push.warning.infoURL", "https://www.mozilla.org/%LOCALE%/firefox/push/"); pref("browser.EULA.version", 3); pref("browser.rights.version", 3); diff --git a/application/palemoon/base/content/browser.xul b/application/palemoon/base/content/browser.xul index c2553f295..6545e0ac2 100644 --- a/application/palemoon/base/content/browser.xul +++ b/application/palemoon/base/content/browser.xul @@ -449,6 +449,7 @@ <box id="notification-popup-box" hidden="true" align="center"> <image id="default-notification-icon" class="notification-anchor-icon" role="button"/> <image id="geo-notification-icon" class="notification-anchor-icon" role="button"/> + <image id="push-notification-icon" class="notification-anchor-icon" role="button"/> <image id="addons-notification-icon" class="notification-anchor-icon" role="button"/> <image id="indexedDB-notification-icon" class="notification-anchor-icon" role="button"/> <image id="password-notification-icon" class="notification-anchor-icon" role="button"/> diff --git a/application/palemoon/components/nsBrowserGlue.js b/application/palemoon/components/nsBrowserGlue.js index 225cddd52..3908ae81f 100644 --- a/application/palemoon/components/nsBrowserGlue.js +++ b/application/palemoon/components/nsBrowserGlue.js @@ -1751,6 +1751,42 @@ ContentPermissionPrompt.prototype = { } }, + _promptPush : function(aRequest) { + var browserBundle = Services.strings.createBundle("chrome://browser/locale/browser.properties"); + var requestingURI = aRequest.principal.URI; + + var message = browserBundle.formatStringFromName("push.enablePush", + [requestingURI.host], 1); + + var actions = [ + { + stringId: "push.alwaysAllow", + action: Ci.nsIPermissionManager.ALLOW_ACTION, + expireType: null, + callback: function() {} + }, + { + stringId: "push.allowForSession", + action: Ci.nsIPermissionManager.ALLOW_ACTION, + expireType: Ci.nsIPermissionManager.EXPIRE_SESSION, + callback: function() {} + }, + { + stringId: "push.alwaysBlock", + action: Ci.nsIPermissionManager.DENY_ACTION, + expireType: null, + callback: function() {} + }] + + var options = { + learnMoreURL: Services.urlFormatter.formatURLPref("browser.push.warning.infoURL"), + }; + + this._showPrompt(aRequest, message, "push", actions, "push", + "push-notification-icon", options); + + }, + _promptGeo : function(aRequest) { var browserBundle = Services.strings.createBundle("chrome://browser/locale/browser.properties"); var requestingURI = aRequest.principal.URI; @@ -1875,7 +1911,6 @@ ContentPermissionPrompt.prototype = { }, prompt: function CPP_prompt(request) { - // Only allow exactly one permission rquest here. let types = request.types.QueryInterface(Ci.nsIArray); if (types.length != 1) { @@ -1887,6 +1922,7 @@ ContentPermissionPrompt.prototype = { const kFeatureKeys = { "geolocation" : "geo", "desktop-notification" : "desktop-notification", "pointerLock" : "pointerLock", + "push" : "push" }; // Make sure that we support the request. @@ -1930,6 +1966,9 @@ ContentPermissionPrompt.prototype = { case "pointerLock": this._promptPointerLock(request, autoAllow); break; + case "push": + this._promptPush(request); + break; } }, diff --git a/application/palemoon/components/preferences/aboutPermissions.js b/application/palemoon/components/preferences/aboutPermissions.js index 416bcdf34..0c3f8b823 100644 --- a/application/palemoon/components/preferences/aboutPermissions.js +++ b/application/palemoon/components/preferences/aboutPermissions.js @@ -449,6 +449,19 @@ var PermissionDefaults = { let value = (aValue != this.DENY); Services.prefs.setBoolPref("full-screen-api.pointer-lock.enabled", value); }, + + get push() { + if (!Services.prefs.getBoolPref("dom.push.enabled")) { + return this.DENY; + } + // We always ask for permission to push with a specific site, + // so there is no global ALLOW. + return this.UNKNOWN; + }, + set push(aValue) { + let value = (aValue != this.DENY); + Services.prefs.setBoolPref("dom.push.enabled", value); + }, } /** @@ -488,13 +501,13 @@ var AboutPermissions = { */ _supportedPermissions: ["password", "image", "popup", "cookie", "desktop-notification", "install", "geo", "indexedDB", - "fullscreen", "pointerLock"], + "fullscreen", "pointerLock", "push"], /** * Permissions that don't have a global "Allow" option. */ _noGlobalAllow: ["desktop-notification", "geo", "indexedDB", "fullscreen", - "pointerLock"], + "pointerLock", "push"], /** * Permissions that don't have a global "Deny" option. @@ -543,6 +556,7 @@ var AboutPermissions = { Services.prefs.addObserver("plugins.click_to_play", this, false); Services.prefs.addObserver("full-screen-api.enabled", this, false); Services.prefs.addObserver("full-screen-api.pointer-lock.enabled", this, false); + Services.prefs.addObserver("dom.push.enabled", this, false); Services.prefs.addObserver("permissions.places-sites-limit", this, false); Services.obs.addObserver(this, "perm-changed", false); @@ -695,6 +709,7 @@ var AboutPermissions = { Services.prefs.removeObserver("plugins.click_to_play", this, false); Services.prefs.removeObserver("full-screen-api.enabled", this, false); Services.prefs.removeObserver("full-screen-api.pointer-lock.enabled", this, false); + Services.prefs.removeObserver("dom.push.enabled", this, false); Services.prefs.removeObserver("permissions.places-sites-limit", this, false); Services.obs.removeObserver(this, "perm-changed"); diff --git a/application/palemoon/components/preferences/aboutPermissions.xul b/application/palemoon/components/preferences/aboutPermissions.xul index bd5a205c7..279de8d9b 100644 --- a/application/palemoon/components/preferences/aboutPermissions.xul +++ b/application/palemoon/components/preferences/aboutPermissions.xul @@ -391,6 +391,26 @@ </vbox> </hbox> + <!-- Push Notifications --> + <hbox id="push-pref-item" + class="pref-item" align="top"> + <image class="pref-icon" type="push"/> + <vbox> + <label class="pref-title" value="&push.label;"/> + <hbox align="center"> + <menulist id="push-menulist" + class="pref-menulist" + type="push" + oncommand="AboutPermissions.onPermissionCommand(event);"> + <menupopup> + <menuitem id="push-0" value="0" label="&permission.alwaysAsk;"/> + <menuitem id="push-1" value="1" label="&permission.allow;"/> + <menuitem id="push-2" value="2" label="&permission.block;"/> + </menupopup> + </menulist> + </hbox> + </vbox> + </hbox> </vbox> </hbox> diff --git a/application/palemoon/locales/en-US/chrome/browser/browser.properties b/application/palemoon/locales/en-US/chrome/browser/browser.properties index bf363d103..aff5b6f7d 100644 --- a/application/palemoon/locales/en-US/chrome/browser/browser.properties +++ b/application/palemoon/locales/en-US/chrome/browser/browser.properties @@ -305,6 +305,15 @@ webNotifications.neverShow=Always Block Notifications webNotifications.neverShow.accesskey=N webNotifications.showFromSite=Would you like to show notifications from %S? +# Push Notifications +push.allowForSession=Allow for Session +push.allowForSession.accesskey=S +push.alwaysAllow=Always Allow Push Notifications +push.alwaysAllow.accesskey=A +push.alwaysBlock=Always Block Push Notifications +push.alwaysBlock.accesskey=B +push.enablePush=Would you like to allow Push Notifications for %S? + # Pointer lock UI pointerLock.allow2=Hide pointer diff --git a/application/palemoon/locales/en-US/chrome/browser/preferences/aboutPermissions.dtd b/application/palemoon/locales/en-US/chrome/browser/preferences/aboutPermissions.dtd index ff1da3dd0..731be8fe5 100644 --- a/application/palemoon/locales/en-US/chrome/browser/preferences/aboutPermissions.dtd +++ b/application/palemoon/locales/en-US/chrome/browser/preferences/aboutPermissions.dtd @@ -54,3 +54,5 @@ <!ENTITY fullscreen.label "Fullscreen"> <!ENTITY pointerLock.label "Hide the Mouse Pointer"> + +<!ENTITY push.label "Receive Push Notifications"> diff --git a/application/palemoon/themes/linux/Push-16.png b/application/palemoon/themes/linux/Push-16.png Binary files differnew file mode 100644 index 000000000..082b17781 --- /dev/null +++ b/application/palemoon/themes/linux/Push-16.png diff --git a/application/palemoon/themes/linux/Push-64.png b/application/palemoon/themes/linux/Push-64.png Binary files differnew file mode 100644 index 000000000..6e09ab9c3 --- /dev/null +++ b/application/palemoon/themes/linux/Push-64.png diff --git a/application/palemoon/themes/linux/browser.css b/application/palemoon/themes/linux/browser.css index 4f4964db8..0be53ca26 100644 --- a/application/palemoon/themes/linux/browser.css +++ b/application/palemoon/themes/linux/browser.css @@ -1169,6 +1169,10 @@ toolbar[iconsize="small"] #webrtc-status-button { list-style-image: url(chrome://browser/skin/Geolocation-64.png); } +.popup-notification-icon[popupid="push"] { + list-style-image: url(chrome://browser/skin/Push-64.png); +} + .popup-notification-icon[popupid="xpinstall-disabled"], .popup-notification-icon[popupid="addon-progress"], .popup-notification-icon[popupid="addon-install-cancelled"], @@ -1288,6 +1292,10 @@ toolbar[iconsize="small"] #webrtc-status-button { list-style-image: url(chrome://browser/skin/Geolocation-16.png); } +#push-notification-icon { + list-style-image: url(chrome://browser/skin/Push-16.png); +} + #addons-notification-icon { list-style-image: url(chrome://mozapps/skin/extensions/extensionGeneric-16.png); } diff --git a/application/palemoon/themes/linux/jar.mn b/application/palemoon/themes/linux/jar.mn index 7e67d0129..d1c6d4013 100644 --- a/application/palemoon/themes/linux/jar.mn +++ b/application/palemoon/themes/linux/jar.mn @@ -23,6 +23,8 @@ browser.jar: * skin/classic/browser/engineManager.css skin/classic/browser/Geolocation-16.png skin/classic/browser/Geolocation-64.png + skin/classic/browser/Push-16.png + skin/classic/browser/Push-64.png skin/classic/browser/Go-arrow.png skin/classic/browser/identity.png skin/classic/browser/imagedocument.png diff --git a/application/palemoon/themes/linux/preferences/aboutPermissions.css b/application/palemoon/themes/linux/preferences/aboutPermissions.css index 406568831..a642b385f 100644 --- a/application/palemoon/themes/linux/preferences/aboutPermissions.css +++ b/application/palemoon/themes/linux/preferences/aboutPermissions.css @@ -98,6 +98,9 @@ .pref-icon[type="geo"] { list-style-image: url(chrome://browser/skin/Geolocation-64.png); } +.pref-icon[type="push"] { + list-style-image: url(chrome://browser/skin/Push-64.png); +} .pref-icon[type="indexedDB"] { list-style-image: url(chrome://global/skin/icons/question-64.png); } diff --git a/application/palemoon/themes/osx/Push-16.png b/application/palemoon/themes/osx/Push-16.png Binary files differnew file mode 100644 index 000000000..54ef8f8ea --- /dev/null +++ b/application/palemoon/themes/osx/Push-16.png diff --git a/application/palemoon/themes/osx/Push-64.png b/application/palemoon/themes/osx/Push-64.png Binary files differnew file mode 100644 index 000000000..099b9c76f --- /dev/null +++ b/application/palemoon/themes/osx/Push-64.png diff --git a/application/palemoon/themes/osx/browser.css b/application/palemoon/themes/osx/browser.css index 8d709d8e1..26661558f 100644 --- a/application/palemoon/themes/osx/browser.css +++ b/application/palemoon/themes/osx/browser.css @@ -1848,6 +1848,10 @@ toolbarbutton.bookmark-item[dragover="true"][open="true"] { list-style-image: url(chrome://browser/skin/Geolocation-64.png); } +.popup-notification-icon[popupid="push"] { + list-style-image: url(chrome://browser/skin/Push-64.png); +} + .popup-notification-icon[popupid="xpinstall-disabled"], .popup-notification-icon[popupid="addon-progress"], .popup-notification-icon[popupid="addon-install-cancelled"], @@ -1975,6 +1979,10 @@ toolbarbutton.bookmark-item[dragover="true"][open="true"] { list-style-image: url(chrome://browser/skin/Geolocation-16.png); } +#push-notification-icon { + list-style-image: url(chrome://browser/skin/Push-16.png); +} + #addons-notification-icon { list-style-image: url(chrome://mozapps/skin/extensions/extensionGeneric-16.png); } diff --git a/application/palemoon/themes/osx/jar.mn b/application/palemoon/themes/osx/jar.mn index 186cd8a75..0e12fdffa 100644 --- a/application/palemoon/themes/osx/jar.mn +++ b/application/palemoon/themes/osx/jar.mn @@ -24,6 +24,8 @@ browser.jar: * skin/classic/browser/engineManager.css skin/classic/browser/Geolocation-16.png skin/classic/browser/Geolocation-64.png + skin/classic/browser/Push-16.png + skin/classic/browser/Push-64.png skin/classic/browser/Info.png skin/classic/browser/identity.png skin/classic/browser/imagedocument.png diff --git a/application/palemoon/themes/osx/preferences/aboutPermissions.css b/application/palemoon/themes/osx/preferences/aboutPermissions.css index cfb941bbb..e10776e67 100644 --- a/application/palemoon/themes/osx/preferences/aboutPermissions.css +++ b/application/palemoon/themes/osx/preferences/aboutPermissions.css @@ -101,6 +101,9 @@ .pref-icon[type="geo"] { list-style-image: url(chrome://browser/skin/Geolocation-64.png); } +.pref-icon[type="push"] { + list-style-image: url(chrome://browser/skin/Push-64.png); +} .pref-icon[type="indexedDB"] { list-style-image: url(chrome://global/skin/icons/question-64.png); } diff --git a/application/palemoon/themes/windows/Push-16.png b/application/palemoon/themes/windows/Push-16.png Binary files differnew file mode 100644 index 000000000..d710e7336 --- /dev/null +++ b/application/palemoon/themes/windows/Push-16.png diff --git a/application/palemoon/themes/windows/Push-64.png b/application/palemoon/themes/windows/Push-64.png Binary files differnew file mode 100644 index 000000000..27fecb858 --- /dev/null +++ b/application/palemoon/themes/windows/Push-64.png diff --git a/application/palemoon/themes/windows/browser.css b/application/palemoon/themes/windows/browser.css index 1c51accae..6379eac60 100644 --- a/application/palemoon/themes/windows/browser.css +++ b/application/palemoon/themes/windows/browser.css @@ -2337,6 +2337,10 @@ toolbarbutton.bookmark-item[dragover="true"][open="true"] { list-style-image: url(chrome://browser/skin/Geolocation-64.png); } +.popup-notification-icon[popupid="push"] { + list-style-image: url(chrome://browser/skin/Push-64.png); +} + .popup-notification-icon[popupid="xpinstall-disabled"], .popup-notification-icon[popupid="addon-progress"], .popup-notification-icon[popupid="addon-install-cancelled"], @@ -2462,6 +2466,10 @@ toolbarbutton.bookmark-item[dragover="true"][open="true"] { list-style-image: url(chrome://browser/skin/Geolocation-16.png); } +#push-notification-icon { + list-style-image: url(chrome://browser/skin/Push-16.png); +} + #addons-notification-icon { list-style-image: url(chrome://mozapps/skin/extensions/extensionGeneric-16.png); } diff --git a/application/palemoon/themes/windows/jar.mn b/application/palemoon/themes/windows/jar.mn index a66714b13..d649d9c41 100644 --- a/application/palemoon/themes/windows/jar.mn +++ b/application/palemoon/themes/windows/jar.mn @@ -25,6 +25,8 @@ browser.jar: * skin/classic/browser/engineManager.css skin/classic/browser/Geolocation-16.png skin/classic/browser/Geolocation-64.png + skin/classic/browser/Push-16.png + skin/classic/browser/Push-64.png skin/classic/browser/Info.png skin/classic/browser/identity.png skin/classic/browser/imagedocument.png diff --git a/application/palemoon/themes/windows/preferences/aboutPermissions.css b/application/palemoon/themes/windows/preferences/aboutPermissions.css index d9db6ccbf..0a2a05358 100644 --- a/application/palemoon/themes/windows/preferences/aboutPermissions.css +++ b/application/palemoon/themes/windows/preferences/aboutPermissions.css @@ -101,6 +101,9 @@ .pref-icon[type="geo"] { list-style-image: url(chrome://browser/skin/Geolocation-64.png); } +.pref-icon[type="push"] { + list-style-image: url(chrome://browser/skin/Push-64.png); +} .pref-icon[type="indexedDB"] { list-style-image: url(chrome://global/skin/icons/question-48.png); } |