Bug 831520 - Clear my Metro Firefox History now also clears StartUI. r=mbrubeck

This commit is contained in:
Brian R. Bondy 2013-02-15 14:17:53 -05:00
parent d1c8253dea
commit 3dcde32cdd
3 changed files with 91 additions and 1 deletions

View File

@ -38,6 +38,10 @@ function TopSitesView(aGrid, maxSites) {
// handle selectionchange DOM events from the grid/tile group
this._set.addEventListener("context-action", this, false);
let history = Cc["@mozilla.org/browser/nav-history-service;1"].
getService(Ci.nsINavHistoryService);
history.addObserver(this, false);
}
TopSitesView.prototype = {
@ -153,6 +157,42 @@ TopSitesView.prototype = {
destruct: function destruct() {
// remove the observers here
},
// nsINavHistoryObserver
onBeginUpdateBatch: function() {
},
onEndUpdateBatch: function() {
},
onVisit: function(aURI, aVisitID, aTime, aSessionID,
aReferringID, aTransitionType) {
},
onTitleChanged: function(aURI, aPageTitle) {
},
onDeleteURI: function(aURI) {
},
onClearHistory: function() {
this._set.clearAll();
},
onPageChanged: function(aURI, aWhat, aValue) {
},
onPageExpired: function(aURI, aVisitTime, aWholeEntry) {
},
QueryInterface: function(iid) {
if (iid.equals(Components.interfaces.nsINavHistoryObserver) ||
iid.equals(Components.interfaces.nsISupports)) {
return this;
}
throw Cr.NS_ERROR_NO_INTERFACE;
}
};

View File

@ -188,6 +188,18 @@
</body>
</method>
<method name="clearAll">
<body>
<![CDATA[
while (this.firstChild) {
this.removeChild(this.firstChild);
}
this._grid.style.width = "0px";
this._contextActions = null;
]]>
</body>
</method>
<method name="insertItemAt">
<parameter name="anIndex"/>
<parameter name="aLabel"/>

View File

@ -10,7 +10,9 @@ function HistoryView(aSet) {
this._set = aSet;
this._set.controller = this;
//add observers here
let history = Cc["@mozilla.org/browser/nav-history-service;1"].
getService(Ci.nsINavHistoryService);
history.addObserver(this, false);
}
HistoryView.prototype = {
@ -49,6 +51,42 @@ HistoryView.prototype = {
destruct: function destruct() {
},
// nsINavHistoryObserver
onBeginUpdateBatch: function() {
},
onEndUpdateBatch: function() {
},
onVisit: function(aURI, aVisitID, aTime, aSessionID,
aReferringID, aTransitionType) {
},
onTitleChanged: function(aURI, aPageTitle) {
},
onDeleteURI: function(aURI) {
},
onClearHistory: function() {
this._set.clearAll();
},
onPageChanged: function(aURI, aWhat, aValue) {
},
onPageExpired: function(aURI, aVisitTime, aWholeEntry) {
},
QueryInterface: function(iid) {
if (iid.equals(Components.interfaces.nsINavHistoryObserver) ||
iid.equals(Components.interfaces.nsISupports)) {
return this;
}
throw Cr.NS_ERROR_NO_INTERFACE;
}
};
let HistoryStartView = {