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
Родитель f94d794ef7
Коммит 4b4b97e7b0
3 изменённых файлов: 91 добавлений и 1 удалений

Просмотреть файл

@ -38,6 +38,10 @@ function TopSitesView(aGrid, maxSites) {
// handle selectionchange DOM events from the grid/tile group // handle selectionchange DOM events from the grid/tile group
this._set.addEventListener("context-action", this, false); 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 = { TopSitesView.prototype = {
@ -153,6 +157,42 @@ TopSitesView.prototype = {
destruct: function destruct() { destruct: function destruct() {
// remove the observers here // 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;
} }
}; };

Просмотреть файл

@ -188,6 +188,18 @@
</body> </body>
</method> </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"> <method name="insertItemAt">
<parameter name="anIndex"/> <parameter name="anIndex"/>
<parameter name="aLabel"/> <parameter name="aLabel"/>

Просмотреть файл

@ -10,7 +10,9 @@ function HistoryView(aSet) {
this._set = aSet; this._set = aSet;
this._set.controller = this; 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 = { HistoryView.prototype = {
@ -49,6 +51,42 @@ HistoryView.prototype = {
destruct: function destruct() { 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 = { let HistoryStartView = {