Bug 1038811 - Push Notifications - Firefox front end changes for preferences, and permission notification. r=MattN+bmo@mozilla.com

This commit is contained in:
Doug Turner 2015-04-10 20:19:28 -07:00
Родитель ec9bd5a923
Коммит 5a075267c9
25 изменённых файлов: 166 добавлений и 12 удалений

Просмотреть файл

@ -1017,6 +1017,7 @@ pref("urlclassifier.downloadAllowTable", "goog-downloadwhite-digest256");
#endif
pref("browser.geolocation.warning.infoURL", "https://www.mozilla.org/%LOCALE%/firefox/geolocation/");
pref("browser.push.warning.infoURL", "https://www.mozilla.org/%LOCALE%/firefox/push/");
pref("browser.EULA.version", 3);
pref("browser.rights.version", 3);
@ -1723,9 +1724,6 @@ pref("loop.contacts.gravatars.promo", true);
pref("loop.browserSharing.showInfoBar", true);
pref("loop.contextInConverations.enabled", false);
// serverURL to be assigned by services team
pref("services.push.serverURL", "wss://push.services.mozilla.com/");
pref("social.sidebar.unload_timeout_ms", 10000);
// activation from inside of share panel is possible if activationPanelEnabled
@ -1890,6 +1888,7 @@ pref("dom.ipc.reportProcessHangs", true);
// Enable ReadingList browser UI by default.
pref("browser.readinglist.enabled", true);
pref("browser.readinglist.sidebarEverOpened", false);
// Enable the readinglist engine by default.
pref("readinglist.scheduler.enabled", true);
pref("readinglist.server", "https://readinglist.services.mozilla.com/v1");

Просмотреть файл

@ -780,6 +780,7 @@
<image id="default-notification-icon" class="notification-anchor-icon" role="button"/>
<image id="identity-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"/>

Просмотреть файл

