Index: chrome/browser/resources/file_manager/js/suggest_apps_dialog.js |
diff --git a/chrome/browser/resources/file_manager/js/suggest_apps_dialog.js b/chrome/browser/resources/file_manager/js/suggest_apps_dialog.js |
index 64a21607e7b488570c25483065e1f609e6d92a55..eb673c99bbc12bef717f2d5c8e891e9df305ef93 100644 |
--- a/chrome/browser/resources/file_manager/js/suggest_apps_dialog.js |
+++ b/chrome/browser/resources/file_manager/js/suggest_apps_dialog.js |
@@ -226,17 +226,16 @@ SuggestAppsDialog.prototype.authorizeRequest_ = function(e) { |
* @private |
*/ |
SuggestAppsDialog.prototype.retrieveAuthorizeToken_ = function(callback) { |
- // TODO(yoshiki): Share the access token with ShareDialog. |
if (this.accessToken_) { |
callback(); |
return; |
} |
// Fetch or update the access token. |
- chrome.fileBrowserPrivate.requestAccessToken( |
- false, // force_refresh |
- function(inAccessToken) { |
- this.accessToken_ = inAccessToken; |
+ chrome.fileBrowserPrivate.requestWebStoreAccessToken( |
+ function(accessToken) { |
+ // In case of error, this.accessToken_ will be set to null. |
+ this.accessToken_ = accessToken; |
callback(); |
}.bind(this)); |
}; |
@@ -263,6 +262,12 @@ SuggestAppsDialog.prototype.show = function(extension, mime, onDialogClosed) { |
// Makes it sure that the initialization is completed. |
this.initializationTask_.run(function() { |
+ if (!this.accessToken_) { |
+ this.state_ = SuggestAppsDialog.State.INITIALIZE_FAILED_CLOSING; |
+ this.onHide_(); |
+ return; |
+ } |
+ |
var title = str('SUGGEST_DIALOG_TITLE'); |
// TODO(yoshiki): Remove this before ShareDialog launches. |