mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Tracking support for HistoryEngine. Bug #435321, r=thunder
This commit is contained in:
parent
1743ffc42e
commit
226ed028e3
@ -981,6 +981,13 @@ HistoryEngine.prototype = {
|
||||
if (!this.__store)
|
||||
this.__store = new HistoryStore();
|
||||
return this.__store;
|
||||
},
|
||||
|
||||
__tracker: null,
|
||||
get _tracker() {
|
||||
if (!this.__tracker)
|
||||
this.__tracker = new HistoryTracker();
|
||||
return this.__tracker;
|
||||
}
|
||||
};
|
||||
HistoryEngine.prototype.__proto__ = new Engine();
|
||||
|
@ -34,7 +34,7 @@
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
const EXPORTED_SYMBOLS = ['Tracker', 'BookmarksTracker'];
|
||||
const EXPORTED_SYMBOLS = ['Tracker', 'BookmarksTracker', 'HistoryTracker'];
|
||||
|
||||
const Cc = Components.classes;
|
||||
const Ci = Components.interfaces;
|
||||
@ -141,3 +141,48 @@ Function.prototype.async = Async.sugar;
|
||||
}
|
||||
BookmarksTracker.prototype.__proto__ = new Tracker();
|
||||
|
||||
function HistoryTracker() {
|
||||
this._init();
|
||||
}
|
||||
HistoryTracker.prototype = {
|
||||
_logName: "HistoryTracker",
|
||||
|
||||
/* We don't care about the first four */
|
||||
onBeginUpdateBatch: function HT_onBeginUpdateBatch() {
|
||||
|
||||
},
|
||||
onEndUpdateBatch: function HT_onEndUpdateBatch() {
|
||||
|
||||
},
|
||||
onPageChanged: function HT_onPageChanged() {
|
||||
|
||||
},
|
||||
onTitleChanged: function HT_onTitleChanged() {
|
||||
|
||||
},
|
||||
/* Every add or remove is worth 1 point.
|
||||
* Clearing the whole history is worth 50 points,
|
||||
* to ensure we're above the cutoff for syncing
|
||||
* ASAP.
|
||||
*/
|
||||
onVisit: function HT_onVisit(uri, vid, time, session, referrer, trans) {
|
||||
this._score += 1;
|
||||
},
|
||||
onPageExpired: function HT_onPageExpired(uri, time, entry) {
|
||||
this._score += 1;
|
||||
},
|
||||
onDeleteURI: function HT_onDeleteURI(uri) {
|
||||
this._score += 1;
|
||||
},
|
||||
onClearHistory: function HT_onClearHistory() {
|
||||
this._score += 50;
|
||||
},
|
||||
|
||||
_init: function HT__init() {
|
||||
super._init();
|
||||
Cc["@mozilla.org/browser/nav-history-service;1"].
|
||||
getService(Ci.nsINavHistoryService).
|
||||
addObserver(this, false);
|
||||
}
|
||||
}
|
||||
HistoryTracker.prototype.__proto__ = new Tracker();
|
||||
|
Loading…
Reference in New Issue
Block a user