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 'use strict'; | 5 'use strict'; |
6 | 6 |
7 /** | 7 /** |
8 * Namespace for utility functions. | 8 * Namespace for utility functions. |
9 */ | 9 */ |
10 var util = {}; | 10 var util = {}; |
(...skipping 1088 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1099 /** | 1099 /** |
1100 * Compares two entries. | 1100 * Compares two entries. |
1101 * @param {Entry|Object} entry1 The entry to be compared. Can be a fake. | 1101 * @param {Entry|Object} entry1 The entry to be compared. Can be a fake. |
1102 * @param {Entry|Object} entry2 The entry to be compared. Can be a fake. | 1102 * @param {Entry|Object} entry2 The entry to be compared. Can be a fake. |
1103 * @return {boolean} True if the both entry represents a same file or | 1103 * @return {boolean} True if the both entry represents a same file or |
1104 * directory. Returns true if both entries are null. | 1104 * directory. Returns true if both entries are null. |
1105 */ | 1105 */ |
1106 util.isSameEntry = function(entry1, entry2) { | 1106 util.isSameEntry = function(entry1, entry2) { |
1107 // Currently, we can assume there is only one root. | 1107 // Currently, we can assume there is only one root. |
1108 // When we support multi-file system, we need to look at filesystem, too. | 1108 // When we support multi-file system, we need to look at filesystem, too. |
1109 return (entry1 && entry2 && entry1.fullPath === entry2.fullPath) || | 1109 return (entry1 && entry2 && entry1.toURL() === entry2.toURL()) || |
1110 (!entry1 && !entry2); | 1110 (!entry1 && !entry2); |
1111 }; | 1111 }; |
1112 | 1112 |
1113 /** | 1113 /** |
| 1114 * TODO(mtomasz, yoshiki): Deprecated. Only used in directory_tree.js. Will |
| 1115 * be removed soon. |
| 1116 * |
1114 * @param {Entry|Object} parent The parent entry. Can be a fake. | 1117 * @param {Entry|Object} parent The parent entry. Can be a fake. |
1115 * @param {Entry|Object} child The child entry. Can be a fake. | 1118 * @param {Entry|Object} child The child entry. Can be a fake. |
1116 * @return {boolean} True if parent entry is actualy the parent of the child | 1119 * @return {boolean} True if parent entry is actualy the parent of the child |
1117 * entry. | 1120 * entry. |
1118 */ | 1121 */ |
1119 util.isParentEntry = function(parent, child) { | 1122 util.isParentEntry = function(parent, child) { |
1120 // Currently, we can assume there is only one root. | 1123 // Currently, we can assume there is only one root. |
1121 // When we support multi-file system, we need to look at filesystem, too. | 1124 // When we support multi-file system, we need to look at filesystem, too. |
1122 return PathUtil.isParentPath(parent.fullPath, child.fullPath); | 1125 return PathUtil.isParentPath(parent.fullPath, child.fullPath); |
1123 }; | 1126 }; |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1253 * The type of each volume. | 1256 * The type of each volume. |
1254 * @enum {string} | 1257 * @enum {string} |
1255 * @const | 1258 * @const |
1256 */ | 1259 */ |
1257 util.VolumeType = Object.freeze({ | 1260 util.VolumeType = Object.freeze({ |
1258 DRIVE: 'drive', | 1261 DRIVE: 'drive', |
1259 DOWNLOADS: 'downloads', | 1262 DOWNLOADS: 'downloads', |
1260 REMOVABLE: 'removable', | 1263 REMOVABLE: 'removable', |
1261 ARCHIVE: 'archive' | 1264 ARCHIVE: 'archive' |
1262 }); | 1265 }); |
OLD | NEW |