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

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

Issue 7481023: Adding notifications for new sync types. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: More changes for review feedback. 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 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 get data() { 263 get data() {
264 return this.data_; 264 return this.data_;
265 }, 265 },
266 set data(data) { 266 set data(data) {
267 var startTime = Date.now(); 267 var startTime = Date.now();
268 268
269 // The first time data is set, create the tiles. 269 // The first time data is set, create the tiles.
270 if (!this.data_) { 270 if (!this.data_) {
271 this.createTiles_(); 271 this.createTiles_();
272 this.data_ = data.slice(0, THUMBNAIL_COUNT); 272 this.data_ = data.slice(0, THUMBNAIL_COUNT);
273 // Display the sync notification when the page is first initialized - we
274 // don't want to display the notification multiple times, so we do this
275 // here instead of refreshData().
276 if (templateData.syncNotification)
277 this.showSyncNotification_();
273 } else { 278 } else {
274 this.data_ = refreshData(this.data_, data); 279 this.data_ = refreshData(this.data_, data);
275 } 280 }
276 281
277 this.updateTiles_(); 282 this.updateTiles_();
278 logEvent('mostVisited.layout: ' + (Date.now() - startTime)); 283 logEvent('mostVisited.layout: ' + (Date.now() - startTime));
279 }, 284 },
280 285
286 /**
287 * Displays a sync-related notification on the NTP.
288 * @private
289 */
290 showSyncNotification_: function() {
291 var advancedOptionsLink = {
292 action: function() {
293 chrome.send('SyncTypeLinkClicked');
294 },
295 text: templateData.syncLinkText
296 };
297 ntp4.showNotification(templateData.syncNotification,
298 [advancedOptionsLink],
299 function() {
300 chrome.send('closeSyncNotification');
301 });
302 },
303
281 /** @inheritDoc */ 304 /** @inheritDoc */
282 shouldAcceptDrag: function(e) { 305 shouldAcceptDrag: function(e) {
283 return false; 306 return false;
284 }, 307 },
285 308
286 /** @inheritDoc */ 309 /** @inheritDoc */
287 heightForWidth: heightForWidth, 310 heightForWidth: heightForWidth,
288 }; 311 };
289 312
290 /** 313 /**
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
363 if (tile) 386 if (tile)
364 tile.setStripeColor(color); 387 tile.setStripeColor(color);
365 }; 388 };
366 389
367 return { 390 return {
368 MostVisitedPage: MostVisitedPage, 391 MostVisitedPage: MostVisitedPage,
369 refreshData: refreshData, 392 refreshData: refreshData,
370 setFaviconDominantColor: setFaviconDominantColor, 393 setFaviconDominantColor: setFaviconDominantColor,
371 }; 394 };
372 }); 395 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698