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

Unified Diff: chrome/browser/resources/ntp/most_visited.js

Issue 3455007: Make it possible to hide "most visited" on nnnnnnntp (Closed)
Patch Set: fix revert reasons Created 10 years, 3 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
« no previous file with comments | « chrome/browser/resources/ntp/apps.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/resources/ntp/most_visited.js
diff --git a/chrome/browser/resources/ntp/most_visited.js b/chrome/browser/resources/ntp/most_visited.js
index 98f331760092300f4f31d07cabd0a3c827e23ece..72557ac59c5e49796acd211c5c003857b2bee15e 100644
--- a/chrome/browser/resources/ntp/most_visited.js
+++ b/chrome/browser/resources/ntp/most_visited.js
@@ -41,9 +41,10 @@ var MostVisited = (function() {
return Array.prototype.indexOf.call(nodes, el);
}
- function MostVisited(el, miniview, useSmallGrid, visible) {
+ function MostVisited(el, miniview, menu, useSmallGrid, visible) {
this.element = el;
this.miniview = miniview;
+ this.menu = menu;
this.useSmallGrid_ = useSmallGrid;
this.visible_ = visible;
@@ -536,6 +537,7 @@ var MostVisited = (function() {
this.data_ = data;
this.updateMostVisited_();
this.updateMiniview_();
+ this.updateMenu_();
},
updateMostVisited_: function() {
@@ -609,6 +611,19 @@ var MostVisited = (function() {
updateMiniviewClipping(this.miniview);
},
+ updateMenu_: function() {
+ clearClosedMenu(this.menu);
+ var data = this.data.slice(0, MAX_MINIVIEW_ITEMS);
+ for (var i = 0, item; item = data[i]; i++) {
+ if (!item.filler) {
+ addClosedMenuEntry(
+ this.menu, item.url, item.title, 'chrome://favicon/' + item.url);
+ }
+ }
+ addClosedMenuFooter(
+ this.menu, 'most-visited', MINIMIZED_THUMB, Section.THUMB);
+ },
+
handleClick_: function(e) {
var target = e.target;
if (target.classList.contains('pin')) {
« no previous file with comments | « chrome/browser/resources/ntp/apps.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698