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

Unified Diff: chrome/browser/resources/file_manager/js/suggest_apps_dialog.js

Issue 23549016: [Files.app] Fetch and use CWS OAuth token instead of Drive token in Suggest app dialog. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix test failure. Created 7 years, 3 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: 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.
« no previous file with comments | « chrome/browser/extensions/extension_function_histogram_value.h ('k') | chrome/common/extensions/api/file_browser_private.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698