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.
7 * The entry point for dialog_hangout_consent.html.
11 /** @suppress {duplicate} */
12 var remoting = remoting || {};
20 * @param {HTMLElement} rootElement
21 * @param {string} requestToken
22 * @param {boolean} authorized Whether the user is authorized or not.
24 var ConsentDialog = function(rootElement, requestToken, authorized) {
26 this.okButton_ = rootElement.querySelector('.ok-button');
28 this.cancelButton_ = rootElement.querySelector('.cancel-button');
30 this.authSection_ = rootElement.querySelector('.auth-message');
32 this.requestToken_ = requestToken;
35 this.authSection_.hidden = true;
38 this.okButton_.addEventListener('click', this.onButton_.bind(this, true));
39 this.cancelButton_.addEventListener('click',this.onButton_.bind(this, false));
40 base.resizeWindowToContent();
44 * @param {boolean} confirm
47 ConsentDialog.prototype.onButton_ = function(confirm) {
48 base.Ipc.invoke('remoting.HangoutConsentDialog.confirm', confirm,
50 chrome.app.window.current().close();
53 function onDomContentLoaded() {
54 var params = base.getUrlParameters();
55 var authorized = getBooleanAttr(params, 'authorized', false);
56 var token = getStringAttr(params, 'token');
58 var confirmDialog = new ConsentDialog(document.body, token, authorized);
61 window.addEventListener('load', onDomContentLoaded);