Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(710)

Unified Diff: chrome/browser/resources/history/history.js

Issue 12217015: History: Fix selecting multiple visits. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Refactor Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/resources/history/history.js
diff --git a/chrome/browser/resources/history/history.js b/chrome/browser/resources/history/history.js
index 4b2292eb81e16743e8f8b977958c1751761fac10..58b1d8551be21f5f92bb4fde73aead24106c50b8 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';
@@ -435,7 +438,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;
« no previous file with comments | « no previous file | chrome/test/data/webui/history_browsertest.js » ('j') | chrome/test/data/webui/history_browsertest.js » ('J')

Powered by Google App Engine
This is Rietveld 408576698