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

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

Issue 1091103002: [Webapp Refactor] Fix styles in SmartReconnector. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix Indent Created 5 years, 8 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 | « no previous file | remoting/webapp/crd/js/smart_reconnector.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 664 matching lines...) Expand 10 before | Expand all | Expand 10 after
675 callback(); 675 callback();
676 } 676 }
677 }; 677 };
678 678
679 base.RepeatingTimer.prototype.dispose = function() { 679 base.RepeatingTimer.prototype.dispose = function() {
680 window.clearInterval(this.intervalId_); 680 window.clearInterval(this.intervalId_);
681 this.intervalId_ = null; 681 this.intervalId_ = null;
682 }; 682 };
683 683
684 /** 684 /**
685 * A disposable one shot timer.
686 *
687 * @param {Function} callback
688 * @param {number} timeout
689 *
690 * @constructor
691 * @implements {base.Disposable}
692 */
693 base.OneShotTimer = function(callback, timeout) {
694 var that = this;
695
696 /** @private */
697 this.timerId_ = window.setTimeout(function() {
698 that.timerId_ = null;
699 callback();
700 }, timeout);
701 };
702
703 base.OneShotTimer.prototype.dispose = function() {
704 if (this.timerId_ !== null) {
705 window.clearTimeout(this.timerId_);
706 this.timerId_ = null;
707 }
708 };
709
710 /**
685 * Converts UTF-8 string to ArrayBuffer. 711 * Converts UTF-8 string to ArrayBuffer.
686 * 712 *
687 * @param {string} string 713 * @param {string} string
688 * @return {ArrayBuffer} 714 * @return {ArrayBuffer}
689 */ 715 */
690 base.encodeUtf8 = function(string) { 716 base.encodeUtf8 = function(string) {
691 var utf8String = unescape(encodeURIComponent(string)); 717 var utf8String = unescape(encodeURIComponent(string));
692 var result = new Uint8Array(utf8String.length); 718 var result = new Uint8Array(utf8String.length);
693 for (var i = 0; i < utf8String.length; i++) 719 for (var i = 0; i < utf8String.length; i++)
694 result[i] = utf8String.charCodeAt(i); 720 result[i] = utf8String.charCodeAt(i);
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
751 */ 777 */
752 base.resizeWindowToContent = function() { 778 base.resizeWindowToContent = function() {
753 var appWindow = chrome.app.window.current(); 779 var appWindow = chrome.app.window.current();
754 var outerBounds = appWindow.outerBounds; 780 var outerBounds = appWindow.outerBounds;
755 var borderY = outerBounds.height - appWindow.innerBounds.height; 781 var borderY = outerBounds.height - appWindow.innerBounds.height;
756 appWindow.resizeTo(outerBounds.width, document.body.clientHeight + borderY); 782 appWindow.resizeTo(outerBounds.width, document.body.clientHeight + borderY);
757 // Sometimes, resizing the window causes its position to be reset to (0, 0), 783 // Sometimes, resizing the window causes its position to be reset to (0, 0),
758 // so restore it explicitly. 784 // so restore it explicitly.
759 appWindow.moveTo(outerBounds.left, outerBounds.top); 785 appWindow.moveTo(outerBounds.left, outerBounds.top);
760 }; 786 };
OLDNEW
« no previous file with comments | « no previous file | remoting/webapp/crd/js/smart_reconnector.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698