summaryrefslogtreecommitdiffstats
path: root/browser/modules/AboutHome.jsm
diff options
context:
space:
mode:
authorwolfbeast <mcwerewolf@gmail.com>2018-06-04 13:17:38 +0200
committerwolfbeast <mcwerewolf@gmail.com>2018-06-04 13:17:38 +0200
commita1be17c1cea81ebb1e8b131a662c698d78f3f7f2 (patch)
treea92f7de513be600cc07bac458183e9af40e00c06 /browser/modules/AboutHome.jsm
parentbf11fdd304898ac675e39b01b280d39550e419d0 (diff)
downloadUXP-a1be17c1cea81ebb1e8b131a662c698d78f3f7f2.tar
UXP-a1be17c1cea81ebb1e8b131a662c698d78f3f7f2.tar.gz
UXP-a1be17c1cea81ebb1e8b131a662c698d78f3f7f2.tar.lz
UXP-a1be17c1cea81ebb1e8b131a662c698d78f3f7f2.tar.xz
UXP-a1be17c1cea81ebb1e8b131a662c698d78f3f7f2.zip
Issue #303 Part 1: Move basilisk files from /browser to /application/basilisk
Diffstat (limited to 'browser/modules/AboutHome.jsm')
-rw-r--r--browser/modules/AboutHome.jsm175
1 files changed, 0 insertions, 175 deletions
diff --git a/browser/modules/AboutHome.jsm b/browser/modules/AboutHome.jsm
deleted file mode 100644
index 639194c20..000000000
--- a/browser/modules/AboutHome.jsm
+++ /dev/null
@@ -1,175 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-"use strict";
-
-var Cc = Components.classes;
-var Ci = Components.interfaces;
-var Cu = Components.utils;
-
-this.EXPORTED_SYMBOLS = [ "AboutHomeUtils", "AboutHome" ];
-
-Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
-Components.utils.import("resource://gre/modules/Services.jsm");
-
-XPCOMUtils.defineLazyModuleGetter(this, "AppConstants",
- "resource://gre/modules/AppConstants.jsm");
-XPCOMUtils.defineLazyModuleGetter(this, "AutoMigrate",
- "resource:///modules/AutoMigrate.jsm");
-XPCOMUtils.defineLazyModuleGetter(this, "fxAccounts",
- "resource://gre/modules/FxAccounts.jsm");
-XPCOMUtils.defineLazyModuleGetter(this, "PrivateBrowsingUtils",
- "resource://gre/modules/PrivateBrowsingUtils.jsm");
-XPCOMUtils.defineLazyModuleGetter(this, "Promise",
- "resource://gre/modules/Promise.jsm");
-
-// Should be bumped up if any data content format changes.
-const STARTPAGE_VERSION = 5;
-
-this.AboutHomeUtils = {
- /*
- * showKnowYourRights - Determines if the user should be shown the
- * about:rights notification. The notification should *not* be shown if
- * we've already shown the current version, or if the override pref says to
- * never show it. The notification *should* be shown if it's never been seen
- * before, if a newer version is available, or if the override pref says to
- * always show it.
- */
- get showKnowYourRights() {
- // Look for an unconditional override pref. If set, do what it says.
- // (true --> never show, false --> always show)
- try {
- return !Services.prefs.getBoolPref("browser.rights.override");
- } catch (e) { }
- // Ditto, for the legacy EULA pref.
- try {
- return !Services.prefs.getBoolPref("browser.EULA.override");
- } catch (e) { }
-
- if (!AppConstants.MC_OFFICIAL) {
- // Non-official builds shouldn't show the notification.
- return false;
- }
-
- // Look to see if the user has seen the current version or not.
- var currentVersion = Services.prefs.getIntPref("browser.rights.version");
- try {
- return !Services.prefs.getBoolPref("browser.rights." + currentVersion + ".shown");
- } catch (e) { }
-
- // Legacy: If the user accepted a EULA, we won't annoy them with the
- // equivalent about:rights page until the version changes.
- try {
- return !Services.prefs.getBoolPref("browser.EULA." + currentVersion + ".accepted");
- } catch (e) { }
-
- // We haven't shown the notification before, so do so now.
- return true;
- }
-};
-
-/**
- * This code provides services to the about:home page. Whenever
- * about:home needs to do something chrome-privileged, it sends a
- * message that's handled here.
- */
-var AboutHome = {
- MESSAGES: [
- "AboutHome:RestorePreviousSession",
- "AboutHome:Downloads",
- "AboutHome:Bookmarks",
- "AboutHome:History",
- "AboutHome:Addons",
- "AboutHome:Sync",
- "AboutHome:Settings",
- "AboutHome:RequestUpdate",
- "AboutHome:MaybeShowAutoMigrationUndoNotification",
- ],
-
- init: function() {
- let mm = Cc["@mozilla.org/globalmessagemanager;1"].getService(Ci.nsIMessageListenerManager);
-
- for (let msg of this.MESSAGES) {
- mm.addMessageListener(msg, this);
- }
- },
-
- receiveMessage: function(aMessage) {
- let window = aMessage.target.ownerGlobal;
-
- switch (aMessage.name) {
- case "AboutHome:RestorePreviousSession":
- let ss = Cc["@mozilla.org/browser/sessionstore;1"].
- getService(Ci.nsISessionStore);
- if (ss.canRestoreLastSession) {
- ss.restoreLastSession();
- }
- break;
-
- case "AboutHome:Downloads":
- window.BrowserDownloadsUI();
- break;
-
- case "AboutHome:Bookmarks":
- window.PlacesCommandHook.showPlacesOrganizer("UnfiledBookmarks");
- break;
-
- case "AboutHome:History":
- window.PlacesCommandHook.showPlacesOrganizer("History");
- break;
-
- case "AboutHome:Addons":
- window.BrowserOpenAddonsMgr();
- break;
-
- case "AboutHome:Sync":
- window.openPreferences("paneSync", { urlParams: { entrypoint: "abouthome" } });
- break;
-
- case "AboutHome:Settings":
- window.openPreferences();
- break;
-
- case "AboutHome:RequestUpdate":
- this.sendAboutHomeData(aMessage.target);
- break;
-
- case "AboutHome:MaybeShowAutoMigrationUndoNotification":
- AutoMigrate.maybeShowUndoNotification(aMessage.target);
- break;
- }
- },
-
- // Send all the chrome-privileged data needed by about:home. This
- // gets re-sent when the search engine changes.
- sendAboutHomeData: function(target) {
- let wrapper = {};
- Components.utils.import("resource:///modules/sessionstore/SessionStore.jsm",
- wrapper);
- let ss = wrapper.SessionStore;
-
- ss.promiseInitialized.then(function() {
- let data = {
- showRestoreLastSession: ss.canRestoreLastSession,
- showKnowYourRights: AboutHomeUtils.showKnowYourRights
- };
-
- if (AboutHomeUtils.showKnowYourRights) {
- // Set pref to indicate we've shown the notification.
- let currentVersion = Services.prefs.getIntPref("browser.rights.version");
- Services.prefs.setBoolPref("browser.rights." + currentVersion + ".shown", true);
- }
-
- if (target && target.messageManager) {
- target.messageManager.sendAsyncMessage("AboutHome:Update", data);
- } else {
- let mm = Cc["@mozilla.org/globalmessagemanager;1"].getService(Ci.nsIMessageListenerManager);
- mm.broadcastAsyncMessage("AboutHome:Update", data);
- }
- }).then(null, function onError(x) {
- Cu.reportError("Error in AboutHome.sendAboutHomeData: " + x);
- });
- },
-
-};