OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 handling creation and teardown of a remoting client session. | 7 * Class handling creation and teardown of a remoting client session. |
8 * | 8 * |
9 * The ClientSession class controls lifetime of the client plugin | 9 * The ClientSession class controls lifetime of the client plugin |
10 * object and provides the plugin with the functionality it needs to | 10 * object and provides the plugin with the functionality it needs to |
(...skipping 591 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
602 | 602 |
603 // Leave full-screen mode, and stop listening for related events. | 603 // Leave full-screen mode, and stop listening for related events. |
604 var listener = this.callOnFullScreenChanged_; | 604 var listener = this.callOnFullScreenChanged_; |
605 remoting.fullscreen.syncWithMaximize(false); | 605 remoting.fullscreen.syncWithMaximize(false); |
606 remoting.fullscreen.activate( | 606 remoting.fullscreen.activate( |
607 false, | 607 false, |
608 function() { | 608 function() { |
609 remoting.fullscreen.removeListener(listener); | 609 remoting.fullscreen.removeListener(listener); |
610 }); | 610 }); |
611 if (remoting.windowFrame) { | 611 if (remoting.windowFrame) { |
612 remoting.windowFrame.setConnected(false); | 612 remoting.windowFrame.setClientSession(null); |
| 613 } else { |
| 614 remoting.toolbar.setClientSession(null); |
613 } | 615 } |
614 remoting.toolbar.setClientSession(null); | |
615 | 616 |
616 // Remove mediasource-rendering class from the container - this will also | 617 // Remove mediasource-rendering class from the container - this will also |
617 // hide the <video> element. | 618 // hide the <video> element. |
618 this.container_.classList.remove('mediasource-rendering'); | 619 this.container_.classList.remove('mediasource-rendering'); |
619 | 620 |
620 this.container_.removeEventListener('mousemove', | 621 this.container_.removeEventListener('mousemove', |
621 this.updateMouseCursorPosition_, | 622 this.updateMouseCursorPosition_, |
622 true); | 623 true); |
623 }; | 624 }; |
624 | 625 |
(...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
988 if (this.resizeToClient_) { | 989 if (this.resizeToClient_) { |
989 var clientArea = this.getClientArea_(); | 990 var clientArea = this.getClientArea_(); |
990 this.plugin_.notifyClientResolution(clientArea.width, | 991 this.plugin_.notifyClientResolution(clientArea.width, |
991 clientArea.height, | 992 clientArea.height, |
992 window.devicePixelRatio); | 993 window.devicePixelRatio); |
993 } | 994 } |
994 // Activate full-screen related UX. | 995 // Activate full-screen related UX. |
995 remoting.fullscreen.addListener(this.callOnFullScreenChanged_); | 996 remoting.fullscreen.addListener(this.callOnFullScreenChanged_); |
996 remoting.fullscreen.syncWithMaximize(true); | 997 remoting.fullscreen.syncWithMaximize(true); |
997 if (remoting.windowFrame) { | 998 if (remoting.windowFrame) { |
998 remoting.windowFrame.setConnected(true); | 999 remoting.windowFrame.setClientSession(this); |
| 1000 } else { |
| 1001 remoting.toolbar.setClientSession(this); |
999 } | 1002 } |
1000 remoting.toolbar.setClientSession(this); | |
1001 | 1003 |
1002 this.container_.addEventListener('mousemove', | 1004 this.container_.addEventListener('mousemove', |
1003 this.updateMouseCursorPosition_, | 1005 this.updateMouseCursorPosition_, |
1004 true); | 1006 true); |
1005 | 1007 |
1006 } else if (status == remoting.ClientSession.State.FAILED) { | 1008 } else if (status == remoting.ClientSession.State.FAILED) { |
1007 switch (error) { | 1009 switch (error) { |
1008 case remoting.ClientSession.ConnectionError.HOST_IS_OFFLINE: | 1010 case remoting.ClientSession.ConnectionError.HOST_IS_OFFLINE: |
1009 this.error_ = remoting.Error.HOST_IS_OFFLINE; | 1011 this.error_ = remoting.Error.HOST_IS_OFFLINE; |
1010 break; | 1012 break; |
(...skipping 531 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1542 */ | 1544 */ |
1543 remoting.ClientSession.prototype.updateMouseCursorImage_ = | 1545 remoting.ClientSession.prototype.updateMouseCursorImage_ = |
1544 function(url, hotspotX, hotspotY) { | 1546 function(url, hotspotX, hotspotY) { |
1545 this.mouseCursorOverlay_.hidden = !url; | 1547 this.mouseCursorOverlay_.hidden = !url; |
1546 if (url) { | 1548 if (url) { |
1547 this.mouseCursorOverlay_.style.marginLeft = '-' + hotspotX + 'px'; | 1549 this.mouseCursorOverlay_.style.marginLeft = '-' + hotspotX + 'px'; |
1548 this.mouseCursorOverlay_.style.marginTop = '-' + hotspotY + 'px'; | 1550 this.mouseCursorOverlay_.style.marginTop = '-' + hotspotY + 'px'; |
1549 this.mouseCursorOverlay_.src = url; | 1551 this.mouseCursorOverlay_.src = url; |
1550 } | 1552 } |
1551 }; | 1553 }; |
OLD | NEW |