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

Side by Side Diff: chrome/browser/resources/new_tab.html

Issue 1618: Makes new tab page update properly when its told bookmarks are... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 12 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 <html id="t" jsvalues="dir:textdirection;firstview:firstview"> 1 <html id="t" jsvalues="dir:textdirection;firstview:firstview">
2 <!-- 2 <!--
3 This page is optimized for perceived performance. Our enemies are the time 3 This page is optimized for perceived performance. Our enemies are the time
4 taken for the backend to generate our data, and the time taken to parse 4 taken for the backend to generate our data, and the time taken to parse
5 and render the starting HTML/CSS content of the page. This page is 5 and render the starting HTML/CSS content of the page. This page is
6 designed to let Chrome do both of those things in parallel. 6 designed to let Chrome do both of those things in parallel.
7 7
8 1. Defines temporary content callback functions 8 1. Defines temporary content callback functions
9 2. Fires off requests for content (these can come back 20-150ms later) 9 2. Fires off requests for content (these can come back 20-150ms later)
10 3. Defines basic functions (handlers) 10 3. Defines basic functions (handlers)
(...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after
366 style="background-image:url(chrome-resource://favicon/);" 366 style="background-image:url(chrome-resource://favicon/);"
367 jsvalues="value:searchhistory" 367 jsvalues="value:searchhistory"
368 onfocus="handleInputFocus.apply(this);" 368 onfocus="handleInputFocus.apply(this);"
369 onblur="handleInputBlur.apply(this);" /> 369 onblur="handleInputBlur.apply(this);" />
370 </form> 370 </form>
371 <div id='searches-entries'></div> 371 <div id='searches-entries'></div>
372 </div> 372 </div>
373 373
374 <div id="recentlyBookmarked" class="sidebar" style="display:none"> 374 <div id="recentlyBookmarked" class="sidebar" style="display:none">
375 <span class="section-title" jscontent="bookmarks"></span> 375 <span class="section-title" jscontent="bookmarks"></span>
376 <div id="recentlyBookmarkedContainer"></div>
376 </div> 377 </div>
377 378
378 <div id="recentlyClosedTabs" class="sidebar" style="display:none"> 379 <div id="recentlyClosedTabs" class="sidebar" style="display:none">
379 <div class="section-title" jscontent="closedtabs"></div> 380 <div class="section-title" jscontent="closedtabs"></div>
380 <div id="recentlyClosedContainer"></div> 381 <div id="recentlyClosedContainer"></div>
381 </div> 382 </div>
382 </td> 383 </td>
383 </tr> 384 </tr>
384 </table> 385 </table>
385 386
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
530 } 531 }
531 532
532 logEvent('renderSearchURLs done'); 533 logEvent('renderSearchURLs done');
533 } 534 }
534 535
535 /* This function is called by the browser when the list of recently bookmarked 536 /* This function is called by the browser when the list of recently bookmarked
536 URLs is available. |entries| is a list of objects with title and url 537 URLs is available. |entries| is a list of objects with title and url
537 attributes. */ 538 attributes. */
538 function renderRecentlyBookmarked(entries) { 539 function renderRecentlyBookmarked(entries) {
539 logEvent('renderRecentlyBookmarked called: ' + entries.length); 540 logEvent('renderRecentlyBookmarked called: ' + entries.length);
540 var container = document.getElementById('recentlyBookmarked'); 541 var section = document.getElementById('recentlyBookmarked');
542 var container = document.getElementById('recentlyBookmarkedContainer');
543
544 /* recentlyBookmarked is called any time the bookmarks change. Remove existing
545 entries before adding new ones. */
546 section.style.display = 'none';
547 container.innerHTML = '';
541 548
542 if (entries.length > 0) { 549 if (entries.length > 0) {
543 container.style.display = 'block'; 550 section.style.display = 'block';
544 for (var i = 0, entry = entries[0]; entry = entries[i]; ++i) { 551 for (var i = 0, entry = entries[0]; entry = entries[i]; ++i) {
545 var link = DOM('a', {href: entry.url, className:'recent-bookmark', title:e ntry.title}); 552 var link = DOM('a', {href: entry.url, className:'recent-bookmark', title:e ntry.title});
546 link.style.backgroundImage = 553 link.style.backgroundImage =
547 'url("chrome-resource://favicon/' + entry.url + '")'; 554 'url("chrome-resource://favicon/' + entry.url + '")';
548 link.appendChild(document.createTextNode(entry.title)); 555 link.appendChild(document.createTextNode(entry.title));
549 container.appendChild(link); 556 container.appendChild(link);
550 } 557 }
551 } 558 }
552 559
553 logEvent('renderRecentlyBookmarked done'); 560 logEvent('renderRecentlyBookmarked done');
554 } 561 }
555 562
556 /* This function adds incoming information about tabs to the new tab UI. */ 563 /* This function adds incoming information about tabs to the new tab UI. */
557 function renderRecentlyClosedTabs(entries) { 564 function renderRecentlyClosedTabs(entries) {
558 logEvent('renderRecentlyClosedTabs begin'); 565 logEvent('renderRecentlyClosedTabs begin');
559 var section = document.getElementById('recentlyClosedTabs'); 566 var section = document.getElementById('recentlyClosedTabs');
560 var container = document.getElementById('recentlyClosedContainer'); 567 var container = document.getElementById('recentlyClosedContainer');
561 568
562 /* recentlyClosedTabs is called on every internal event which 569 /* recentlyClosedTabs is called on every internal event which
563 affects tab history to make sure things are up to 570 affects tab history to make sure things are up to
564 date. Therefore, reset the recentlyClosedTabs state on every 571 date. Therefore, reset the recentlyClosedTabs state on every
565 call. */ 572 call. */
566 section.style.display = 'none'; 573 section.style.display = 'none';
567 while(container.hasChildNodes()) { 574 container.innerHTML = '';
568 container.removeChild(container.firstChild);
569 }
570 575
571 if (entries.length > 0) { 576 if (entries.length > 0) {
572 section.style.display = 'block'; 577 section.style.display = 'block';
573 578
574 for (var i = 0; entry = entries[i]; ++i) { 579 for (var i = 0; entry = entries[i]; ++i) {
575 var link = DOM('a', {href:entry.url, className:'recent-bookmark', title:en try.title}); 580 var link = DOM('a', {href:entry.url, className:'recent-bookmark', title:en try.title});
576 581
577 link.onclick = function(sessionId) { 582 link.onclick = function(sessionId) {
578 return function() { 583 return function() {
579 /* This is a hack because chrome.send is hardcoded to only 584 /* This is a hack because chrome.send is hardcoded to only
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
612 processData(); 617 processData();
613 618
614 // In case renderMostVisitedItems doesn't come back quickly enough, begin 619 // In case renderMostVisitedItems doesn't come back quickly enough, begin
615 // the first-run fade-in. If it has started or if this is not a first 620 // the first-run fade-in. If it has started or if this is not a first
616 // run new tab, this will be a no-op. 621 // run new tab, this will be a no-op.
617 setTimeout(function(){document.getElementById('main').className = 'visible'}, 622 setTimeout(function(){document.getElementById('main').className = 'visible'},
618 1000); 623 1000);
619 </script> 624 </script>
620 </body> 625 </body>
621 </html> 626 </html>
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698