| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 /** | |
| 6 * @fileoverview | |
| 7 * The entry point for dialog_hangout_consent.html. | |
| 8 */ | |
| 9 | |
| 10 | |
| 11 /** @suppress {duplicate} */ | |
| 12 var remoting = remoting || {}; | |
| 13 | |
| 14 (function() { | |
| 15 | |
| 16 'use strict'; | |
| 17 | |
| 18 /** | |
| 19 * @constructor | |
| 20 * @param {HTMLElement} rootElement | |
| 21 * @param {string} requestToken | |
| 22 * @param {boolean} authorized Whether the user is authorized or not. | |
| 23 */ | |
| 24 var ConsentDialog = function(rootElement, requestToken, authorized) { | |
| 25 /** @private */ | |
| 26 this.okButton_ = rootElement.querySelector('.ok-button'); | |
| 27 /** @private */ | |
| 28 this.cancelButton_ = rootElement.querySelector('.cancel-button'); | |
| 29 /** @private */ | |
| 30 this.authSection_ = rootElement.querySelector('.auth-message'); | |
| 31 /** @private */ | |
| 32 this.requestToken_ = requestToken; | |
| 33 | |
| 34 if (authorized) { | |
| 35 this.authSection_.hidden = true; | |
| 36 } | |
| 37 | |
| 38 this.okButton_.addEventListener('click', this.onButton_.bind(this, true)); | |
| 39 this.cancelButton_.addEventListener('click',this.onButton_.bind(this, false)); | |
| 40 base.resizeWindowToContent(); | |
| 41 }; | |
| 42 | |
| 43 /** | |
| 44 * @param {boolean} confirm | |
| 45 * @private | |
| 46 */ | |
| 47 ConsentDialog.prototype.onButton_ = function(confirm) { | |
| 48 base.Ipc.invoke('remoting.HangoutConsentDialog.confirm', confirm, | |
| 49 this.requestToken_); | |
| 50 chrome.app.window.current().close(); | |
| 51 }; | |
| 52 | |
| 53 function onDomContentLoaded() { | |
| 54 var params = base.getUrlParameters(); | |
| 55 var authorized = getBooleanAttr(params, 'authorized', false); | |
| 56 var token = getStringAttr(params, 'token'); | |
| 57 l10n.localize(); | |
| 58 var confirmDialog = new ConsentDialog(document.body, token, authorized); | |
| 59 } | |
| 60 | |
| 61 window.addEventListener('load', onDomContentLoaded); | |
| 62 | |
| 63 }()); | |
| OLD | NEW |