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

Side by Side Diff: chrome/browser/resources/new_new_tab.js

Issue 164163: Merge 21869 - When there are no images to replace a blacklisted page, putting... (Closed) Base URL: svn://chrome-svn/chrome/branches/195/src/
Patch Set: Created 11 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 | « AUTHORS ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Property Changes:
Modified: svn:mergeinfo
Merged /trunk/src/chrome/browser/resources/new_new_tab.js:r21869
OLDNEW
1 1
2 // Helpers 2 // Helpers
3 3
4 function $(id) { 4 function $(id) {
5 return document.getElementById(id); 5 return document.getElementById(id);
6 } 6 }
7 7
8 // TODO(arv): Remove these when classList is available in HTML5. 8 // TODO(arv): Remove these when classList is available in HTML5.
9 // https://bugs.webkit.org/show_bug.cgi?id=20709 9 // https://bugs.webkit.org/show_bug.cgi?id=20709
10 function hasClass(el, name) { 10 function hasClass(el, name) {
(...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after
455 // Find new item. 455 // Find new item.
456 var newItem; 456 var newItem;
457 for (var i = 0; i < data.length; i++) { 457 for (var i = 0; i < data.length; i++) {
458 if (!(data[i].url in oldUrls)) { 458 if (!(data[i].url in oldUrls)) {
459 newItem = data[i]; 459 newItem = data[i];
460 break; 460 break;
461 } 461 }
462 } 462 }
463 463
464 if (!newItem) { 464 if (!newItem) {
465 newItem = {filler: true}; 465 // If no other page is available to replace the blacklisted item,
466 } 466 // we need to reorder items s.t. all filler items are in the rightmost
467 // indices.
468 mostVisitedPages(data);
467 469
468 // Replace old item with new item in the mostVisitedData array. 470 // Replace old item with new item in the mostVisitedData array.
469 if (oldIndex != -1) { 471 } else if (oldIndex != -1) {
470 mostVisitedData.splice(oldIndex, 1, newItem); 472 mostVisitedData.splice(oldIndex, 1, newItem);
471 mostVisitedPages(mostVisitedData); 473 mostVisitedPages(mostVisitedData);
472 addClass(el, 'fade-in'); 474 addClass(el, 'fade-in');
473 } 475 }
474 476
475 var text = localStrings.formatString('thumbnailremovednotification', 477 var text = localStrings.formatString('thumbnailremovednotification',
476 oldItem.title); 478 oldItem.title);
477 var actionText = localStrings.getString('undothumbnailremove'); 479 var actionText = localStrings.getString('undothumbnailremove');
478 480
479 // Show notification and add undo callback function. 481 // Show notification and add undo callback function.
(...skipping 933 matching lines...) Expand 10 before | Expand all | Expand 10 after
1413 el.addEventListener('dragover', bind(this.handleDragOver, this)); 1415 el.addEventListener('dragover', bind(this.handleDragOver, this));
1414 el.addEventListener('dragleave', bind(this.handleDragLeave, this)); 1416 el.addEventListener('dragleave', bind(this.handleDragLeave, this));
1415 el.addEventListener('drop', bind(this.handleDrop, this)); 1417 el.addEventListener('drop', bind(this.handleDrop, this));
1416 el.addEventListener('dragend', bind(this.handleDragEnd, this)); 1418 el.addEventListener('dragend', bind(this.handleDragEnd, this));
1417 el.addEventListener('drag', bind(this.handleDrag, this)); 1419 el.addEventListener('drag', bind(this.handleDrag, this));
1418 el.addEventListener('mousedown', bind(this.handleMouseDown, this)); 1420 el.addEventListener('mousedown', bind(this.handleMouseDown, this));
1419 } 1421 }
1420 }; 1422 };
1421 1423
1422 dnd.init(); 1424 dnd.init();
OLDNEW
« no previous file with comments | « AUTHORS ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698