Index: remoting/webapp/crd/js/public_session_main.js |
diff --git a/remoting/webapp/crd/js/public_session_main.js b/remoting/webapp/crd/js/public_session_main.js |
new file mode 100644 |
index 0000000000000000000000000000000000000000..1257737981adf3abbdf92b8454558d6c5fd84ab0 |
--- /dev/null |
+++ b/remoting/webapp/crd/js/public_session_main.js |
@@ -0,0 +1,51 @@ |
+// Copyright 2015 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+/** @suppress {duplicate} */ |
+var remoting = remoting || {}; |
+ |
+(function() { |
+ |
+'use strict'; |
+ |
+/** @constructor */ |
+remoting.PublicSession = function() { |
+ // Initialize global dependencies. |
+ l10n.localize(); |
+ remoting.identity = new remoting.Identity(); |
+ remoting.settings = new remoting.Settings(); |
+ |
+ // override remoting.setMode() so that the content will always fit. |
+ var setMode = remoting.setMode; |
+ remoting.setMode = function(/** string */ mode) { |
+ setMode(mode); |
+ base.resizeWindowToContent(); |
+ }; |
+ |
+ /** @private */ |
+ this.eventHooks_ = new base.Disposables( |
+ new base.DomEventHook(document.getElementById('host-finished-button'), |
+ 'click', this.exit_.bind(this), false), |
+ new base.DomEventHook(document.getElementById('cancel-share-button'), |
+ 'click', this.exit_.bind(this), false)); |
+}; |
+ |
+remoting.PublicSession.prototype.start = function() { |
+ remoting.tryShare(); |
+}; |
+ |
+/** @private */ |
+remoting.PublicSession.prototype.exit_ = function() { |
+ base.dispose(this.eventHooks_); |
+ this.eventHooks_ = null; |
+ chrome.app.window.current().close(); |
+}; |
+ |
+window.addEventListener('load', function () { |
+ remoting.publicSession = new remoting.PublicSession(); |
+ remoting.publicSession.start(); |
+}, false); |
+ |
+})(); |
+ |