Bug 958891 - Make Fennec about:home advertise Firefox Accounts + Sync banner. r=bnicholson

This commit is contained in:
Margaret Leibovic 2014-01-17 16:08:44 -08:00
parent a474dd6898
commit 6bbb2e3532
6 changed files with 38 additions and 5 deletions

View File

@ -810,8 +810,9 @@ pref("browser.snippets.geoUrl", "https://geo.mozilla.org/country.json");
// URL used to ping metrics with stats about which snippets have been shown
pref("browser.snippets.statsUrl", "https://snippets-stats.mozilla.org/mobile");
// This pref requires a restart to take effect.
// These prefs require a restart to take effect.
pref("browser.snippets.enabled", false);
pref("browser.snippets.syncPromo.enabled", false);
#ifdef MOZ_ANDROID_SYNTHAPKS
// The URL of the APK factory from which we obtain APKs for webapps.

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

View File

@ -291,6 +291,28 @@ function _httpGetRequest(url, callback) {
xhr.send(null);
}
function loadSyncPromoBanner() {
// XXX: Use Accounts.jsm to check if a sync account exists (bug 917942).
let syncAccountExists = false;
if (syncAccountExists) {
// Don't show the promo banner if a sync account already exists.
return;
}
let stringBundle = Services.strings.createBundle("chrome://browser/locale/sync.properties");
let text = stringBundle.GetStringFromName("promoBanner.message.text");
let link = stringBundle.GetStringFromName("promoBanner.message.link");
Home.banner.add({
text: text + "<a href=\"#\">" + link + "</a>",
icon: "drawable://sync_promo",
onclick: function() {
// XXX: Use Accounts.jsm to launch sync set-up activity (bug 917942).
gChromeWin.alert("Launch sync set-up activity!");
}
});
}
function Snippets() {}
Snippets.prototype = {
@ -298,12 +320,15 @@ Snippets.prototype = {
classID: Components.ID("{a78d7e59-b558-4321-a3d6-dffe2f1e76dd}"),
observe: function(subject, topic, data) {
if (!Services.prefs.getBoolPref("browser.snippets.enabled")) {
return;
}
switch(topic) {
case "profile-after-change":
loadSnippetsFromCache();
if (Services.prefs.getBoolPref("browser.snippets.syncPromo.enabled")) {
loadSyncPromoBanner();
}
if (Services.prefs.getBoolPref("browser.snippets.enabled")) {
loadSnippetsFromCache();
}
break;
}
},

View File

@ -31,3 +31,10 @@ sync.setup.tryagain=Try again
sync.setup.manual=Manual setup
sync.message.notabs=No tabs from your other computers.
# LOCALIZATION NOTE (promoBanner.message.text): First part of the message displayed in a
# banner on about:home. The final space separates this text from the link.
promoBanner.message.text=Sync is brand new and easier than ever.\u0020
# LOCALIZATION NOTE (promoBanner.message.link): Second part of the message, styled as a link.
promoBanner.message.link=Tap here to learn more