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

Side by Side Diff: chrome/browser/resources/ntp4/most_visited_page.js

Issue 7610014: [ntp4] Bookmarks page implementation, first-pass. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Final review tweaks, rebase. Created 9 years, 4 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 cr.define('ntp4', function() { 5 cr.define('ntp4', function() {
6 'use strict'; 6 'use strict';
7 7
8 var TilePage = ntp4.TilePage; 8 var TilePage = ntp4.TilePage;
9 9
10 /** 10 /**
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 } 77 }
78 this.classList.remove('blacklisted'); 78 this.classList.remove('blacklisted');
79 79
80 if (!data || data.filler) { 80 if (!data || data.filler) {
81 if (this.data_) 81 if (this.data_)
82 this.reset(); 82 this.reset();
83 return; 83 return;
84 } 84 }
85 85
86 var id = tileID++; 86 var id = tileID++;
87 this.setAttribute('id', 'tile' + id); 87 this.id = 'most-visited-tile-' + id;
88 this.data_ = data; 88 this.data_ = data;
89 // TODO(estade): this shouldn't be focusable if the page isn't showing. 89 // TODO(estade): this shouldn't be focusable if the page isn't showing.
90 this.tabIndex = 0; 90 this.tabIndex = 0;
91 91
92 var faviconDiv = this.querySelector('.favicon'); 92 var faviconDiv = this.querySelector('.favicon');
93 var faviconUrl = data.faviconUrl || 93 var faviconUrl = data.faviconUrl ||
94 'chrome://favicon/size/32/' + data.url; 94 'chrome://favicon/size/32/' + data.url;
95 faviconDiv.style.backgroundImage = url(faviconUrl); 95 faviconDiv.style.backgroundImage = url(faviconUrl);
96 faviconDiv.dir = data.direction; 96 faviconDiv.dir = data.direction;
97 if (data.faviconDominantColor) 97 if (data.faviconDominantColor) {
98 this.setStripeColor(data.faviconDominantColor); 98 this.setStripeColor(data.faviconDominantColor);
99 else 99 } else {
100 chrome.send('getFaviconDominantColor', [faviconUrl, id]); 100 chrome.send('getFaviconDominantColor',
101 [faviconUrl, id, 'ntp4.setMostVisitedFaviconDominantColor']);
102 }
101 103
102 var title = this.querySelector('.title'); 104 var title = this.querySelector('.title');
103 title.textContent = data.title; 105 title.textContent = data.title;
104 title.dir = data.direction; 106 title.dir = data.direction;
105 107
106 var thumbnailUrl = data.thumbnailUrl || 'chrome://thumb/' + data.url; 108 var thumbnailUrl = data.thumbnailUrl || 'chrome://thumb/' + data.url;
107 this.querySelector('.thumbnail').style.backgroundImage = 109 this.querySelector('.thumbnail').style.backgroundImage =
108 url(thumbnailUrl); 110 url(thumbnailUrl);
109 111
110 this.href = data.url; 112 this.href = data.url;
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after
420 422
421 // Clear 'updated' flags so this function will work next time it's called. 423 // Clear 'updated' flags so this function will work next time it's called.
422 for (var i = 0; i < THUMBNAIL_COUNT; i++) { 424 for (var i = 0; i < THUMBNAIL_COUNT; i++) {
423 if (oldData[i]) 425 if (oldData[i])
424 oldData[i].updated = false; 426 oldData[i].updated = false;
425 } 427 }
426 428
427 return oldData; 429 return oldData;
428 }; 430 };
429 431
430 function setFaviconDominantColor(id, color) { 432 function setMostVisitedFaviconDominantColor(id, color) {
431 var tile = $('tile' + id); 433 var tile = $('most-visited-tile-' + id);
432 if (tile) 434 if (tile)
433 tile.setStripeColor(color); 435 tile.setStripeColor(color);
434 }; 436 };
435 437
436 return { 438 return {
437 MostVisitedPage: MostVisitedPage, 439 MostVisitedPage: MostVisitedPage,
438 refreshData: refreshData, 440 refreshData: refreshData,
439 setFaviconDominantColor: setFaviconDominantColor, 441 setMostVisitedFaviconDominantColor: setMostVisitedFaviconDominantColor,
440 }; 442 };
441 }); 443 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698