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

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

Issue 11438009: NTP5: Refactoring appData to use Tile's data implementation. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressing Dan's comments Created 8 years 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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('ntp', function() { 5 cr.define('ntp', function() {
6 'use strict'; 6 'use strict';
7 7
8 var Thumbnail = ntp.Thumbnail; 8 var Thumbnail = ntp.Thumbnail;
9 var ThumbnailPage = ntp.ThumbnailPage; 9 var ThumbnailPage = ntp.ThumbnailPage;
10 10
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 var closeButton = cr.doc.createElement('div'); 49 var closeButton = cr.doc.createElement('div');
50 closeButton.className = 'close-button'; 50 closeButton.className = 'close-button';
51 closeButton.title = loadTimeData.getString('removethumbnailtooltip'); 51 closeButton.title = loadTimeData.getString('removethumbnailtooltip');
52 this.appendChild(closeButton); 52 this.appendChild(closeButton);
53 }, 53 },
54 54
55 /** 55 /**
56 * Update the appearance of this tile according to |data|. 56 * Update the appearance of this tile according to |data|.
57 * @param {Object} data A dictionary of relevant data for the page. 57 * @param {Object} data A dictionary of relevant data for the page.
58 */ 58 */
59 setData: function(data) { 59 set data(data) {
60 Object.getOwnPropertyDescriptor(Thumbnail.prototype, 'data').set.apply(
61 this, arguments);
62
60 if (this.classList.contains('blacklisted') && data) { 63 if (this.classList.contains('blacklisted') && data) {
61 // Animate appearance of new tile. 64 // Animate appearance of new tile.
62 this.classList.add('new-tile-contents'); 65 this.classList.add('new-tile-contents');
63 } 66 }
64 this.classList.remove('blacklisted'); 67 this.classList.remove('blacklisted');
65 68 },
66 Thumbnail.prototype.setData.apply(this, arguments); 69 get data() {
70 return this.data_;
Dan Beam 2012/12/07 05:05:31 nit: what does this offer over Thumbnail.data / do
pedro (no code reviews) 2012/12/07 21:54:55 Yes, I do need this. I might be missing something
Dan Beam 2012/12/07 22:31:07 in JS, "private" members exist on all sub classes
pedro (no code reviews) 2012/12/10 19:44:43 I guess I wasn't clear enough in my previous comme
67 }, 71 },
68 72
69 /** 73 /**
70 * Handles a click on the tile. 74 * Handles a click on the tile.
71 * @param {Event} e The click event. 75 * @param {Event} e The click event.
72 * @private 76 * @private
73 */ 77 */
74 handleClick_: function(e) { 78 handleClick_: function(e) {
75 if (e.target.classList.contains('close-button')) { 79 if (e.target.classList.contains('close-button')) {
76 this.blacklist_(); 80 this.blacklist_();
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 chrome.send('mostVisitedSelected'); 230 chrome.send('mostVisitedSelected');
227 } 231 }
228 }; 232 };
229 233
230 return { 234 return {
231 MostVisitedPage: MostVisitedPage, 235 MostVisitedPage: MostVisitedPage,
232 }; 236 };
233 }); 237 });
234 238
235 document.addEventListener('ntpLoaded', ntp.MostVisitedPage.onLoaded); 239 document.addEventListener('ntpLoaded', ntp.MostVisitedPage.onLoaded);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698