Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2174)

Side by Side Diff: remoting/webapp/base/js/base.js

Issue 1081813007: Make loading dialog prettier. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Reviewer feedback. Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « remoting/webapp/base/html/message_window.css ('k') | remoting/webapp/base/js/message_window.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 765 matching lines...) Expand 10 before | Expand all | Expand 10 after
776 * Return the current time as a formatted string suitable for logging. 776 * Return the current time as a formatted string suitable for logging.
777 * 777 *
778 * @return {string} The current time, formatted as the standard ISO string. 778 * @return {string} The current time, formatted as the standard ISO string.
779 * [yyyy-mm-ddDhh:mm:ss.xyz] 779 * [yyyy-mm-ddDhh:mm:ss.xyz]
780 */ 780 */
781 base.timestamp = function() { 781 base.timestamp = function() {
782 return '[' + new Date().toISOString() + ']'; 782 return '[' + new Date().toISOString() + ']';
783 }; 783 };
784 784
785 /** 785 /**
786 * Size the current window to fit its content vertically. 786 * Size the current window to fit its content.
787 * @param {boolean=} opt_centerWindow If true, position the window in the
788 * center of the screen after resizing it.
787 */ 789 */
788 base.resizeWindowToContent = function() { 790 base.resizeWindowToContent = function(opt_centerWindow) {
789 var appWindow = chrome.app.window.current(); 791 var appWindow = chrome.app.window.current();
790 var outerBounds = appWindow.outerBounds; 792 var outerBounds = appWindow.outerBounds;
793 var borderX = outerBounds.width - appWindow.innerBounds.width;
791 var borderY = outerBounds.height - appWindow.innerBounds.height; 794 var borderY = outerBounds.height - appWindow.innerBounds.height;
792 appWindow.resizeTo(outerBounds.width, document.body.clientHeight + borderY); 795 var newWidth = document.documentElement.scrollWidth + borderX;
796 var newHeight = document.documentElement.scrollHeight + borderY;
797 appWindow.resizeTo(newWidth, newHeight);
798 var left = outerBounds.left;
799 var top = outerBounds.top;
800 if (opt_centerWindow) {
801 var screenWidth = screen.availWidth;
802 var screenHeight = screen.availHeight;
803 left = (screenWidth - newWidth) / 2;
804 top = (screenHeight - newHeight) / 2;
805 }
793 // Sometimes, resizing the window causes its position to be reset to (0, 0), 806 // Sometimes, resizing the window causes its position to be reset to (0, 0),
794 // so restore it explicitly. 807 // so restore it explicitly, even if it doesn't need to be centered.
795 appWindow.moveTo(outerBounds.left, outerBounds.top); 808 appWindow.moveTo(left, top);
796 }; 809 };
OLDNEW
« no previous file with comments | « remoting/webapp/base/html/message_window.css ('k') | remoting/webapp/base/js/message_window.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698