Upstream version 10.39.225.0
[platform/framework/web/crosswalk.git] / src / ui / file_manager / video_player / js / cast / media_manager.js
index e746493..dbf8b8d 100644 (file)
@@ -49,7 +49,7 @@ MediaManager.prototype.getToken = function(refresh) {
 
   return new Promise(function(fulfill, reject) {
     // TODO(yoshiki): Creates the method to get a token and use it.
-    chrome.fileBrowserPrivate.getDownloadUrl(this.entry_.toURL(), fulfill);
+    chrome.fileManagerPrivate.getDownloadUrl(this.entry_.toURL(), fulfill);
   }.bind(this)).then(function(url) {
     if (chrome.runtime.lastError) {
       return Promise.reject(
@@ -78,7 +78,7 @@ MediaManager.prototype.getUrl = function() {
 
   return new Promise(function(fulfill, reject) {
     // TODO(yoshiki): Creates the method to get a url and use it.
-    chrome.fileBrowserPrivate.getDownloadUrl(this.entry_.toURL(), fulfill);
+    chrome.fileManagerPrivate.getDownloadUrl(this.entry_.toURL(), fulfill);
   }.bind(this)).then(function(url) {
     if (chrome.runtime.lastError) {
       return Promise.reject(
@@ -102,15 +102,18 @@ MediaManager.prototype.getUrl = function() {
  */
 MediaManager.prototype.getMime = function() {
   if (this.cachedDriveProp_)
-    return Promise.resolve(this.cachedDriveProp_.thumbnailUrl);
+    return Promise.resolve(this.cachedDriveProp_.contentMimeType || '');
 
   return new Promise(function(fulfill, reject) {
-    chrome.fileBrowserPrivate.getDriveEntryProperties(
+    chrome.fileManagerPrivate.getEntryProperties(
         [this.entry_.toURL()], fulfill);
   }.bind(this)).then(function(props) {
-    if (!props || !props[0] || !props[0].contentMimeType) {
-      // TODO(yoshiki): Adds a logic to guess the mime.
+    if (!props || !props[0]) {
       return Promise.reject('Mime fetch failed.');
+    } else if (!props[0].contentMimeType) {
+      // TODO(yoshiki): Adds a logic to guess the mime.
+      this.cachedDriveProp_ = props[0];
+      return '';
     } else {
       this.cachedDriveProp_ = props[0];
       return props[0].contentMimeType;
@@ -125,18 +128,17 @@ MediaManager.prototype.getMime = function() {
  */
 MediaManager.prototype.getThumbnail = function() {
   if (this.cachedDriveProp_)
-    return Promise.resolve(this.cachedDriveProp_.thumbnailUrl);
+    return Promise.resolve(this.cachedDriveProp_.thumbnailUrl || '');
 
   return new Promise(function(fulfill, reject) {
-    chrome.fileBrowserPrivate.getDriveEntryProperties(
+    chrome.fileManagerPrivate.getEntryProperties(
         [this.entry_.toURL()], fulfill);
   }.bind(this)).then(function(props) {
-    if (!props || !props[0] || !props[0].thumbnailUrl) {
-      // TODO(yoshiki): Adds a logic to guess the mime.
+    if (!props || !props[0]) {
       return Promise.reject('Thumbnail fetch failed.');
     } else {
       this.cachedDriveProp_ = props[0];
-      return props[0].thumbnailUrl;
+      return props[0].thumbnailUrl || '';
     }
   }.bind(this));
 };