Bug 1017273 Change Loop from compile-time enabled to runtime-enabled with a pref. r=dolske,r=jesup,r=glandium,r=gijs

This commit is contained in:
Mark Banner 2014-07-16 15:15:07 +01:00
parent 32fe7d9bf6
commit 264942d0a2
15 changed files with 32 additions and 51 deletions

View File

@ -1511,11 +1511,16 @@ pref("shumway.disabled", true);
// (This is intentionally on the high side; see bug 746055.)
pref("image.mem.max_decoded_image_kb", 256000);
#ifdef MOZ_LOOP
// Enable by default on nightly and aurora.
#ifndef RELEASE_BUILD
pref("loop.enabled", true);
#else
pref("loop.enabled", false);
#endif
pref("loop.server", "https://loop.services.mozilla.com");
pref("loop.do_not_disturb", false);
pref("loop.ringtone", "chrome://browser/content/loop/shared/sounds/Firefox-Long.ogg");
#endif
// serverURL to be assigned by services team
pref("services.push.serverURL", "wss://push.services.mozilla.com/");

View File

@ -36,6 +36,11 @@ XPCOMUtils.defineLazyModuleGetter(this, "PanelFrame", "resource:///modules/Panel
* delayedStartup.
*/
initialize: function() {
if (!Services.prefs.getBoolPref("loop.enabled")) {
CustomizableUI.getWidget("loop-call-button").forWindow(window).node.hidden = true;
return;
}
MozLoopService.initialize();
},
};

View File

