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

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: Merged with trunk. 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
« no previous file with comments | « chrome/browser/resources/new_tab.js ('k') | chrome/browser/resources/ntp4/new_tab.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 298 matching lines...) Expand 10 before | Expand all | Expand 10 after
309 get data() { 309 get data() {
310 return this.data_; 310 return this.data_;
311 }, 311 },
312 set data(data) { 312 set data(data) {
313 var startTime = Date.now(); 313 var startTime = Date.now();
314 314
315 // The first time data is set, create the tiles. 315 // The first time data is set, create the tiles.
316 if (!this.data_) { 316 if (!this.data_) {
317 this.createTiles_(); 317 this.createTiles_();
318 this.data_ = data.slice(0, THUMBNAIL_COUNT); 318 this.data_ = data.slice(0, THUMBNAIL_COUNT);
319 // Display the sync notification when the page is first initialized - we
320 // don't want to display the notification multiple times, so we do this
321 // here instead of refreshData().
322 if (templateData.syncNotification)
323 this.showSyncNotification_();
319 } else { 324 } else {
320 this.data_ = refreshData(this.data_, data); 325 this.data_ = refreshData(this.data_, data);
321 } 326 }
322 327
323 this.updateTiles_(); 328 this.updateTiles_();
324 logEvent('mostVisited.layout: ' + (Date.now() - startTime)); 329 logEvent('mostVisited.layout: ' + (Date.now() - startTime));
325 }, 330 },
326 331
332 /**
333 * Displays a sync-related notification on the NTP.
334 * @private
335 */
336 showSyncNotification_: function() {
337 var advancedOptionsLink = {
338 action: function() {
339 chrome.send('SyncTypeLinkClicked');
340 },
341 text: templateData.syncLinkText
342 };
343 ntp4.showNotification(templateData.syncNotification,
344 [advancedOptionsLink],
345 function() {
346 chrome.send('closeSyncNotification');
347 });
348 },
349
327 /** @inheritDoc */ 350 /** @inheritDoc */
328 shouldAcceptDrag: function(e) { 351 shouldAcceptDrag: function(e) {
329 return false; 352 return false;
330 }, 353 },
331 354
332 /** @inheritDoc */ 355 /** @inheritDoc */
333 heightForWidth: heightForWidth, 356 heightForWidth: heightForWidth,
334 }; 357 };
335 358
336 /** 359 /**
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
409 if (tile) 432 if (tile)
410 tile.setStripeColor(color); 433 tile.setStripeColor(color);
411 }; 434 };
412 435
413 return { 436 return {
414 MostVisitedPage: MostVisitedPage, 437 MostVisitedPage: MostVisitedPage,
415 refreshData: refreshData, 438 refreshData: refreshData,
416 setFaviconDominantColor: setFaviconDominantColor, 439 setFaviconDominantColor: setFaviconDominantColor,
417 }; 440 };
418 }); 441 });
OLDNEW
« no previous file with comments | « chrome/browser/resources/new_tab.js ('k') | chrome/browser/resources/ntp4/new_tab.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698