1 // Copyright 2015 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.
5 /** @suppress {duplicate} */
6 var remoting = remoting || {};
16 * @implements {remoting.Identity.ConsentDialog}
19 remoting.AuthDialog = function() {
20 /** @private {base.Deferred} */
21 this.deferred_ = null;
25 * @return {Promise} A Promise object that resolves when the user clicks on the
28 remoting.AuthDialog.prototype.show = function() {
29 if (!this.deferred_) {
30 this.deferred_ = new base.Deferred();
31 remoting.MessageWindow.showMessageWindow(
32 l10n.getTranslationOrError(/*i18n-content*/'MODE_AUTHORIZE'),
33 l10n.getTranslationOrError(/*i18n-content*/'DESCRIPTION_AUTHORIZE'),
34 l10n.getTranslationOrError(/*i18n-content*/'CONTINUE_BUTTON'),
35 this.onOk_.bind(this));
37 return this.deferred_.promise();
41 * @return {remoting.AuthDialog}
43 remoting.AuthDialog.getInstance = function() {
45 instance_ = new remoting.AuthDialog();
50 remoting.AuthDialog.prototype.onOk_ = function() {
51 console.assert(this.deferred_ !== null, 'No deferred Promise found.');
52 this.deferred_.resolve();
53 this.deferred_ = null;