Index: chrome/browser/resources/history/history.js |
diff --git a/chrome/browser/resources/history/history.js b/chrome/browser/resources/history/history.js |
index acccde7a2c56bd2fe57d93dc66a48dd3d8b6d649..e25005b12bf7cecba36d697270baec35dccfc7c4 100644 |
--- a/chrome/browser/resources/history/history.js |
+++ b/chrome/browser/resources/history/history.js |
@@ -36,16 +36,17 @@ MenuButton.createDropDownArrows(); |
* @param {boolean} continued Whether this visit is on the same day as the |
* visit before it. |
* @param {HistoryModel} model The model object this entry belongs to. |
- * @param {number} id The identifier for the entry. |
* @constructor |
*/ |
-function Visit(result, continued, model, id) { |
+function Visit(result, continued, model) { |
this.model_ = model; |
this.title_ = result.title; |
this.url_ = result.url; |
this.starred_ = result.starred; |
this.snippet_ = result.snippet || ''; |
- this.id_ = id; |
+ // The id will be set according to when the visit was displayed, not |
+ // received. Set to -1 to show that it has not been set yet. |
+ this.id_ = -1; |
this.isRendered = false; // Has the visit already been rendered on the page? |
@@ -103,6 +104,8 @@ Visit.prototype.getResultDOM = function(propertyBag) { |
dropDown.setAttribute('menu', '#action-menu'); |
cr.ui.decorate(dropDown, MenuButton); |
+ this.id_ = this.model_.nextVisitId_++; |
+ |
// Checkbox is always created, but only visible on hover & when checked. |
var checkbox = document.createElement('input'); |
checkbox.type = 'checkbox'; |
@@ -436,7 +439,7 @@ HistoryModel.prototype.addResults = function(info, results) { |
visit.addDuplicateTimestamp(thisResult.timestamp); |
continue; |
} |
- visit = new Visit(thisResult, isSameDay, this, this.nextVisitId_++); |
+ visit = new Visit(thisResult, isSameDay, this); |
this.urlsFromLastSeenDay_[thisResult.url] = visit; |
this.visits_.push(visit); |
this.changed = true; |