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; |
} |