Commit d90378f3 authored by mtomasz's avatar mtomasz Committed by Commit bot

[fsp] Remove the unused streaming field.

The field is not used, so it should be removed.

NOTRY=True
TEST=Tested manually that Files app works correctly.
BUG=408017

Review URL: https://codereview.chromium.org/522533003

Cr-Commit-Position: refs/heads/master@{#292846}
parent 60a533c0
...@@ -100,6 +100,24 @@ void FillDriveEntryPropertiesValue(const drive::ResourceEntry& entry_proto, ...@@ -100,6 +100,24 @@ void FillDriveEntryPropertiesValue(const drive::ResourceEntry& entry_proto,
new bool(file_specific_info.cache_state().is_pinned())); new bool(file_specific_info.cache_state().is_pinned()));
properties->is_present.reset( properties->is_present.reset(
new bool(file_specific_info.cache_state().is_present())); new bool(file_specific_info.cache_state().is_present()));
if (file_specific_info.cache_state().is_present()) {
properties->is_available_offline.reset(new bool(true));
} else if (file_specific_info.is_hosted_document() &&
file_specific_info.has_document_extension()) {
const std::string file_extension = file_specific_info.document_extension();
// What's available offline? See the 'Web' column at:
// http://support.google.com/drive/answer/1628467
properties->is_available_offline.reset(
new bool(file_extension == ".gdoc" || file_extension == ".gdraw" ||
file_extension == ".gsheet" || file_extension == ".gslides"));
} else {
properties->is_available_offline.reset(new bool(false));
}
properties->is_available_when_metered.reset(
new bool(file_specific_info.cache_state().is_present() ||
file_specific_info.is_hosted_document()));
} }
// Creates entry definition list for (metadata) search result info list. // Creates entry definition list for (metadata) search result info list.
......
...@@ -202,6 +202,12 @@ dictionary DriveEntryProperties { ...@@ -202,6 +202,12 @@ dictionary DriveEntryProperties {
// True if the file is hosted on a Drive server instead of local. // True if the file is hosted on a Drive server instead of local.
boolean? isHosted; boolean? isHosted;
// True if the file is available offline.
boolean? isAvailableOffline;
// True if the file is available on metered connection.
boolean? isAvailableWhenMetered;
// URL to the custom icon for this file. // URL to the custom icon for this file.
DOMString? customIconUrl; DOMString? customIconUrl;
......
...@@ -230,7 +230,7 @@ AudioPlayer.prototype.select_ = function(newTrack) { ...@@ -230,7 +230,7 @@ AudioPlayer.prototype.select_ = function(newTrack) {
* @private * @private
*/ */
AudioPlayer.prototype.fetchMetadata_ = function(entry, callback) { AudioPlayer.prototype.fetchMetadata_ = function(entry, callback) {
this.metadataCache_.getOne(entry, 'thumbnail|media|streaming', this.metadataCache_.getOne(entry, 'thumbnail|media|drive',
function(generation, metadata) { function(generation, metadata) {
// Do nothing if another load happened since the metadata request. // Do nothing if another load happened since the metadata request.
if (this.playlistGeneration_ == generation) if (this.playlistGeneration_ == generation)
...@@ -250,7 +250,7 @@ AudioPlayer.prototype.onError_ = function() { ...@@ -250,7 +250,7 @@ AudioPlayer.prototype.onError_ = function() {
this.fetchMetadata_( this.fetchMetadata_(
this.entries_[track], this.entries_[track],
function(metadata) { function(metadata) {
var error = (!navigator.onLine && metadata.streaming) ? var error = (!navigator.onLine && !metadata.drive.present) ?
this.offlineString_ : this.errorString_; this.offlineString_ : this.errorString_;
this.displayMetadata_(track, metadata, error); this.displayMetadata_(track, metadata, error);
this.scheduleAutoAdvance_(); this.scheduleAutoAdvance_();
......
...@@ -13,7 +13,6 @@ ...@@ -13,7 +13,6 @@
* filesystem: size, modificationTime * filesystem: size, modificationTime
* internal: presence * internal: presence
* drive: pinned, present, hosted, availableOffline * drive: pinned, present, hosted, availableOffline
* streaming: (no property)
* *
* Following are not fetched for non-present drive files. * Following are not fetched for non-present drive files.
* media: artist, album, title, width, height, imageTransform, etc. * media: artist, album, title, width, height, imageTransform, etc.
...@@ -763,7 +762,6 @@ FilesystemProvider.prototype.fetch = function( ...@@ -763,7 +762,6 @@ FilesystemProvider.prototype.fetch = function(
* This provider returns the following objects: * This provider returns the following objects:
* drive: { pinned, hosted, present, customIconUrl, etc. } * drive: { pinned, hosted, present, customIconUrl, etc. }
* thumbnail: { url, transform } * thumbnail: { url, transform }
* streaming: { }
* @param {VolumeManagerWrapper} volumeManager Volume manager instance. * @param {VolumeManagerWrapper} volumeManager Volume manager instance.
* @constructor * @constructor
*/ */
...@@ -803,7 +801,7 @@ DriveProvider.prototype.supportsEntry = function(entry) { ...@@ -803,7 +801,7 @@ DriveProvider.prototype.supportsEntry = function(entry) {
*/ */
DriveProvider.prototype.providesType = function(type) { DriveProvider.prototype.providesType = function(type) {
return type === 'drive' || type === 'thumbnail' || return type === 'drive' || type === 'thumbnail' ||
type === 'streaming' || type === 'media' || type === 'filesystem'; type === 'media' || type === 'filesystem';
}; };
/** /**
...@@ -852,36 +850,6 @@ DriveProvider.prototype.callApi_ = function() { ...@@ -852,36 +850,6 @@ DriveProvider.prototype.callApi_ = function() {
}); });
}; };
/**
* @param {DriveEntryProperties} data Drive entry properties.
* @param {Entry} entry File entry.
* @return {boolean} True if the file is available offline.
*/
DriveProvider.isAvailableOffline = function(data, entry) {
if (data.isPresent)
return true;
if (!data.isHosted)
return false;
// What's available offline? See the 'Web' column at:
// http://support.google.com/drive/answer/1628467
var subtype = FileType.getType(entry).subtype;
return (subtype === 'doc' ||
subtype === 'draw' ||
subtype === 'sheet' ||
subtype === 'slides');
};
/**
* @param {DriveEntryProperties} data Drive entry properties.
* @return {boolean} True if opening the file does not require downloading it
* via a metered connection.
*/
DriveProvider.isAvailableWhenMetered = function(data) {
return data.isPresent || data.isHosted;
};
/** /**
* Converts API metadata to internal format. * Converts API metadata to internal format.
* @param {Object} data Metadata from API call. * @param {Object} data Metadata from API call.
...@@ -898,8 +866,8 @@ DriveProvider.prototype.convert_ = function(data, entry) { ...@@ -898,8 +866,8 @@ DriveProvider.prototype.convert_ = function(data, entry) {
imageWidth: data.imageWidth, imageWidth: data.imageWidth,
imageHeight: data.imageHeight, imageHeight: data.imageHeight,
imageRotation: data.imageRotation, imageRotation: data.imageRotation,
availableOffline: DriveProvider.isAvailableOffline(data, entry), availableOffline: data.isAvailableOffline,
availableWhenMetered: DriveProvider.isAvailableWhenMetered(data), availableWhenMetered: data.isAvailableWhenMetered,
customIconUrl: data.customIconUrl || '', customIconUrl: data.customIconUrl || '',
contentMimeType: data.contentMimeType || '', contentMimeType: data.contentMimeType || '',
sharedWithMe: data.sharedWithMe, sharedWithMe: data.sharedWithMe,
...@@ -919,15 +887,12 @@ DriveProvider.prototype.convert_ = function(data, entry) { ...@@ -919,15 +887,12 @@ DriveProvider.prototype.convert_ = function(data, entry) {
} else if (data.isPresent) { } else if (data.isPresent) {
result.thumbnail = null; result.thumbnail = null;
} else { } else {
// Block the local fetch for drive files, which require downloading. // Not present in cache, so do not allow to generate it by next providers.
result.thumbnail = {url: '', transform: null}; result.thumbnail = {url: '', transform: null};
} }
// If present in cache, then allow to fetch media by next providers.
result.media = data.isPresent ? null : {}; result.media = data.isPresent ? null : {};
// Indicate that the data is not available in local cache.
// It used to have a field 'url' for streaming play, but it is
// derprecated. See crbug.com/174560.
result.streaming = data.isPresent ? null : {};
return result; return result;
}; };
......
...@@ -254,7 +254,7 @@ Gallery.MOSAIC_BACKGROUND_INIT_DELAY = 1000; ...@@ -254,7 +254,7 @@ Gallery.MOSAIC_BACKGROUND_INIT_DELAY = 1000;
* @const * @const
* @type {string} * @type {string}
*/ */
Gallery.METADATA_TYPE = 'thumbnail|filesystem|media|streaming|drive'; Gallery.METADATA_TYPE = 'thumbnail|filesystem|media|drive';
/** /**
* Initializes listeners. * Initializes listeners.
......
...@@ -381,8 +381,7 @@ ImageView.prototype.load = ...@@ -381,8 +381,7 @@ ImageView.prototype.load =
loadType, ImageView.LOAD_TYPE_TOTAL); loadType, ImageView.LOAD_TYPE_TOTAL);
if (loadType === ImageView.LOAD_TYPE_ERROR && if (loadType === ImageView.LOAD_TYPE_ERROR &&
!navigator.onLine && metadata.streaming) { !navigator.onLine && !metadata.drive.present) {
// |streaming| is set only when the file is not locally cached.
loadType = ImageView.LOAD_TYPE_OFFLINE; loadType = ImageView.LOAD_TYPE_OFFLINE;
} }
if (loadCallback) loadCallback(loadType, animationDuration, opt_error); if (loadCallback) loadCallback(loadType, animationDuration, opt_error);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment