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

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

Issue 10907065: NTP5: Fix page blacklisting and remove recently closed tabs when they're clicked. Fix the styling … (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase and respond to Evan's comments. Created 8 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 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 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 * @param {Object} config TilePage configuration object. 132 * @param {Object} config TilePage configuration object.
133 */ 133 */
134 initialize: function(config) { 134 initialize: function(config) {
135 ThumbnailPage.prototype.initialize.apply(this, arguments); 135 ThumbnailPage.prototype.initialize.apply(this, arguments);
136 this.classList.add('recently-closed-page'); 136 this.classList.add('recently-closed-page');
137 }, 137 },
138 138
139 /** 139 /**
140 * Sets the data that will be used to create Thumbnails. 140 * Sets the data that will be used to create Thumbnails.
141 * @param {Array} data The array of data. 141 * @param {Array} data The array of data.
142 * @type (Array}
143 */ 142 */
144 set data(data) { 143 setData: function(data) {
145 var startTime = Date.now(); 144 var startTime = Date.now();
146 var maxTileCount = this.config_.maxTileCount; 145 ThumbnailPage.prototype.setData.apply(this, arguments);
147 146
148 this.data_ = data.slice(0, maxTileCount);
149 var dataLength = data.length;
150 var tileCount = this.tileCount;
151 // Create new tiles if necessary.
152 // TODO(jeremycho): Verify this handles the removal of tiles, once that
153 // functionality is supported.
154 if (tileCount < dataLength)
155 this.createTiles_(dataLength - tileCount);
156
157 this.updateTiles_();
158 // Only show the dot if we have recently closed tabs to display. 147 // Only show the dot if we have recently closed tabs to display.
159 var dot = this.navigationDot; 148 var dot = this.navigationDot;
160 if (dot) 149 if (this.data_.length == 0) {
161 dot.hidden = dataLength == 0; 150 dot.hidden = true;
151 // If the last tab has been removed (by a user click) and we're still on
152 // the Recently Closed page, fall back to the first page in the dot
153 // list.
154 var cardSlider = ntp.getCardSlider();
155 if (cardSlider.currentCardValue == this)
156 cardSlider.selectCard(0, true);
157 } else {
158 dot.hidden = false;
159 }
162 160
163 logEvent('recentlyClosed.layout: ' + (Date.now() - startTime)); 161 logEvent('recentlyClosed.layout: ' + (Date.now() - startTime));
164 } 162 }
165 }; 163 };
166 164
167 /** 165 /**
168 * Returns the text used for a recently closed window. 166 * Returns the text used for a recently closed window.
169 * @param {number} numTabs Number of tabs in the window. 167 * @param {number} numTabs Number of tabs in the window.
170 * @return {string} The text to use. 168 * @return {string} The text to use.
171 */ 169 */
172 function formatTabsText(numTabs) { 170 function formatTabsText(numTabs) {
173 if (numTabs == 1) 171 if (numTabs == 1)
174 return loadTimeData.getString('closedwindowsingle'); 172 return loadTimeData.getString('closedwindowsingle');
175 return loadTimeData.getStringF('closedwindowmultiple', numTabs); 173 return loadTimeData.getStringF('closedwindowmultiple', numTabs);
176 } 174 }
177 175
178 return { 176 return {
179 RecentlyClosedPage: RecentlyClosedPage, 177 RecentlyClosedPage: RecentlyClosedPage,
180 }; 178 };
181 }); 179 });
OLDNEW
« no previous file with comments | « chrome/browser/resources/ntp_search/new_tab.js ('k') | chrome/browser/resources/ntp_search/thumbnail_page.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698