Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(235)

Unified Diff: remoting/webapp/app_remoting/js/ar_auth_dialog.js

Issue 1023943004: Use a separate window to notify the user that permissions are required. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: remoting/webapp/app_remoting/js/ar_auth_dialog.js
diff --git a/remoting/webapp/app_remoting/js/ar_auth_dialog.js b/remoting/webapp/app_remoting/js/ar_auth_dialog.js
new file mode 100644
index 0000000000000000000000000000000000000000..3db64b04cd9b30d214e791b2fe2413a4e8168395
--- /dev/null
+++ b/remoting/webapp/app_remoting/js/ar_auth_dialog.js
@@ -0,0 +1,56 @@
+// Copyright 2015 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.
+
+/** @suppress {duplicate} */
+var remoting = remoting || {};
+
+(function() {
+
+'use strict';
+
+var instance_ = null;
+
+/**
+ * @constructor
+ * @implements {remoting.Identity.ConsentDialog}
+ * @private
+ */
+remoting.AuthDialog = function() {
+ /** @private {base.Deferred} */
+ this.deferred_ = null;
+};
+
+/**
+ * @return {Promise} A Promise object that resolves when the user clicks on the
+ * auth button.
+ */
+remoting.AuthDialog.prototype.show = function() {
+ if (!this.deferred_) {
+ this.deferred_ = new base.Deferred();
+ remoting.MessageWindow.showMessageWindow(
+ l10n.getTranslationOrError(/*i18n-content*/'MODE_AUTHORIZE'),
+ l10n.getTranslationOrError(/*i18n-content*/'DESCRIPTION_AUTHORIZE'),
+ l10n.getTranslationOrError(/*i18n-content*/'CONTINUE_BUTTON'),
+ this.onOk_.bind(this));
+ }
+ return this.deferred_.promise();
+};
+
+/**
+ * @return {remoting.AuthDialog}
+ */
+remoting.AuthDialog.getInstance = function() {
Jamie 2015/03/21 01:18:23 I would prefer that this getInstance() singleton i
garykac 2015/03/23 23:25:33 Add a TODO?
Jamie 2015/04/15 00:02:57 There's one in auth_init.js which I think applies.
+ if (!instance_) {
+ instance_ = new remoting.AuthDialog();
+ }
+ return instance_;
+};
+
+remoting.AuthDialog.prototype.onOk_ = function() {
+ base.debug.assert(this.deferred_ !== null);
+ this.deferred_.resolve();
+ this.deferred_ = null;
+};
+
+})();

Powered by Google App Engine
This is Rietveld 408576698