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 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
303 this.nodeControls_.appendChild(this.controlShow_); | 303 this.nodeControls_.appendChild(this.controlShow_); |
304 } else { | 304 } else { |
305 this.controlShow_ = null; | 305 this.controlShow_ = null; |
306 } | 306 } |
307 | 307 |
308 this.controlRetry_ = document.createElement('a'); | 308 this.controlRetry_ = document.createElement('a'); |
309 this.controlRetry_.textContent = loadTimeData.getString('control_retry'); | 309 this.controlRetry_.textContent = loadTimeData.getString('control_retry'); |
310 this.nodeControls_.appendChild(this.controlRetry_); | 310 this.nodeControls_.appendChild(this.controlRetry_); |
311 | 311 |
312 // Pause/Resume are a toggle. | 312 // Pause/Resume are a toggle. |
313 this.controlPause_ = createLink(this.togglePause_.bind(this), | 313 this.controlPause_ = createLink(this.pause_.bind(this), |
314 loadTimeData.getString('control_pause')); | 314 loadTimeData.getString('control_pause')); |
315 this.nodeControls_.appendChild(this.controlPause_); | 315 this.nodeControls_.appendChild(this.controlPause_); |
316 | 316 |
317 this.controlResume_ = createLink(this.togglePause_.bind(this), | 317 this.controlResume_ = createLink(this.resume_.bind(this), |
318 loadTimeData.getString('control_resume')); | 318 loadTimeData.getString('control_resume')); |
319 this.nodeControls_.appendChild(this.controlResume_); | 319 this.nodeControls_.appendChild(this.controlResume_); |
320 | 320 |
321 this.controlRemove_ = createLink(this.remove_.bind(this), | 321 this.controlRemove_ = createLink(this.remove_.bind(this), |
322 loadTimeData.getString('control_removefromlist')); | 322 loadTimeData.getString('control_removefromlist')); |
323 this.nodeControls_.appendChild(this.controlRemove_); | 323 this.nodeControls_.appendChild(this.controlRemove_); |
324 | 324 |
325 this.controlCancel_ = createLink(this.cancel_.bind(this), | 325 this.controlCancel_ = createLink(this.cancel_.bind(this), |
326 loadTimeData.getString('control_cancel')); | 326 loadTimeData.getString('control_cancel')); |
327 this.nodeControls_.appendChild(this.controlCancel_); | 327 this.nodeControls_.appendChild(this.controlCancel_); |
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
604 Download.prototype.show_ = function() { | 604 Download.prototype.show_ = function() { |
605 chrome.send('show', [this.id_.toString()]); | 605 chrome.send('show', [this.id_.toString()]); |
606 return false; | 606 return false; |
607 }; | 607 }; |
608 | 608 |
609 /** | 609 /** |
610 * Tells the backend to pause this download. | 610 * Tells the backend to pause this download. |
611 * @return {boolean} Returns false to prevent the default action. | 611 * @return {boolean} Returns false to prevent the default action. |
612 * @private | 612 * @private |
613 */ | 613 */ |
614 Download.prototype.togglePause_ = function() { | 614 Download.prototype.pause_ = function() { |
615 chrome.send('togglepause', [this.id_.toString()]); | 615 chrome.send('pause', [this.id_.toString()]); |
616 return false; | 616 return false; |
617 }; | 617 }; |
618 | 618 |
| 619 /** |
| 620 * Tells the backend to resume this download. |
| 621 * @return {boolean} Returns false to prevent the default action. |
| 622 * @private |
| 623 */ |
| 624 Download.prototype.resume_ = function() { |
| 625 chrome.send('resume', [this.id_.toString()]); |
| 626 return false; |
| 627 }; |
| 628 |
619 /** | 629 /** |
620 * Tells the backend to remove this download from history and download shelf. | 630 * Tells the backend to remove this download from history and download shelf. |
621 * @return {boolean} Returns false to prevent the default action. | 631 * @return {boolean} Returns false to prevent the default action. |
622 * @private | 632 * @private |
623 */ | 633 */ |
624 Download.prototype.remove_ = function() { | 634 Download.prototype.remove_ = function() { |
625 chrome.send('remove', [this.id_.toString()]); | 635 chrome.send('remove', [this.id_.toString()]); |
626 return false; | 636 return false; |
627 }; | 637 }; |
628 | 638 |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
738 if (Date.now() - start > 50) { | 748 if (Date.now() - start > 50) { |
739 clearTimeout(resultsTimeout); | 749 clearTimeout(resultsTimeout); |
740 resultsTimeout = setTimeout(tryDownloadUpdatedPeriodically, 5); | 750 resultsTimeout = setTimeout(tryDownloadUpdatedPeriodically, 5); |
741 break; | 751 break; |
742 } | 752 } |
743 } | 753 } |
744 } | 754 } |
745 | 755 |
746 // Add handlers to HTML elements. | 756 // Add handlers to HTML elements. |
747 window.addEventListener('DOMContentLoaded', load); | 757 window.addEventListener('DOMContentLoaded', load); |
OLD | NEW |