gecko-dev/browser/modules/NewTabURL.jsm
Nihanth Subramanya 8dd023f74e Bug 1178152 - Provide a notification when the newtab URL changes. r=florian
--HG--
extra : amend_source : 2d6c937d310fb7b68b9f000125d822385097e91a
2015-06-30 13:45:24 -07:00

39 lines
914 B
JavaScript

/* 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";
let Cc = Components.classes;
let Ci = Components.interfaces;
let Cu = Components.utils;
this.EXPORTED_SYMBOLS = [ "NewTabURL" ];
Components.utils.import("resource://gre/modules/Services.jsm");
this.NewTabURL = {
_url: "about:newtab",
_overridden: false,
get: function() {
return this._url;
},
get overridden() {
return this._overridden;
},
override: function(newURL) {
this._url = newURL;
this._overridden = true;
Services.obs.notifyObservers(null, "newtab-url-changed", this._url);
},
reset: function() {
this._url = "about:newtab";
this._overridden = false;
Services.obs.notifyObservers(null, "newtab-url-changed", this._url);
}
};