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

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

Issue 8528046: Change "Show All Downloads" link to "Show all files" (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: rebase Created 9 years, 1 month 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 * Wrapper for chrome.send. 6 * Wrapper for chrome.send.
7 */ 7 */
8 function chromeSend(func, arg) { 8 function chromeSend(func, arg) {
9 if (arg == undefined) 9 if (arg == undefined)
10 arg = ''; 10 arg = '';
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 e.preventDefault(); // Suppress browser shortcuts. 48 e.preventDefault(); // Suppress browser shortcuts.
49 }; 49 };
50 50
51 document.body.addEventListener("blur", menu.clear); 51 document.body.addEventListener("blur", menu.clear);
52 document.body.addEventListener("click", menu.clear); 52 document.body.addEventListener("click", menu.clear);
53 document.body.addEventListener("contextmenu", function (e) { 53 document.body.addEventListener("contextmenu", function (e) {
54 e.preventDefault(); }); 54 e.preventDefault(); });
55 document.body.addEventListener("selectstart", function (e) { 55 document.body.addEventListener("selectstart", function (e) {
56 e.preventDefault(); }); 56 e.preventDefault(); });
57 57
58 var sadt = $('showalldownloadstext'); 58 var sadt = $('showallfilestext');
59 sadt.textContent = localStrings.getString('showalldownloads'); 59 sadt.textContent = localStrings.getString('showallfiles');
60 sadt.addEventListener("click", showAllDownloads); 60 sadt.addEventListener("click", showAllFiles);
61 61
62 downloadRowList = new DownloadRowList(); 62 downloadRowList = new DownloadRowList();
63 chromeSend('getDownloads'); 63 chromeSend('getDownloads');
64 } 64 }
65 65
66 /** 66 /**
67 * Testing. Allow this page to be loaded in a browser. 67 * Testing. Allow this page to be loaded in a browser.
68 * Create stubs for localStrings and chrome.send. 68 * Create stubs for localStrings and chrome.send.
69 */ 69 */
70 function initTestHarness() { 70 function initTestHarness() {
71 if (location.protocol != 'file:') 71 if (location.protocol != 'file:')
72 return; 72 return;
73 73
74 // Enable right click for dom inspector. 74 // Enable right click for dom inspector.
75 document.body.oncontextmenu = ''; 75 document.body.oncontextmenu = '';
76 76
77 // Fix localStrings. 77 // Fix localStrings.
78 localStrings = { 78 localStrings = {
79 getString: function(name) { 79 getString: function(name) {
80 if (name == 'showalldownloads') 80 if (name == 'showallfiles')
81 return 'Show All Downloads'; 81 return 'Show all files';
82 if (name == 'dangerousextension') 82 if (name == 'dangerousextension')
83 return 'Extensions, apps, and themes can harm your computer.' + 83 return 'Extensions, apps, and themes can harm your computer.' +
84 ' Are you sure you want to continue?' 84 ' Are you sure you want to continue?'
85 if (name == 'continue') 85 if (name == 'continue')
86 return 'Continue'; 86 return 'Continue';
87 if (name == 'discard') 87 if (name == 'discard')
88 return 'Discard'; 88 return 'Discard';
89 return name; 89 return name;
90 }, 90 },
91 getStringF: function(name, path) { 91 getStringF: function(name, path) {
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 * C++ api calls. 184 * C++ api calls.
185 */ 185 */
186 function downloadsList(results) { 186 function downloadsList(results) {
187 downloadRowList.list(results); 187 downloadRowList.list(results);
188 } 188 }
189 189
190 function downloadUpdated(result) { 190 function downloadUpdated(result) {
191 downloadRowList.update(result); 191 downloadRowList.update(result);
192 } 192 }
193 193
194 function showAllDownloads() { 194 function showAllFiles() {
195 chromeSend('openNewFullWindow', 'chrome://downloads'); 195 chromeSend('showAllFiles');
196 } 196 }
197 197
198 /** 198 /**
199 * DownloadRow contains all the elements that go into a row of the downloads 199 * DownloadRow contains all the elements that go into a row of the downloads
200 * list. It represents a single DownloadItem. 200 * list. It represents a single DownloadItem.
201 * 201 *
202 * @param {DownloadRowList} list Global DownloadRowList. 202 * @param {DownloadRowList} list Global DownloadRowList.
203 * @param {Object} result JSON representation of DownloadItem. 203 * @param {Object} result JSON representation of DownloadItem.
204 * @constructor 204 * @constructor
205 */ 205 */
(...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after
669 update: function(result) { 669 update: function(result) {
670 var row = this.getRow(result.file_path); 670 var row = this.getRow(result.file_path);
671 if (!row && !DiscardResult(result)) 671 if (!row && !DiscardResult(result))
672 row = new DownloadRow(this, result); 672 row = new DownloadRow(this, result);
673 673
674 row && row.update(result); 674 row && row.update(result);
675 }, 675 },
676 }; 676 };
677 677
678 document.addEventListener('DOMContentLoaded', init); 678 document.addEventListener('DOMContentLoaded', init);
OLDNEW
« no previous file with comments | « chrome/browser/resources/active_downloads.html ('k') | chrome/browser/ui/webui/active_downloads_ui.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698