@ -172,9 +172,7 @@ let gInitialPages = [
#include browser-feeds.js
#include browser-fullScreen.js
#include browser-fullZoom.js
#ifdef MOZ_LOOP
#include browser-loop.js
#endif
#include browser-places.js
#include browser-plugins.js
#include browser-safebrowsing.js
@ -1188,9 +1186,7 @@ var gBrowserInit = {
gDataNotificationInfoBar.init();
#endif
#ifdef MOZ_LOOP
LoopUI.initialize();
#endif
gBrowserThumbnails.init();

View File

@ -267,7 +267,6 @@
noautofocus="true"
position="topcenter topright"/>
#ifdef MOZ_LOOP
<panel id="loop-notification-panel"
class="loop-panel social-panel"
type="arrow"
@ -279,7 +278,6 @@
type="arrow"
orient="horizontal"
hidden="true"/>
#endif
<menupopup id="toolbar-context-menu"
onpopupshowing="onViewToolbarsPopupShowing(event, document.getElementById('viewToolbarsMenuSeparator'));">
@ -673,11 +671,7 @@
aria-label="&navbarCmd.label;"
fullscreentoolbar="true" mode="icons" customizable="true"
iconsize="small"
#ifdef MOZ_LOOP
defaultset="urlbar-container,search-container,webrtc-status-button,bookmarks-menu-button,downloads-button,home-button,loop-call-button,social-share-button,social-toolbar-item"
#else
defaultset="urlbar-container,search-container,webrtc-status-button,bookmarks-menu-button,downloads-button,home-button,social-share-button,social-toolbar-item"
#endif
customizationtarget="nav-bar-customization-target"
overflowable="true"
overflowbutton="nav-bar-overflow-button"
@ -811,7 +805,6 @@
oncommand="WebrtcIndicator.menuCommand(event.target);"/>
</toolbarbutton>
#ifdef MOZ_LOOP
<!-- XXX Bug 1013989 will provide a label for the button -->
<!-- This uses badged to be compatible with the social api code it shares.
We may also want it to be badged in the future, for notification
@ -826,7 +819,6 @@
cui-areatype="toolbar"
>
</toolbarbutton>
#endif
<toolbarbutton id="bookmarks-menu-button"
class="toolbarbutton-1 chromeclass-toolbar-additional"

View File

@ -97,7 +97,6 @@ static RedirEntry kRedirMap[] = {
nsIAboutModule::ALLOW_SCRIPT },
{ "customizing", "chrome://browser/content/customizableui/aboutCustomizing.xul",
nsIAboutModule::ALLOW_SCRIPT },
#ifdef MOZ_LOOP
{ "loopconversation", "chrome://browser/content/loop/conversation.html",
nsIAboutModule::URI_SAFE_FOR_UNTRUSTED_CONTENT |
nsIAboutModule::ALLOW_SCRIPT |
@ -106,7 +105,6 @@ static RedirEntry kRedirMap[] = {
nsIAboutModule::URI_SAFE_FOR_UNTRUSTED_CONTENT |
nsIAboutModule::ALLOW_SCRIPT |
nsIAboutModule::HIDE_FROM_ABOUTABOUT },
#endif
};
static const int kRedirTotal = ArrayLength(kRedirMap);

View File

@ -112,10 +112,8 @@ static const mozilla::Module::ContractIDEntry kBrowserContracts[] = {
#endif
{ NS_ABOUT_MODULE_CONTRACTID_PREFIX "app-manager", &kNS_BROWSER_ABOUT_REDIRECTOR_CID },
{ NS_ABOUT_MODULE_CONTRACTID_PREFIX "customizing", &kNS_BROWSER_ABOUT_REDIRECTOR_CID },
#ifdef MOZ_LOOP
{ NS_ABOUT_MODULE_CONTRACTID_PREFIX "looppanel", &kNS_BROWSER_ABOUT_REDIRECTOR_CID },
{ NS_ABOUT_MODULE_CONTRACTID_PREFIX "loopconversation", &kNS_BROWSER_ABOUT_REDIRECTOR_CID },
#endif
#if defined(XP_WIN)
{ NS_IEHISTORYENUMERATOR_CONTRACTID, &kNS_WINIEHISTORYENUMERATOR_CID },
#elif defined(XP_MACOSX)

View File

@ -141,9 +141,7 @@
<panelview id="PanelUI-socialapi" flex="1"/>
#ifdef MOZ_LOOP
<panelview id="PanelUI-loopapi" flex="1"/>
#endif
<panelview id="PanelUI-feeds" flex="1" oncommand="FeedHandler.subscribeToFeed(null, event);">
<label value="&feedsMenu.label;" class="panel-subview-header"/>

View File

@ -206,9 +206,7 @@ let CustomizableUIInternal = {
"bookmarks-menu-button",
"downloads-button",
"home-button",
#ifdef MOZ_LOOP
"loop-call-button",
#endif
"social-share-button",
],
defaultCollapsed: false,

View File

@ -449,6 +449,11 @@ this.MozLoopService = {
* push and loop servers.
*/
initialize: function() {
// Don't do anything if loop is not enabled.
if (!Services.prefs.getBoolPref("loop.enabled")) {
return;
}
// If expiresTime is in the future then kick-off registration.
if (MozLoopServiceInternal.urlExpiryTimeIsInFuture()) {
this._startInitializeTimer();
@ -481,6 +486,11 @@ this.MozLoopService = {
* rejected with an error code or string.
*/
register: function(mockPushHandler) {
// Don't do anything if loop is not enabled.
if (!Services.prefs.getBoolPref("loop.enabled")) {
throw new Error("Loop is not enabled");
}
return MozLoopServiceInternal.promiseRegisteredWithServers(mockPushHandler);
},

View File

@ -10,6 +10,7 @@ PARALLEL_DIRS += [
'dirprovider',
'downloads',
'feeds',
'loop',
'places',
'preferences',
'privatebrowsing',
@ -22,9 +23,6 @@ PARALLEL_DIRS += [
'migration',
]
if CONFIG['MOZ_LOOP']:
PARALLEL_DIRS += ['loop']
DIRS += ['build']
XPIDL_SOURCES += [

View File

@ -1604,12 +1604,10 @@ richlistitem[type~="action"][actiontype="switchtab"] > .ac-url-box > .ac-action-
list-style-image: url("chrome://browser/skin/Info.png");
}
%ifdef MOZ_LOOP
/* Loop */
#loop-call-button {
list-style-image: url("chrome://global/skin/loop/loop-call.png");
}
%endif
/* social share panel */

View File

@ -2226,13 +2226,11 @@ richlistitem[type~="action"][actiontype="switchtab"][selected="true"] > .ac-url-
}
}
%ifdef MOZ_LOOP
/* Loop */
/* XXX - probably need retina images here */
#loop-call-button {
list-style-image: url("chrome://global/skin/loop/loop-call.png");
}
%endif
/* social share panel */
.social-share-frame {

View File

@ -1540,13 +1540,10 @@ richlistitem[type~="action"][actiontype="switchtab"] > .ac-url-box > .ac-action-
-moz-image-region: rect(0, 48px, 16px, 32px);
}
%ifdef MOZ_LOOP
/* Loop */
#loop-call-button {
list-style-image: url("chrome://global/skin/loop/loop-call.png");
}
%endif
/* social share panel */

View File

@ -3892,7 +3892,6 @@ LIBJPEG_TURBO_ASFLAGS=
LIBJPEG_TURBO_X86_ASM=
LIBJPEG_TURBO_X64_ASM=
LIBJPEG_TURBO_ARM_ASM=
MOZ_LOOP=$NIGHTLY_BUILD
MOZ_PERMISSIONS=1
MOZ_PLACES=1
MOZ_SOCIAL=1
@ -8350,12 +8349,6 @@ if test "$BUILD_CTYPES"; then
AC_DEFINE(BUILD_CTYPES)
fi
dnl Build Loop if required
AC_SUBST(MOZ_LOOP)
if test "$MOZ_LOOP"; then
AC_DEFINE(MOZ_LOOP)
fi
dnl Build Places if required
if test "$MOZ_PLACES"; then
AC_DEFINE(MOZ_PLACES)

View File

@ -1479,20 +1479,17 @@ MediaManager::GetUserMedia(bool aPrivileged,
}
#endif
nsIURI* docURI = aWindow->GetDocumentURI();
#ifdef MOZ_LOOP
{
bool isLoop = false;
nsCOMPtr<nsIURI> loopURI;
nsresult rv = NS_NewURI(getter_AddRefs(loopURI), "about:loopconversation");
NS_ENSURE_SUCCESS(rv, rv);
rv = docURI->EqualsExceptRef(loopURI, &isLoop);
NS_ENSURE_SUCCESS(rv, rv);
if (isLoop) {
aPrivileged = true;
}
bool isLoop = false;
nsCOMPtr<nsIURI> loopURI;
nsresult rv = NS_NewURI(getter_AddRefs(loopURI), "about:loopconversation");
NS_ENSURE_SUCCESS(rv, rv);
rv = docURI->EqualsExceptRef(loopURI, &isLoop);
NS_ENSURE_SUCCESS(rv, rv);
if (isLoop) {
aPrivileged = true;
}
#endif
// XXX No full support for picture in Desktop yet (needs proper UI)
if (aPrivileged ||