@ -2393,6 +2393,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 secHistogram = Services.telemetry.getHistogramById("SECURITY_UI");
var requestingURI = aRequest.principal.URI;
@ -2517,7 +2553,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) {
@ -2529,6 +2564,7 @@ ContentPermissionPrompt.prototype = {
const kFeatureKeys = { "geolocation" : "geo",
"desktop-notification" : "desktop-notification",
"pointerLock" : "pointerLock",
"push" : "push"
};
// Make sure that we support the request.
@ -2579,6 +2615,9 @@ ContentPermissionPrompt.prototype = {
case "pointerLock":
this._promptPointerLock(request, autoAllow);
break;
case "push":
this._promptPush(request);
break;
}
},

Просмотреть файл

@ -336,7 +336,16 @@ let PermissionDefaults = {
let value = (aValue != this.DENY);
Services.prefs.setBoolPref("full-screen-api.enabled", value);
},
get push() {
if (!Services.prefs.getBoolPref("dom.push.enabled")) {
return this.DENY;
}
return this.UNKNOWN;
},
set push(aValue) {
let value = (aValue != this.DENY);
Services.prefs.setBoolPref("dom.push.enabled", value);
},
get camera() this.UNKNOWN,
get microphone() this.UNKNOWN
};
@ -378,12 +387,12 @@ let AboutPermissions = {
* Potential future additions: "sts/use", "sts/subd"
*/
_supportedPermissions: ["password", "cookie", "geo", "indexedDB", "popup",
"fullscreen", "camera", "microphone"],
"fullscreen", "camera", "microphone", "push"],
/**
* Permissions that don't have a global "Allow" option.
*/
_noGlobalAllow: ["geo", "indexedDB", "fullscreen", "camera", "microphone"],
_noGlobalAllow: ["geo", "indexedDB", "fullscreen", "camera", "microphone", "push"],
/**
* Permissions that don't have a global "Deny" option.
@ -411,6 +420,7 @@ let AboutPermissions = {
Services.prefs.addObserver("dom.indexedDB.enabled", this, false);
Services.prefs.addObserver("dom.disable_open_during_load", this, false);
Services.prefs.addObserver("full-screen-api.enabled", this, false);
Services.prefs.addObserver("dom.push.enabled", this, false);
Services.obs.addObserver(this, "perm-changed", false);
Services.obs.addObserver(this, "passwordmgr-storage-changed", false);
@ -432,6 +442,7 @@ let AboutPermissions = {
Services.prefs.removeObserver("dom.indexedDB.enabled", this, false);
Services.prefs.removeObserver("dom.disable_open_during_load", this, false);
Services.prefs.removeObserver("full-screen-api.enabled", this, false);
Services.prefs.removeObserver("dom.push.enabled", this, false);
Services.obs.removeObserver(this, "perm-changed");
Services.obs.removeObserver(this, "passwordmgr-storage-changed");

Просмотреть файл

@ -252,8 +252,28 @@
</menulist>
</hbox>
</vbox>
</hbox>
</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>

Просмотреть файл

@ -366,6 +366,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

Просмотреть файл

@ -42,5 +42,7 @@
<!ENTITY popup.label "Open Pop-up Windows">
<!ENTITY fullscreen.label "Fullscreen">
<!ENTITY push.label "Receive Push Notifications">
<!ENTITY camera.label "Use the Camera">
<!ENTITY microphone.label "Use the Microphone">

Просмотреть файл

@ -18,4 +18,4 @@ permission.geo.label = Access Your Location
permission.indexedDB.label = Maintain Offline Storage
permission.fullscreen.label = Enter Fullscreen
permission.pointerLock.label = Hide the Mouse Pointer
permission.push.label = Receive Push Notifications

Просмотреть файл

@ -190,5 +190,9 @@ let gPermissionObject = {
"pointerLock": {
exactHostMatch: true
},
"push": {
exactHostMatch: true
}
};

Двоичные данные
browser/themes/linux/Push-16.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 606 B

Двоичные данные
browser/themes/linux/Push-64.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 7.9 KiB

Просмотреть файл

@ -33,6 +33,8 @@ browser.jar:
skin/classic/browser/fullscreen-darknoise.png
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/heartbeat-icon.svg (../shared/heartbeat-icon.svg)
skin/classic/browser/heartbeat-star-lit.svg (../shared/heartbeat-star-lit.svg)
skin/classic/browser/heartbeat-star-off.svg (../shared/heartbeat-star-off.svg)

Просмотреть файл

@ -79,6 +79,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);
}

Двоичные данные
browser/themes/osx/Push-16.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 312 B

Двоичные данные
browser/themes/osx/Push-16@2x.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 666 B

Двоичные данные
browser/themes/osx/Push-64.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 8.3 KiB

Двоичные данные
browser/themes/osx/Push-64@2x.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 26 KiB

Просмотреть файл

@ -35,6 +35,10 @@ browser.jar:
skin/classic/browser/Geolocation-16@2x.png
skin/classic/browser/Geolocation-64.png
skin/classic/browser/Geolocation-64@2x.png
skin/classic/browser/Push-16.png
skin/classic/browser/Push-16@2x.png
skin/classic/browser/Push-64.png
skin/classic/browser/Push-64@2x.png
skin/classic/browser/heartbeat-icon.svg (../shared/heartbeat-icon.svg)
skin/classic/browser/heartbeat-star-lit.svg (../shared/heartbeat-star-lit.svg)
skin/classic/browser/heartbeat-star-off.svg (../shared/heartbeat-star-off.svg)

Просмотреть файл

@ -89,6 +89,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);
}

Просмотреть файл

@ -14,6 +14,10 @@
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-blocked"],
@ -119,6 +123,10 @@
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);
}
@ -290,6 +298,10 @@
list-style-image: url(chrome://browser/skin/Geolocation-16@2x.png);
}
#push-notification-icon {
list-style-image: url(chrome://browser/skin/Push-16@2x.png);
}
.indexedDB-notification-icon,
#indexedDB-notification-icon {
list-style-image: url(chrome://global/skin/icons/question-32.png);
@ -396,6 +408,10 @@
list-style-image: url(chrome://browser/skin/Geolocation-64@2x.png);
}
.popup-notification-icon[popupid="push"] {
list-style-image: url(chrome://browser/skin/Push-64@2x.png);
}
.popup-notification-icon[popupid="web-notifications"] {
list-style-image: url(chrome://browser/skin/notification-64@2x.png);
}

Двоичные данные
browser/themes/windows/Push-16.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 704 B

Двоичные данные
browser/themes/windows/Push-64.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 8.2 KiB

Просмотреть файл

@ -32,6 +32,8 @@ browser.jar:
skin/classic/browser/fullscreen-darknoise.png
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/heartbeat-icon.svg (../shared/heartbeat-icon.svg)
skin/classic/browser/heartbeat-star-lit.svg (../shared/heartbeat-star-lit.svg)
skin/classic/browser/heartbeat-star-off.svg (../shared/heartbeat-star-off.svg)

Просмотреть файл

@ -82,6 +82,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);
}

Просмотреть файл

@ -4197,8 +4197,44 @@ pref("dom.mozContacts.enabled", false);
// WebAlarms
pref("dom.mozAlarms.enabled", false);
// SimplePush
pref("services.push.enabled", false);
// Push
pref("dom.push.enabled", false);
pref("dom.push.debug", false);
pref("dom.push.serverURL", "wss://push.services.mozilla.com/");
pref("dom.push.userAgentID", "");
// Is the network connection allowed to be up?
// This preference should be used in UX to enable/disable push.
pref("dom.push.connection.enabled", true);
// Exponential back-off start is 5 seconds like in HTTP/1.1.
// Maximum back-off is pingInterval.
pref("dom.push.retryBaseInterval", 5000);
// Interval at which to ping PushServer to check connection status. In
// milliseconds. If no reply is received within requestTimeout, the connection
// is considered closed.
pref("dom.push.pingInterval", 1800000); // 30 minutes
// How long before we timeout
pref("dom.push.requestTimeout", 10000);
pref("dom.push.pingInterval.default", 180000);// 3 min
pref("dom.push.pingInterval.mobile", 180000); // 3 min
pref("dom.push.pingInterval.wifi", 180000); // 3 min
// Adaptive ping
pref("dom.push.adaptive.enabled", false);
pref("dom.push.adaptive.lastGoodPingInterval", 180000);// 3 min
pref("dom.push.adaptive.lastGoodPingInterval.mobile", 180000);// 3 min
pref("dom.push.adaptive.lastGoodPingInterval.wifi", 180000);// 3 min
// Valid gap between the biggest good ping and the bad ping
pref("dom.push.adaptive.gap", 60000); // 1 minute
// We limit the ping to this maximum value
pref("dom.push.adaptive.upperLimit", 1740000); // 29 min
// enable udp wakeup support
pref("dom.push.udp.wakeupEnabled", false);
// WebNetworkStats
pref("dom.mozNetworkStats.enabled", false);