| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 'use strict'; | 5 'use strict'; |
| 6 | 6 |
| 7 /** | 7 /** |
| 8 * @param {HTMLElement} parentNode Node to be parent for this dialog. | 8 * @param {HTMLElement} parentNode Node to be parent for this dialog. |
| 9 * @constructor | 9 * @constructor |
| 10 * @extends {FileManagerDialogBase} | 10 * @extends {FileManagerDialogBase} |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 this.webView_.addEventListener('loadstop', registerInjectionHooks); | 80 this.webView_.addEventListener('loadstop', registerInjectionHooks); |
| 81 this.webView_.setAttribute('src', 'data:text/html,'); | 81 this.webView_.setAttribute('src', 'data:text/html,'); |
| 82 }; | 82 }; |
| 83 | 83 |
| 84 /** | 84 /** |
| 85 * Authorizes the web view by fetching the freshest access tokens. | 85 * Authorizes the web view by fetching the freshest access tokens. |
| 86 * @param {function()} callback Completion callback. | 86 * @param {function()} callback Completion callback. |
| 87 */ | 87 */ |
| 88 ShareDialog.WebViewAuthorizer.prototype.authorize = function(callback) { | 88 ShareDialog.WebViewAuthorizer.prototype.authorize = function(callback) { |
| 89 // Fetch or update the access token. | 89 // Fetch or update the access token. |
| 90 chrome.fileBrowserPrivate.requestAccessToken(false, // force_refresh | 90 chrome.fileManagerPrivate.requestAccessToken(false, // force_refresh |
| 91 function(inAccessToken) { | 91 function(inAccessToken) { |
| 92 this.accessToken_ = inAccessToken; | 92 this.accessToken_ = inAccessToken; |
| 93 callback(); | 93 callback(); |
| 94 }.bind(this)); | 94 }.bind(this)); |
| 95 }; | 95 }; |
| 96 | 96 |
| 97 /** | 97 /** |
| 98 * Injects headers into the passed request. | 98 * Injects headers into the passed request. |
| 99 * @param {Event} e Request event. | 99 * @param {Event} e Request event. |
| 100 * @return {{requestHeaders: HttpHeaders}} Modified headers. | 100 * @return {{requestHeaders: HttpHeaders}} Modified headers. |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 258 console.error('ShareDialog can\'t be shown.'); | 258 console.error('ShareDialog can\'t be shown.'); |
| 259 return; | 259 return; |
| 260 } | 260 } |
| 261 | 261 |
| 262 // Initialize and authorize the Web View tag asynchronously. | 262 // Initialize and authorize the Web View tag asynchronously. |
| 263 var group = new AsyncUtil.Group(); | 263 var group = new AsyncUtil.Group(); |
| 264 | 264 |
| 265 // Fetches an url to the sharing dialog. | 265 // Fetches an url to the sharing dialog. |
| 266 var shareUrl; | 266 var shareUrl; |
| 267 group.add(function(inCallback) { | 267 group.add(function(inCallback) { |
| 268 chrome.fileBrowserPrivate.getShareUrl( | 268 chrome.fileManagerPrivate.getShareUrl( |
| 269 entry.toURL(), | 269 entry.toURL(), |
| 270 function(inShareUrl) { | 270 function(inShareUrl) { |
| 271 if (!chrome.runtime.lastError) | 271 if (!chrome.runtime.lastError) |
| 272 shareUrl = inShareUrl; | 272 shareUrl = inShareUrl; |
| 273 else | 273 else |
| 274 console.error(chrome.runtime.lastError.message); | 274 console.error(chrome.runtime.lastError.message); |
| 275 inCallback(); | 275 inCallback(); |
| 276 }); | 276 }); |
| 277 }); | 277 }); |
| 278 group.add(this.webViewAuthorizer_.initialize.bind(this.webViewAuthorizer_)); | 278 group.add(this.webViewAuthorizer_.initialize.bind(this.webViewAuthorizer_)); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 300 | 300 |
| 301 /** | 301 /** |
| 302 * Tells whether the share dialog is showing or not. | 302 * Tells whether the share dialog is showing or not. |
| 303 * | 303 * |
| 304 * @return {boolean} True since the show method is called and until the closing | 304 * @return {boolean} True since the show method is called and until the closing |
| 305 * callback is invoked. | 305 * callback is invoked. |
| 306 */ | 306 */ |
| 307 ShareDialog.prototype.isShowing = function() { | 307 ShareDialog.prototype.isShowing = function() { |
| 308 return !!this.callback_; | 308 return !!this.callback_; |
| 309 }; | 309 }; |
| OLD | NEW |