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

Side by Side Diff: ui/file_manager/video_player/js/cast/cast_video_element.js

Issue 543103002: Video Player: refresh token when it looks expired (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 * Interval for updating media info (in ms). 8 * Interval for updating media info (in ms).
9 * @type {number} 9 * @type {number}
10 * @const 10 * @const
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after
322 * @param {string} messageAsJson Content of message as json format. 322 * @param {string} messageAsJson Content of message as json format.
323 * @private 323 * @private
324 */ 324 */
325 onMessage_: function(namespace, messageAsJson) { 325 onMessage_: function(namespace, messageAsJson) {
326 if (namespace !== CAST_MESSAGE_NAMESPACE || !messageAsJson) 326 if (namespace !== CAST_MESSAGE_NAMESPACE || !messageAsJson)
327 return; 327 return;
328 328
329 var message = JSON.parse(messageAsJson); 329 var message = JSON.parse(messageAsJson);
330 if (message['message'] === 'request-token') { 330 if (message['message'] === 'request-token') {
331 if (message['previousToken'] === this.token_) { 331 if (message['previousToken'] === this.token_) {
332 this.mediaManager_.getToken().then(function(token) { 332 this.mediaManager_.getToken(true).then(function(token) {
333 this.token_ = token;
333 this.sendMessage_({message: 'push-token', token: token}); 334 this.sendMessage_({message: 'push-token', token: token});
334 // TODO(yoshiki): Revokes the previous token. 335 // TODO(yoshiki): Revokes the previous token.
335 }.bind(this)).catch(function(error) { 336 }.bind(this)).catch(function(error) {
336 // Send an empty token as an error. 337 // Send an empty token as an error.
337 this.sendMessage_({message: 'push-token', token: ''}); 338 this.sendMessage_({message: 'push-token', token: ''});
338 // TODO(yoshiki): Revokes the previous token. 339 // TODO(yoshiki): Revokes the previous token.
339 console.error(error.stack || error); 340 console.error(error.stack || error);
340 }); 341 });
341 } else { 342 } else {
342 console.error( 343 console.error(
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
435 this.dispatchEvent(new Event('durationchange')); 436 this.dispatchEvent(new Event('durationchange'));
436 } 437 }
437 438
438 // Media is being unloaded. 439 // Media is being unloaded.
439 if (!alive) { 440 if (!alive) {
440 this.unloadMedia_(); 441 this.unloadMedia_();
441 return; 442 return;
442 } 443 }
443 }, 444 },
444 }; 445 };
OLDNEW
« 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