| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 * Class to handle changes to auto-scan. | 6 * Class to handle changes to auto-scan. |
| 7 * | 7 * |
| 8 * @constructor | 8 * @constructor |
| 9 * @param {SwitchAccessInterface} switchAccess | 9 * @param {SwitchAccessInterface} switchAccess |
| 10 */ | 10 */ |
| 11 function AutoScanManager(switchAccess) { | 11 function AutoScanManager(switchAccess) { |
| 12 /** | 12 /** |
| 13 * SwitchAccess reference. | 13 * SwitchAccess reference. |
| 14 * |
| 14 * @private {SwitchAccessInterface} | 15 * @private {SwitchAccessInterface} |
| 15 */ | 16 */ |
| 16 this.switchAccess_ = switchAccess; | 17 this.switchAccess_ = switchAccess; |
| 17 | 18 |
| 18 /** | 19 /** |
| 19 * Auto-scan interval ID. | 20 * Auto-scan interval ID. |
| 20 * | 21 * |
| 21 * @private {number|undefined} | 22 * @private {number|undefined} |
| 22 */ | 23 */ |
| 23 this.intervalID_; | 24 this.intervalID_; |
| 24 | 25 |
| 25 /** | 26 /** |
| 26 * Length of auto-scan interval in milliseconds. | 27 * Length of auto-scan interval in milliseconds. |
| 27 * | 28 * |
| 28 * @private {number} | 29 * @private {number} |
| 29 */ | 30 */ |
| 30 this.scanTime_ = switchAccess.switchAccessPrefs.getNumberPref('autoScanTime'); | 31 this.scanTime_ = switchAccess.getNumberPref('autoScanTime'); |
| 31 | 32 |
| 32 let enabled = switchAccess.switchAccessPrefs.getBooleanPref('enableAutoScan'); | 33 let enabled = switchAccess.getBooleanPref('enableAutoScan'); |
| 33 if (enabled) | 34 if (enabled) |
| 34 this.start_(); | 35 this.start_(); |
| 35 } | 36 } |
| 36 | 37 |
| 37 AutoScanManager.prototype = { | 38 AutoScanManager.prototype = { |
| 38 /** | 39 /** |
| 39 * Stop the window from moving to the next node at a fixed interval. | 40 * Stop the window from moving to the next node at a fixed interval. |
| 40 * | 41 * |
| 41 * @private | 42 * @private |
| 42 */ | 43 */ |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 * Update this.scanTime_ to |scanTime|. Then, if auto-scan is currently | 94 * Update this.scanTime_ to |scanTime|. Then, if auto-scan is currently |
| 94 * running, restart it. | 95 * running, restart it. |
| 95 * | 96 * |
| 96 * @param {number} scanTime Auto-scan interval time in milliseconds. | 97 * @param {number} scanTime Auto-scan interval time in milliseconds. |
| 97 */ | 98 */ |
| 98 setScanTime: function(scanTime) { | 99 setScanTime: function(scanTime) { |
| 99 this.scanTime_ = scanTime; | 100 this.scanTime_ = scanTime; |
| 100 this.restartIfRunning(); | 101 this.restartIfRunning(); |
| 101 }, | 102 }, |
| 102 }; | 103 }; |
| OLD | NEW |