| 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 16 matching lines...) Expand all Loading... |
| 27 * Assert that |expr| is true else print the |opt_msg|. | 27 * Assert that |expr| is true else print the |opt_msg|. |
| 28 * @param {boolean} expr | 28 * @param {boolean} expr |
| 29 * @param {string=} opt_msg | 29 * @param {string=} opt_msg |
| 30 */ | 30 */ |
| 31 base.debug.assert = function(expr, opt_msg) { | 31 base.debug.assert = function(expr, opt_msg) { |
| 32 if (!expr) { | 32 if (!expr) { |
| 33 var msg = 'Assertion Failed.'; | 33 var msg = 'Assertion Failed.'; |
| 34 if (opt_msg) { | 34 if (opt_msg) { |
| 35 msg += ' ' + opt_msg; | 35 msg += ' ' + opt_msg; |
| 36 } | 36 } |
| 37 console.error(msg); | |
| 38 if (base.debug.breakOnAssert) { | 37 if (base.debug.breakOnAssert) { |
| 39 alert(msg); | 38 alert(msg); |
| 40 debugger; | 39 debugger; |
| 41 } | 40 } |
| 42 } | 41 } |
| 43 }; | 42 }; |
| 44 | 43 |
| 45 /** | 44 /** |
| 46 * @return {string} The callstack of the current method. | 45 * @return {string} The callstack of the current method. |
| 47 */ | 46 */ |
| (...skipping 617 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 665 */ | 664 */ |
| 666 base.resizeWindowToContent = function() { | 665 base.resizeWindowToContent = function() { |
| 667 var appWindow = chrome.app.window.current(); | 666 var appWindow = chrome.app.window.current(); |
| 668 var outerBounds = appWindow.outerBounds; | 667 var outerBounds = appWindow.outerBounds; |
| 669 var borderY = outerBounds.height - appWindow.innerBounds.height; | 668 var borderY = outerBounds.height - appWindow.innerBounds.height; |
| 670 appWindow.resizeTo(outerBounds.width, document.body.clientHeight + borderY); | 669 appWindow.resizeTo(outerBounds.width, document.body.clientHeight + borderY); |
| 671 // Sometimes, resizing the window causes its position to be reset to (0, 0), | 670 // Sometimes, resizing the window causes its position to be reset to (0, 0), |
| 672 // so restore it explicitly. | 671 // so restore it explicitly. |
| 673 appWindow.moveTo(outerBounds.left, outerBounds.top); | 672 appWindow.moveTo(outerBounds.left, outerBounds.top); |
| 674 }; | 673 }; |
| OLD | NEW |