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

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

Issue 492163004: downloads: Make header look more like settings, extensions, history, and (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 // TODO(jhawkins): Use hidden instead of showInline* and display:none. 5 // TODO(jhawkins): Use hidden instead of showInline* and display:none.
6 6
7 /** 7 /**
8 * The type of the download object. The definition is based on 8 * The type of the download object. The definition is based on
9 * chrome/browser/ui/webui/downloads_dom_handler.cc:CreateDownloadItemValue() 9 * chrome/browser/ui/webui/downloads_dom_handler.cc:CreateDownloadItemValue()
10 * @typedef {{by_ext_id: (string|undefined), 10 * @typedef {{by_ext_id: (string|undefined),
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 }; 141 };
142 142
143 /** 143 /**
144 * Update the summary block above the results 144 * Update the summary block above the results
145 */ 145 */
146 Downloads.prototype.updateSummary = function() { 146 Downloads.prototype.updateSummary = function() {
147 if (this.searchText_) { 147 if (this.searchText_) {
148 this.summary_.textContent = loadTimeData.getStringF('searchresultsfor', 148 this.summary_.textContent = loadTimeData.getStringF('searchresultsfor',
149 this.searchText_); 149 this.searchText_);
150 } else { 150 } else {
151 this.summary_.textContent = loadTimeData.getString('downloads'); 151 this.summary_.textContent = '';
152 } 152 }
153 153
154 var hasDownloads = false; 154 var hasDownloads = false;
155 for (var i in this.downloads_) { 155 for (var i in this.downloads_) {
156 hasDownloads = true; 156 hasDownloads = true;
157 break; 157 break;
158 } 158 }
159 }; 159 };
160 160
161 /** 161 /**
(...skipping 722 matching lines...) Expand 10 before | Expand all | Expand 10 after
884 clearAllHolder.appendChild(clearAllElement); 884 clearAllHolder.appendChild(clearAllElement);
885 clearAllElement.oncontextmenu = function() { return false; }; 885 clearAllElement.oncontextmenu = function() { return false; };
886 886
887 // TODO(jhawkins): Use a link-button here. 887 // TODO(jhawkins): Use a link-button here.
888 var openDownloadsFolderLink = $('open-downloads-folder'); 888 var openDownloadsFolderLink = $('open-downloads-folder');
889 openDownloadsFolderLink.onclick = function() { 889 openDownloadsFolderLink.onclick = function() {
890 chrome.send('openDownloadsFolder'); 890 chrome.send('openDownloadsFolder');
891 }; 891 };
892 openDownloadsFolderLink.oncontextmenu = function() { return false; }; 892 openDownloadsFolderLink.oncontextmenu = function() { return false; };
893 893
894 $('search-link').onclick = function(e) {
895 setSearch('');
896 e.preventDefault();
897 $('term').value = '';
898 return false;
899 };
900
901 $('term').onsearch = function(e) { 894 $('term').onsearch = function(e) {
902 setSearch($('term').value); 895 setSearch($('term').value);
903 }; 896 };
904 } 897 }
905 898
906 function setSearch(searchText) { 899 function setSearch(searchText) {
907 fifoResults.length = 0; 900 fifoResults.length = 0;
908 downloads.setSearchText(searchText); 901 downloads.setSearchText(searchText);
909 searchText = searchText.toString().match(/(?:[^\s"]+|"[^"]*")+/g); 902 searchText = searchText.toString().match(/(?:[^\s"]+|"[^"]*")+/g);
910 if (searchText) { 903 if (searchText) {
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
975 if (Date.now() - start > 50) { 968 if (Date.now() - start > 50) {
976 clearTimeout(resultsTimeout); 969 clearTimeout(resultsTimeout);
977 resultsTimeout = setTimeout(tryDownloadUpdatedPeriodically, 5); 970 resultsTimeout = setTimeout(tryDownloadUpdatedPeriodically, 5);
978 break; 971 break;
979 } 972 }
980 } 973 }
981 } 974 }
982 975
983 // Add handlers to HTML elements. 976 // Add handlers to HTML elements.
984 window.addEventListener('DOMContentLoaded', load); 977 window.addEventListener('DOMContentLoaded', load);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698