| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 * @fileoverview | 6 * @fileoverview |
| 7 * Class for detecting when the application is idle. Note that chrome.idle is | 7 * Class for detecting when the application is idle. Note that chrome.idle is |
| 8 * not suitable for this purpose because it detects when the computer is idle, | 8 * not suitable for this purpose because it detects when the computer is idle, |
| 9 * and we'd like to close the application and free up VM resources even if the | 9 * and we'd like to close the application and free up VM resources even if the |
| 10 * user has been using another application for a long time. | 10 * user has been using another application for a long time. |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 /** | 141 /** |
| 142 * @param {boolean} show True to show the warning dialog; false to hide it. | 142 * @param {boolean} show True to show the warning dialog; false to hide it. |
| 143 * @private | 143 * @private |
| 144 */ | 144 */ |
| 145 remoting.IdleDetector.prototype.showIdleWarning_ = function(show) { | 145 remoting.IdleDetector.prototype.showIdleWarning_ = function(show) { |
| 146 this.idleWarning_.hidden = !show; | 146 this.idleWarning_.hidden = !show; |
| 147 remoting.windowShape.updateClientWindowShape(); | 147 remoting.windowShape.updateClientWindowShape(); |
| 148 } | 148 } |
| 149 | 149 |
| 150 /** | 150 /** |
| 151 * @param {Array.<{left: number, top: number, width: number, height: number}>} | 151 * @param {Array<{left: number, top: number, width: number, height: number}>} |
| 152 * rects List of rectangles. | 152 * rects List of rectangles. |
| 153 */ | 153 */ |
| 154 remoting.IdleDetector.prototype.addToRegion = function(rects) { | 154 remoting.IdleDetector.prototype.addToRegion = function(rects) { |
| 155 if (!this.idleWarning_.hidden) { | 155 if (!this.idleWarning_.hidden) { |
| 156 var dialog = this.idleWarning_.querySelector('.kd-modaldialog'); | 156 var dialog = this.idleWarning_.querySelector('.kd-modaldialog'); |
| 157 var rect = /** @type {ClientRect} */ (dialog.getBoundingClientRect()); | 157 var rect = /** @type {ClientRect} */ (dialog.getBoundingClientRect()); |
| 158 rects.push(rect); | 158 rects.push(rect); |
| 159 } | 159 } |
| 160 }; | 160 }; |
| 161 | 161 |
| 162 // Time-out after 1hr of no activity. | 162 // Time-out after 1hr of no activity. |
| 163 remoting.IdleDetector.kIdleTimeoutMs = 60 * 60 * 1000; | 163 remoting.IdleDetector.kIdleTimeoutMs = 60 * 60 * 1000; |
| 164 | 164 |
| 165 // Show the idle warning dialog for 2 minutes. | 165 // Show the idle warning dialog for 2 minutes. |
| 166 remoting.IdleDetector.kDialogTimeoutMs = 2 * 60 * 1000; | 166 remoting.IdleDetector.kDialogTimeoutMs = 2 * 60 * 1000; |
| OLD | NEW |