Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 /** @suppress {duplicate} */ | |
| 6 var remoting = remoting || {}; | |
| 7 | |
| 8 (function() { | |
| 9 | |
| 10 'use strict'; | |
| 11 | |
| 12 /** @constructor */ | |
| 13 remoting.PublicSession = function() { | |
| 14 // Initialize global dependencies. | |
| 15 l10n.localize(); | |
| 16 remoting.identity = new remoting.Identity(); | |
| 17 remoting.settings = new remoting.Settings(); | |
| 18 | |
| 19 // override remoting.setMode() so that the content will always fit. | |
| 20 var setMode = remoting.setMode; | |
| 21 remoting.setMode = function(/** string */ mode) { | |
| 22 setMode(mode); | |
| 23 base.resizeWindowToContent(); | |
| 24 }; | |
|
Jamie
2015/09/30 20:24:09
This would be cleaner hooking the uiModeChanged ev
kelvinp
2015/09/30 23:13:49
Agree. I will fix that in a separate CL.
| |
| 25 | |
| 26 /** @private */ | |
| 27 this.eventHooks_ = new base.Disposables( | |
| 28 new base.DomEventHook(document.getElementById('host-finished-button'), | |
| 29 'click', this.exit_.bind(this), false), | |
| 30 new base.DomEventHook(document.getElementById('cancel-share-button'), | |
| 31 'click', this.exit_.bind(this), false)); | |
| 32 }; | |
| 33 | |
| 34 remoting.PublicSession.prototype.start = function() { | |
| 35 remoting.tryShare(); | |
| 36 }; | |
| 37 | |
| 38 /** @private */ | |
| 39 remoting.PublicSession.prototype.exit_ = function() { | |
| 40 base.dispose(this.eventHooks_); | |
| 41 this.eventHooks_ = null; | |
| 42 chrome.app.window.current().close(); | |
| 43 }; | |
| 44 | |
| 45 window.addEventListener('load', function () { | |
| 46 remoting.publicSession = new remoting.PublicSession(); | |
| 47 remoting.publicSession.start(); | |
| 48 }, false); | |
| 49 | |
| 50 })(); | |
| 51 | |
| OLD | NEW |