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

Unified Diff: remoting/webapp/background/it2me_helpee_channel.js

Issue 503063004: Hangouts Remote Desktop Part VI - Show confirm dialog before retrieving access code (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 4 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/background/it2me_helpee_channel.js
diff --git a/remoting/webapp/background/it2me_helpee_channel.js b/remoting/webapp/background/it2me_helpee_channel.js
index 94001883bbbbed43d4b417d0d03214d8e3ef916d..6c9453b7c8b53ff1bdda2cd356275f3e7f102716 100644
--- a/remoting/webapp/background/it2me_helpee_channel.js
+++ b/remoting/webapp/background/it2me_helpee_channel.js
@@ -280,23 +280,39 @@ remoting.It2MeHelpeeChannel.prototype.handleConnect_ =
* @private
*/
remoting.It2MeHelpeeChannel.prototype.showConfirmDialog_ = function() {
- /**
- * @param {function(*=):void} resolve
- * @param {function(*=):void} reject
- */
- return new Promise(function(resolve, reject) {
- // TODO(kelvinp): The existing implementation doesn't work in the v2 app as
- // window.confirm is blacklisted. Implement the dialog using
- // chrome.app.window instead (crbug.com/405139).
- if (base.isAppsV2()) {
- resolve();
- // The unlocalized string will be replaced in (crbug.com/405139).
- } else if (window.confirm('Accept help?')) {
- resolve();
- } else {
- reject(new Error(remoting.Error.CANCELLED));
- }
- });
+ var message = l10n.getTranslationOrError(
+ /*i18n-content*/'HANGOUTS_CONFIRM_DIALOG_MESSAGE');
+
+ if (base.isAppsV2()) {
+ /**
+ * @param {function(*=):void} resolve
+ * @param {function(*=):void} reject
+ */
+ return new Promise(function(resolve, reject) {
+ /** @param {number} result */
+ function confirmDialogCallback(result) {
+ if (result === 1) {
+ resolve();
+ } else {
+ reject(new Error(remoting.Error.CANCELLED));
+ }
+ }
+
+ remoting.MessageWindow.showConfirmWindow(
+ '', // Empty string to use the package name as the dialog title.
+ message,
+ l10n.getTranslationOrError(
+ /*i18n-content*/'HANGOUTS_CONFIRM_DIALOG_ACCEPT'),
+ l10n.getTranslationOrError(
+ /*i18n-content*/'HANGOUTS_CONFIRM_DIALOG_DECLINE'),
+ confirmDialogCallback
+ );
+ });
+ } else if (window.confirm(message)) {
+ return Promise.resolve();
+ } else {
+ return Promise.reject(new Error(remoting.Error.CANCELLED));
+ }
};
/**

Powered by Google App Engine
This is Rietveld 408576698