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

Unified Diff: ui/file_manager/file_manager/foreground/js/ui/suggest_apps_dialog.js

Issue 2740713002: Show alert when failed to get token for opening suggested apps dialog. (Closed)
Patch Set: Equally finalize the widget even when token not obtained, to keep the existing behavior. Created 3 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/file_manager/file_manager/foreground/js/ui/suggest_apps_dialog.js
diff --git a/ui/file_manager/file_manager/foreground/js/ui/suggest_apps_dialog.js b/ui/file_manager/file_manager/foreground/js/ui/suggest_apps_dialog.js
index ad3c6b54092c09d63cfcae00e7c36fcdef6c3a12..f9a2d9d3055b8cd0e940a436cacd0350bccb34f7 100644
--- a/ui/file_manager/file_manager/foreground/js/ui/suggest_apps_dialog.js
+++ b/ui/file_manager/file_manager/foreground/js/ui/suggest_apps_dialog.js
@@ -237,11 +237,13 @@ SuggestAppsDialog.prototype.showInternal_ =
}
var dialogShown = false;
+ var tokenObtained = false;
this.widget_.ready()
.then(
/** @return {!Promise} */
function() {
+ tokenObtained = true;
return this.showDialog_(title);
}.bind(this))
.then(
@@ -264,14 +266,22 @@ SuggestAppsDialog.prototype.showInternal_ =
function(error) {
console.error('Failed to start CWS widget: ' + error);
- // If the widget dialog was not shown, consider the widget
- // canceled.
if (!dialogShown) {
// Reset any widget state set in |this.widget_.ready()|. The
// returned value is ignored because it doesn't influence the
// value reported by dialog.
this.widget_.finalizeAndGetResult();
- onDialogClosed(SuggestAppsDialog.Result.CANCELLED, null);
+
+ var result = tokenObtained ?
+ // Got access token but the widget dialog was not shown.
+ // Consider the widget was cancelled.
+ SuggestAppsDialog.Result.CANCELLED :
+ // Access token was unavailable.
+ // This can happen in the Guest mode. crbug.com/694419
+ // Callback shows an alert notifying the file was not opened
+ // because of the unsupported type.
+ SuggestAppsDialog.Result.FAILED;
+ onDialogClosed(result, null);
return;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698