| OLD | NEW |
| 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 * Sets the display style of a node. | 8 * Sets the display style of a node. |
| 9 * @param {!Element} node The target element to show or hide. | 9 * @param {!Element} node The target element to show or hide. |
| 10 * @param {boolean} isShow Should the target element be visible. | 10 * @param {boolean} isShow Should the target element be visible. |
| (...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 332 this.controlRemove_ = createLink(this.remove_.bind(this), | 332 this.controlRemove_ = createLink(this.remove_.bind(this), |
| 333 loadTimeData.getString('control_removefromlist')); | 333 loadTimeData.getString('control_removefromlist')); |
| 334 this.controlRemove_.classList.add('control-remove-link'); | 334 this.controlRemove_.classList.add('control-remove-link'); |
| 335 } else { | 335 } else { |
| 336 this.controlRemove_ = document.createElement('span'); | 336 this.controlRemove_ = document.createElement('span'); |
| 337 this.controlRemove_.classList.add('disabled-link'); | 337 this.controlRemove_.classList.add('disabled-link'); |
| 338 var text = document.createTextNode( | 338 var text = document.createTextNode( |
| 339 loadTimeData.getString('control_removefromlist')); | 339 loadTimeData.getString('control_removefromlist')); |
| 340 this.controlRemove_.appendChild(text); | 340 this.controlRemove_.appendChild(text); |
| 341 } | 341 } |
| 342 if (!loadTimeData.getBoolean('show_delete_history')) |
| 343 this.controlRemove_.hidden = true; |
| 344 |
| 342 this.nodeControls_.appendChild(this.controlRemove_); | 345 this.nodeControls_.appendChild(this.controlRemove_); |
| 343 | 346 |
| 344 this.controlCancel_ = createLink(this.cancel_.bind(this), | 347 this.controlCancel_ = createLink(this.cancel_.bind(this), |
| 345 loadTimeData.getString('control_cancel')); | 348 loadTimeData.getString('control_cancel')); |
| 346 this.nodeControls_.appendChild(this.controlCancel_); | 349 this.nodeControls_.appendChild(this.controlCancel_); |
| 347 | 350 |
| 348 this.controlByExtension_ = document.createElement('span'); | 351 this.controlByExtension_ = document.createElement('span'); |
| 349 this.nodeControls_.appendChild(this.controlByExtension_); | 352 this.nodeControls_.appendChild(this.controlByExtension_); |
| 350 | 353 |
| 351 // Container for 'unsafe download' UI. | 354 // Container for 'unsafe download' UI. |
| (...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 726 var clearAllElement; | 729 var clearAllElement; |
| 727 if (loadTimeData.getBoolean('allow_deleting_history')) { | 730 if (loadTimeData.getBoolean('allow_deleting_history')) { |
| 728 clearAllElement = createLink(clearAll, loadTimeData.getString('clear_all')); | 731 clearAllElement = createLink(clearAll, loadTimeData.getString('clear_all')); |
| 729 clearAllElement.classList.add('clear-all-link'); | 732 clearAllElement.classList.add('clear-all-link'); |
| 730 clearAllHolder.classList.remove('disabled-link'); | 733 clearAllHolder.classList.remove('disabled-link'); |
| 731 } else { | 734 } else { |
| 732 clearAllElement = document.createTextNode( | 735 clearAllElement = document.createTextNode( |
| 733 loadTimeData.getString('clear_all')); | 736 loadTimeData.getString('clear_all')); |
| 734 clearAllHolder.classList.add('disabled-link'); | 737 clearAllHolder.classList.add('disabled-link'); |
| 735 } | 738 } |
| 739 if (!loadTimeData.getBoolean('show_delete_history')) |
| 740 clearAllHolder.hidden = true; |
| 741 |
| 736 clearAllHolder.appendChild(clearAllElement); | 742 clearAllHolder.appendChild(clearAllElement); |
| 737 clearAllElement.oncontextmenu = function() { return false; }; | 743 clearAllElement.oncontextmenu = function() { return false; }; |
| 738 | 744 |
| 739 // TODO(jhawkins): Use a link-button here. | 745 // TODO(jhawkins): Use a link-button here. |
| 740 var openDownloadsFolderLink = $('open-downloads-folder'); | 746 var openDownloadsFolderLink = $('open-downloads-folder'); |
| 741 openDownloadsFolderLink.onclick = function() { | 747 openDownloadsFolderLink.onclick = function() { |
| 742 chrome.send('openDownloadsFolder'); | 748 chrome.send('openDownloadsFolder'); |
| 743 }; | 749 }; |
| 744 openDownloadsFolderLink.oncontextmenu = function() { return false; }; | 750 openDownloadsFolderLink.oncontextmenu = function() { return false; }; |
| 745 | 751 |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 827 if (Date.now() - start > 50) { | 833 if (Date.now() - start > 50) { |
| 828 clearTimeout(resultsTimeout); | 834 clearTimeout(resultsTimeout); |
| 829 resultsTimeout = setTimeout(tryDownloadUpdatedPeriodically, 5); | 835 resultsTimeout = setTimeout(tryDownloadUpdatedPeriodically, 5); |
| 830 break; | 836 break; |
| 831 } | 837 } |
| 832 } | 838 } |
| 833 } | 839 } |
| 834 | 840 |
| 835 // Add handlers to HTML elements. | 841 // Add handlers to HTML elements. |
| 836 window.addEventListener('DOMContentLoaded', load); | 842 window.addEventListener('DOMContentLoaded', load); |
| OLD | NEW |