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

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

Issue 944183002: HostTableEntry refactor (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address Jamie's feedback Created 5 years, 9 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/main.css ('k') | remoting/webapp/browser_test/browser_test.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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 * @implements {base.Disposable} 67 * @implements {base.Disposable}
68 */ 68 */
69 base.Disposables = function(var_args) { 69 base.Disposables = function(var_args) {
70 /** 70 /**
71 * @type {Array<base.Disposable>} 71 * @type {Array<base.Disposable>}
72 * @private 72 * @private
73 */ 73 */
74 this.disposables_ = Array.prototype.slice.call(arguments, 0); 74 this.disposables_ = Array.prototype.slice.call(arguments, 0);
75 }; 75 };
76 76
77 /**
78 * @param {...base.Disposable} var_args
79 */
80 base.Disposables.prototype.add = function(var_args) {
81 var disposables = Array.prototype.slice.call(arguments, 0);
82 for (var i = 0; i < disposables.length; i++) {
83 var current = /** @type {base.Disposable} */ (disposables[i]);
84 if (this.disposables_.indexOf(current) === -1) {
85 this.disposables_.push(current);
86 }
87 }
88 };
89
90 /**
91 * @param {...base.Disposable} var_args Dispose |var_args| and remove
92 * them from the current object.
93 */
94 base.Disposables.prototype.remove = function(var_args) {
95 var disposables = Array.prototype.slice.call(arguments, 0);
96 for (var i = 0; i < disposables.length; i++) {
97 var disposable = /** @type {base.Disposable} */ (disposables[i]);
98 var index = this.disposables_.indexOf(disposable);
99 if(index !== -1) {
100 this.disposables_.splice(index, 1);
101 disposable.dispose();
102 }
103 }
104 };
105
77 base.Disposables.prototype.dispose = function() { 106 base.Disposables.prototype.dispose = function() {
78 for (var i = 0; i < this.disposables_.length; i++) { 107 for (var i = 0; i < this.disposables_.length; i++) {
79 this.disposables_[i].dispose(); 108 this.disposables_[i].dispose();
80 } 109 }
81 this.disposables_ = null; 110 this.disposables_ = null;
82 }; 111 };
83 112
84 /** 113 /**
85 * A utility function to invoke |obj|.dispose without a null check on |obj|. 114 * A utility function to invoke |obj|.dispose without a null check on |obj|.
86 * @param {base.Disposable} obj 115 * @param {base.Disposable} obj
(...skipping 532 matching lines...) Expand 10 before | Expand all | Expand 10 after
619 */ 648 */
620 base.resizeWindowToContent = function() { 649 base.resizeWindowToContent = function() {
621 var appWindow = chrome.app.window.current(); 650 var appWindow = chrome.app.window.current();
622 var outerBounds = appWindow.outerBounds; 651 var outerBounds = appWindow.outerBounds;
623 var borderY = outerBounds.height - appWindow.innerBounds.height; 652 var borderY = outerBounds.height - appWindow.innerBounds.height;
624 appWindow.resizeTo(outerBounds.width, document.body.clientHeight + borderY); 653 appWindow.resizeTo(outerBounds.width, document.body.clientHeight + borderY);
625 // Sometimes, resizing the window causes its position to be reset to (0, 0), 654 // Sometimes, resizing the window causes its position to be reset to (0, 0),
626 // so restore it explicitly. 655 // so restore it explicitly.
627 appWindow.moveTo(outerBounds.left, outerBounds.top); 656 appWindow.moveTo(outerBounds.left, outerBounds.top);
628 }; 657 };
OLDNEW
« no previous file with comments | « remoting/webapp/base/html/main.css ('k') | remoting/webapp/browser_test/browser_test.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698