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

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

Issue 7398026: Added a link to the downloads tab that opens the downloads folder. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Created 9 years, 5 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 /////////////////////////////////////////////////////////////////////////////// 5 ///////////////////////////////////////////////////////////////////////////////
6 // Helper functions 6 // Helper functions
7 function $(o) {return document.getElementById(o);} 7 function $(o) {return document.getElementById(o);}
8 8
9 /** 9 /**
10 * Sets the display style of a node. 10 * Sets the display style of a node.
(...skipping 557 matching lines...) Expand 10 before | Expand all | Expand 10 after
568 } 568 }
569 569
570 function clearAll() { 570 function clearAll() {
571 fifo_results.length = 0; 571 fifo_results.length = 0;
572 downloads.clear(); 572 downloads.clear();
573 downloads.setSearchText(''); 573 downloads.setSearchText('');
574 chrome.send('clearAll', []); 574 chrome.send('clearAll', []);
575 return false; 575 return false;
576 } 576 }
577 577
578 function openDownloadsFolder() {
579 chrome.send('openDownloadsFolder');
asanka 2011/07/18 17:18:48 return false; or better yet, use event.preventDefa
580 }
581
578 /////////////////////////////////////////////////////////////////////////////// 582 ///////////////////////////////////////////////////////////////////////////////
579 // Chrome callbacks: 583 // Chrome callbacks:
580 /** 584 /**
581 * Our history system calls this function with results from searches or when 585 * Our history system calls this function with results from searches or when
582 * downloads are added or removed. 586 * downloads are added or removed.
583 */ 587 */
584 function downloadsList(results) { 588 function downloadsList(results) {
585 if (resultsTimeout) 589 if (resultsTimeout)
586 clearTimeout(resultsTimeout); 590 clearTimeout(resultsTimeout);
587 fifo_results.length = 0; 591 fifo_results.length = 0;
(...skipping 27 matching lines...) Expand all
615 if (Date.now() - start > 50) { 619 if (Date.now() - start > 50) {
616 clearTimeout(resultsTimeout); 620 clearTimeout(resultsTimeout);
617 resultsTimeout = setTimeout(tryDownloadUpdatedPeriodically, 5); 621 resultsTimeout = setTimeout(tryDownloadUpdatedPeriodically, 5);
618 break; 622 break;
619 } 623 }
620 } 624 }
621 } 625 }
622 626
623 // Add handlers to HTML elements. 627 // Add handlers to HTML elements.
624 document.body.onload = load; 628 document.body.onload = load;
629
625 var clearAllLink = $('clear-all'); 630 var clearAllLink = $('clear-all');
626 clearAllLink.onclick = function () { clearAll(''); }; 631 clearAllLink.onclick = function () { clearAll(''); };
627 clearAllLink.oncontextmenu = function() { return false; }; 632
633 var openDownloadsFolderLink = $('open-downloads-folder');
634 openDownloadsFolderLink.onclick = openDownloadsFolder;
635
636 clearAllLink.oncontextmenu = openDownloadsFolderLink.oncontextmenu =
benjhayden 2011/07/18 19:07:54 Nit: Would you mind separating these assignments?
637 function() { return false; };
628 638
629 $('search-link').onclick = function () { 639 $('search-link').onclick = function () {
630 setSearch(''); 640 setSearch('');
631 return false; 641 return false;
632 }; 642 };
633 $('search-form').onsubmit = function () { 643 $('search-form').onsubmit = function () {
634 setSearch(this.term.value); 644 setSearch(this.term.value);
635 return false; 645 return false;
636 }; 646 };
637
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698