Chromium Code Reviews| Index: remoting/webapp/crd/js/hangout_consent_dialog_main.js |
| diff --git a/remoting/webapp/crd/js/hangout_consent_dialog_main.js b/remoting/webapp/crd/js/hangout_consent_dialog_main.js |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..fb51f1516e3ce5f827a33e685faba71030aaa42b |
| --- /dev/null |
| +++ b/remoting/webapp/crd/js/hangout_consent_dialog_main.js |
| @@ -0,0 +1,57 @@ |
| +// Copyright 2014 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. |
| + |
| +/** |
| +* @fileoverview |
| +* The entry point for dialog_hangout_consent.html. |
| +*/ |
| + |
| + |
| +/** @suppress {duplicate} */ |
| +var remoting = remoting || {}; |
| + |
| +(function() { |
| + |
| +'use strict'; |
| + |
| +/** |
| + * @constructor |
| + * @param {HTMLElement} rootElement |
| + * @param {boolean} authenticated whether the user is authenticated or not. |
| + */ |
| +var ConsentDialog = function(rootElement, authenticated) { |
| + /** @private */ |
| + this.okButton_ = rootElement.querySelector('.ok-button'); |
| + /** @private */ |
| + this.cancelButton_ = rootElement.querySelector('.cancel-button'); |
| + /** @private */ |
| + this.authSection_ = rootElement.querySelector('.auth-message'); |
| + |
| + if (authenticated) { |
| + this.authSection_.hidden = true; |
| + } |
| + |
| + this.okButton_.addEventListener('click', this.onButton_.bind(this, true)); |
| + this.cancelButton_.addEventListener('click',this.onButton_.bind(this, false)); |
| +}; |
| + |
| +/** |
| + * @param {boolean} confirm |
| + * @private |
| + */ |
| +ConsentDialog.prototype.onButton_ = function(confirm) { |
| + base.Ipc.invoke('remoting.HangoutConsentDialog.confirm', confirm); |
| + chrome.app.window.current().close(); |
| +}; |
| + |
| +function onDomContentLoaded() { |
| + var params = base.getUrlParameters(); |
| + var isAuthenticated = (params['authenticated'] === 'true'); |
| + l10n.localize(); |
| + var confirmDialog = new ConsentDialog(document.body, isAuthenticated); |
| +} |
| + |
| +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.
|
| + |
| +}()); |