OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 /** | 5 /** |
6 * MetadataCache is a map from url to an object containing properties. | 6 * MetadataCache is a map from url to an object containing properties. |
7 * Properties are divided by types, and all properties of one type are accessed | 7 * Properties are divided by types, and all properties of one type are accessed |
8 * at once. | 8 * at once. |
9 * Some of the properties: | 9 * Some of the properties: |
10 * { | 10 * { |
(...skipping 676 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
687 */ | 687 */ |
688 GDataProvider.prototype.callApi_ = function() { | 688 GDataProvider.prototype.callApi_ = function() { |
689 this.scheduled_ = false; | 689 this.scheduled_ = false; |
690 | 690 |
691 var urls = this.urls_; | 691 var urls = this.urls_; |
692 var callbacks = this.callbacks_; | 692 var callbacks = this.callbacks_; |
693 this.urls_ = []; | 693 this.urls_ = []; |
694 this.callbacks_ = []; | 694 this.callbacks_ = []; |
695 var self = this; | 695 var self = this; |
696 | 696 |
697 chrome.fileBrowserPrivate.getGDataFileProperties(urls, function(props) { | 697 chrome.fileBrowserPrivate.getDriveFileProperties(urls, function(props) { |
698 for (var index = 0; index < urls.length; index++) { | 698 for (var index = 0; index < urls.length; index++) { |
699 callbacks[index](self.convert_(props[index], urls[index])); | 699 callbacks[index](self.convert_(props[index], urls[index])); |
700 } | 700 } |
701 }); | 701 }); |
702 }; | 702 }; |
703 | 703 |
704 /** | 704 /** |
705 * @param {GDataFileProperties} data GData file properties. | 705 * @param {DriveFileProperties} data Drive file properties. |
706 * @param {string} url File url. | 706 * @param {string} url File url. |
707 * @return {boolean} True if the file is available offline. | 707 * @return {boolean} True if the file is available offline. |
708 */ | 708 */ |
709 GDataProvider.isAvailableOffline = function(data, url) { | 709 GDataProvider.isAvailableOffline = function(data, url) { |
710 if (data.isPresent) | 710 if (data.isPresent) |
711 return true; | 711 return true; |
712 | 712 |
713 if (!data.isHosted) | 713 if (!data.isHosted) |
714 return false; | 714 return false; |
715 | 715 |
716 var subtype = FileType.getType(url).subtype; | 716 var subtype = FileType.getType(url).subtype; |
717 return subtype == 'doc' || subtype == 'sheet'; | 717 return subtype == 'doc' || subtype == 'sheet'; |
718 }; | 718 }; |
719 | 719 |
720 /** | 720 /** |
721 * @param {GDataFileProperties} data GData file properties. | 721 * @param {DriveFileProperties} data Drive file properties. |
722 * @return {boolean} True if opening the file does not require downloading it | 722 * @return {boolean} True if opening the file does not require downloading it |
723 * via a metered connection. | 723 * via a metered connection. |
724 */ | 724 */ |
725 GDataProvider.isAvailableWhenMetered = function(data) { | 725 GDataProvider.isAvailableWhenMetered = function(data) { |
726 return data.isPresent || data.isHosted; | 726 return data.isPresent || data.isHosted; |
727 }; | 727 }; |
728 | 728 |
729 /** | 729 /** |
730 * Converts API metadata to internal format. | 730 * Converts API metadata to internal format. |
731 * @param {Object} data Metadata from API call. | 731 * @param {Object} data Metadata from API call. |
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
963 | 963 |
964 /** | 964 /** |
965 * Handles the 'log' message from the worker. | 965 * Handles the 'log' message from the worker. |
966 * @param {Array.<*>} arglist Log arguments. | 966 * @param {Array.<*>} arglist Log arguments. |
967 * @private | 967 * @private |
968 */ | 968 */ |
969 ContentProvider.prototype.onLog_ = function(arglist) { | 969 ContentProvider.prototype.onLog_ = function(arglist) { |
970 if (MetadataCache.log) // Avoid log spam by default. | 970 if (MetadataCache.log) // Avoid log spam by default. |
971 console.log.apply(console, ['metadata:'].concat(arglist)); | 971 console.log.apply(console, ['metadata:'].concat(arglist)); |
972 }; | 972 }; |
OLD | NEW |