| 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 * A module that contains basic utility components and methods for the | 7 * A module that contains basic utility components and methods for the |
| 8 * chromoting project | 8 * chromoting project |
| 9 * | 9 * |
| 10 */ | 10 */ |
| (...skipping 508 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 519 src.addEventListener(eventName, listener); | 519 src.addEventListener(eventName, listener); |
| 520 }; | 520 }; |
| 521 | 521 |
| 522 base.EventHook.prototype.dispose = function() { | 522 base.EventHook.prototype.dispose = function() { |
| 523 this.src_.removeEventListener(this.eventName_, this.listener_); | 523 this.src_.removeEventListener(this.eventName_, this.listener_); |
| 524 }; | 524 }; |
| 525 | 525 |
| 526 /** | 526 /** |
| 527 * An event hook implementation for DOM Events. | 527 * An event hook implementation for DOM Events. |
| 528 * | 528 * |
| 529 * @param {HTMLElement} src | 529 * @param {HTMLElement|Element} src |
| 530 * @param {string} eventName | 530 * @param {string} eventName |
| 531 * @param {function(...?)} listener | 531 * @param {function(...?)} listener |
| 532 * @param {boolean} capture | 532 * @param {boolean} capture |
| 533 * | 533 * |
| 534 * @constructor | 534 * @constructor |
| 535 * @implements {base.Disposable} | 535 * @implements {base.Disposable} |
| 536 */ | 536 */ |
| 537 base.DomEventHook = function(src, eventName, listener, capture) { | 537 base.DomEventHook = function(src, eventName, listener, capture) { |
| 538 this.src_ = src; | 538 this.src_ = src; |
| 539 this.eventName_ = eventName; | 539 this.eventName_ = eventName; |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 621 */ | 621 */ |
| 622 base.resizeWindowToContent = function() { | 622 base.resizeWindowToContent = function() { |
| 623 var appWindow = chrome.app.window.current(); | 623 var appWindow = chrome.app.window.current(); |
| 624 var outerBounds = appWindow.outerBounds; | 624 var outerBounds = appWindow.outerBounds; |
| 625 var borderY = outerBounds.height - appWindow.innerBounds.height; | 625 var borderY = outerBounds.height - appWindow.innerBounds.height; |
| 626 appWindow.resizeTo(outerBounds.width, document.body.clientHeight + borderY); | 626 appWindow.resizeTo(outerBounds.width, document.body.clientHeight + borderY); |
| 627 // Sometimes, resizing the window causes its position to be reset to (0, 0), | 627 // Sometimes, resizing the window causes its position to be reset to (0, 0), |
| 628 // so restore it explicitly. | 628 // so restore it explicitly. |
| 629 appWindow.moveTo(outerBounds.left, outerBounds.top); | 629 appWindow.moveTo(outerBounds.left, outerBounds.top); |
| 630 }; | 630 }; |
| OLD | NEW |