Index: chrome/browser/resources/history/history.js |
diff --git a/chrome/browser/resources/history/history.js b/chrome/browser/resources/history/history.js |
index 4a16a5233177632a1667b6d7381d7f02aeb2517f..f71c4992d985dfac0d05218b1ab03232550e3d8a 100644 |
--- a/chrome/browser/resources/history/history.js |
+++ b/chrome/browser/resources/history/history.js |
@@ -224,17 +224,22 @@ Visit.prototype.getResultDOM = function(propertyBag) { |
entryBox.appendChild(time); |
- var bookmarkSection = createElementWithClassName('div', 'bookmark-section'); |
+ var bookmarkSection = createElementWithClassName( |
+ 'button', 'bookmark-section custom-appearance'); |
if (this.starred_) { |
bookmarkSection.title = loadTimeData.getString('removeBookmark'); |
bookmarkSection.classList.add('starred'); |
bookmarkSection.addEventListener('click', function f(e) { |
recordUmaAction('HistoryPage_BookmarkStarClicked'); |
- bookmarkSection.classList.remove('starred'); |
chrome.send('removeBookmark', [self.url_]); |
+ |
+ this.model_.getView().onBeforeUnstarred(this); |
+ bookmarkSection.classList.remove('starred'); |
+ this.model_.getView().onAfterUnstarred(this); |
+ |
bookmarkSection.removeEventListener('click', f); |
e.preventDefault(); |
- }); |
+ }.bind(this)); |
} |
entryBox.appendChild(bookmarkSection); |
@@ -1149,6 +1154,21 @@ HistoryView.prototype.onBeforeRemove = function(visit) { |
row.focusIndex(Math.min(pos.col, row.items.length - 1)); |
}; |
+/** @param {Visit} visit The visit about to be unstarred. */ |
+HistoryView.prototype.onBeforeUnstarred = function(visit) { |
+ assert(this.currentVisits_.indexOf(visit) >= 0); |
+ assert(visit.bookmarkStar == document.activeElement); |
+ |
+ var pos = this.focusGrid_.getPositionForTarget(document.activeElement); |
+ var row = this.focusGrid_.rows[pos.row]; |
+ row.focusIndex(Math.min(pos.col + 1, row.items.length - 1)); |
+}; |
+ |
+/** @param {Visit} visit The visit that was just unstarred. */ |
+HistoryView.prototype.onAfterUnstarred = function(visit) { |
+ this.updateFocusGrid_(); |
+}; |
+ |
/** |
* Removes a single entry from the view. Also removes gaps before and after |
* entry if necessary. |