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

Side by Side Diff: remoting/webapp/me2mom/toolbar.js

Issue 8897017: Fix null pointer error. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Review Created 9 years 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 | Annotate | Revision Log
« no previous file with comments | « remoting/webapp/me2mom/client_session.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 * Class representing the client tool-bar. 7 * Class representing the client tool-bar.
8 */ 8 */
9 9
10 'use strict'; 10 'use strict';
11 11
12 /** @suppress {duplicate} */ 12 /** @suppress {duplicate} */
13 var remoting = remoting || {}; 13 var remoting = remoting || {};
14 14
15 /** 15 /**
16 * @param {Element} toolbar The HTML element representing the tool-bar. 16 * @param {Element} toolbar The HTML element representing the tool-bar.
17 * @constructor 17 * @constructor
18 */ 18 */
19 remoting.Toolbar = function(toolbar) { 19 remoting.Toolbar = function(toolbar) {
20 /** 20 /**
21 * @type {Element} 21 * @type {Element}
22 * @private 22 * @private
23 */ 23 */
24 this.toolbar_ = toolbar; 24 this.toolbar_ = toolbar;
25 /**
26 * @type {boolean} False if the tool-bar is currently hidden, or should be
27 * hidden once the over-shoot timer expires; true otherwise.
28 */
29 this.visible = false;
30 /**
31 * @type {number?} The id of the current timer, if any.
32 */
33 this.timerId = null;
34
25 /** @type {remoting.Toolbar} */ 35 /** @type {remoting.Toolbar} */
26 var that = this; 36 var that = this;
27 37
28 /** 38 /**
29 * @param {Event} event The mouseout event, used to determine whether or 39 * @param {Event} event The mouseout event, used to determine whether or
30 * not the mouse is leaving the tool-bar or (due to event-bubbling) 40 * not the mouse is leaving the tool-bar or (due to event-bubbling)
31 * one of its children. 41 * one of its children.
32 */ 42 */
33 var onMouseOut = function(event) { 43 var onMouseOut = function(event) {
34 for (var e = event.toElement; e != null; e = e.parentElement) { 44 for (var e = event.toElement; e != null; e = e.parentElement) {
35 if (e == that.toolbar_) { 45 if (e == that.toolbar_) {
36 return; // Still over a child element => ignore. 46 return; // Still over a child element => ignore.
37 } 47 }
38 } 48 }
39 that.hide_(); 49 that.hide_();
40 }; 50 };
41 this.toolbar_.onmouseout = onMouseOut; 51 this.toolbar_.onmouseout = onMouseOut;
42 52
43 this.toolbar_.onmouseover = function() { 53 this.toolbar_.onmouseover = function() {
44 that.showForAtLeast_(1000); 54 that.showForAtLeast_(1000);
45 }; 55 };
46 56
47 /** 57 window.addEventListener('resize', function() { that.center(); }, false);
48 * @type {boolean} False if the tool-bar is currently hidden, or should be
49 * hidden once the over-shoot timer expires; true otherwise.
50 */
51 this.visible = false;
52 /**
53 * @type {number?} The id of the current timer, if any.
54 */
55 this.timerId = null;
56 }; 58 };
57 59
58 /** 60 /**
59 * Preview the tool-bar functionality by showing it for 3s if it is not 61 * Preview the tool-bar functionality by showing it for 3s if it is not
60 * already visible. 62 * already visible.
61 * @return {void} Nothing. 63 * @return {void} Nothing.
62 */ 64 */
63 remoting.Toolbar.prototype.preview = function() { 65 remoting.Toolbar.prototype.preview = function() {
64 this.showForAtLeast_(3000); 66 this.showForAtLeast_(3000);
65 this.visible = false; 67 this.visible = false;
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 if (!this.visible) { 130 if (!this.visible) {
129 removeClass(this.toolbar_, remoting.Toolbar.VISIBLE_CLASS_); 131 removeClass(this.toolbar_, remoting.Toolbar.VISIBLE_CLASS_);
130 } 132 }
131 }; 133 };
132 134
133 /** @type {remoting.Toolbar} */ 135 /** @type {remoting.Toolbar} */
134 remoting.toolbar = null; 136 remoting.toolbar = null;
135 137
136 /** @private */ 138 /** @private */
137 remoting.Toolbar.VISIBLE_CLASS_ = 'toolbar-visible'; 139 remoting.Toolbar.VISIBLE_CLASS_ = 'toolbar-visible';
OLDNEW
« no previous file with comments | « remoting/webapp/me2mom/client_session.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698