Chromium Code Reviews| 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 {boolean} authenticated whether the user is authenticated or not. | |
| 22 */ | |
| 23 var ConsentDialog = function(rootElement, authenticated) { | |
| 24 /** @private */ | |
| 25 this.okButton_ = rootElement.querySelector('.ok-button'); | |
| 26 /** @private */ | |
| 27 this.cancelButton_ = rootElement.querySelector('.cancel-button'); | |
| 28 /** @private */ | |
| 29 this.authSection_ = rootElement.querySelector('.auth-message'); | |
| 30 | |
| 31 if (authenticated) { | |
| 32 this.authSection_.hidden = true; | |
| 33 } | |
| 34 | |
| 35 this.okButton_.addEventListener('click', this.onButton_.bind(this, true)); | |
| 36 this.cancelButton_.addEventListener('click',this.onButton_.bind(this, false)); | |
| 37 }; | |
| 38 | |
| 39 /** | |
| 40 * @param {boolean} confirm | |
| 41 * @private | |
| 42 */ | |
| 43 ConsentDialog.prototype.onButton_ = function(confirm) { | |
| 44 base.Ipc.invoke('remoting.HangoutConsentDialog.confirm', confirm); | |
| 45 chrome.app.window.current().close(); | |
| 46 }; | |
| 47 | |
| 48 function onDomContentLoaded() { | |
| 49 var params = base.getUrlParameters(); | |
| 50 var isAuthenticated = (params['authenticated'] === 'true'); | |
| 51 l10n.localize(); | |
| 52 var confirmDialog = new ConsentDialog(document.body, isAuthenticated); | |
| 53 } | |
| 54 | |
| 55 document.addEventListener("DOMContentLoaded", onDomContentLoaded); | |
|
Jamie
2015/02/02 19:07:40
Single-quotes for JS strings, please.
Elsewhere,
kelvinp
2015/02/03 01:15:33
Excellent catch! Thank you.
| |
| 56 | |
| 57 }()); | |
| OLD | NEW |