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 * Type of a root directory. | 8 * Type of a root directory. |
9 * @enum {string} | 9 * @enum {string} |
10 * @const | 10 * @const |
11 */ | 11 */ |
12 var RootType = Object.freeze({ | 12 var RootType = Object.freeze({ |
13 // Root of local directory. | 13 // Root of local directory. |
14 DOWNLOADS: 'downloads', | 14 DOWNLOADS: 'downloads', |
15 | 15 |
16 // Root of mounted archive file. | 16 // Root of mounted archive file. |
17 ARCHIVE: 'archive', | 17 ARCHIVE: 'archive', |
18 | 18 |
19 // Root of removal volume. | 19 // Root of removal volume. |
20 REMOVABLE: 'removable', | 20 REMOVABLE: 'removable', |
21 | 21 |
22 // Root of drive directory. | 22 // Root of drive directory. |
23 DRIVE: 'drive', | 23 DRIVE: 'drive', |
24 | 24 |
| 25 // Root for privet storage volume. |
| 26 CLOUD_DEVICE: 'cloud_device', |
| 27 |
25 // Root for entries that is not located under RootType.DRIVE. e.g. shared | 28 // Root for entries that is not located under RootType.DRIVE. e.g. shared |
26 // files. | 29 // files. |
27 DRIVE_OTHER: 'drive_other', | 30 DRIVE_OTHER: 'drive_other', |
28 | 31 |
29 // Fake root for offline available files on the drive. | 32 // Fake root for offline available files on the drive. |
30 DRIVE_OFFLINE: 'drive_offline', | 33 DRIVE_OFFLINE: 'drive_offline', |
31 | 34 |
32 // Fake root for shared files on the drive. | 35 // Fake root for shared files on the drive. |
33 DRIVE_SHARED_WITH_ME: 'drive_shared_with_me', | 36 DRIVE_SHARED_WITH_ME: 'drive_shared_with_me', |
34 | 37 |
35 // Fake root for recent files on the drive. | 38 // Fake root for recent files on the drive. |
36 DRIVE_RECENT: 'drive_recent' | 39 DRIVE_RECENT: 'drive_recent' |
37 }); | 40 }); |
38 | 41 |
39 /** | 42 /** |
40 * Top directory for each root type. | 43 * Top directory for each root type. |
41 * TODO(mtomasz): Deprecated. Remove this. | 44 * TODO(mtomasz): Deprecated. Remove this. |
42 * @enum {string} | 45 * @enum {string} |
43 * @const | 46 * @const |
44 */ | 47 */ |
45 var RootDirectory = Object.freeze({ | 48 var RootDirectory = Object.freeze({ |
46 DOWNLOADS: '/Downloads', | 49 DOWNLOADS: '/Downloads', |
47 ARCHIVE: '/archive', | 50 ARCHIVE: '/archive', |
48 REMOVABLE: '/removable', | 51 REMOVABLE: '/removable', |
49 DRIVE: '/drive', | 52 DRIVE: '/drive', |
| 53 CLOUD_DEVICE: '/privet', |
50 DRIVE_OFFLINE: '/drive_offline', // A fake root. Not the actual filesystem. | 54 DRIVE_OFFLINE: '/drive_offline', // A fake root. Not the actual filesystem. |
51 DRIVE_SHARED_WITH_ME: '/drive_shared_with_me', // A fake root. | 55 DRIVE_SHARED_WITH_ME: '/drive_shared_with_me', // A fake root. |
52 DRIVE_RECENT: '/drive_recent' // A fake root. | 56 DRIVE_RECENT: '/drive_recent' // A fake root. |
53 }); | 57 }); |
54 | 58 |
55 /** | 59 /** |
56 * Sub root directory for Drive. "root" and "other". This is not used now. | 60 * Sub root directory for Drive. "root" and "other". This is not used now. |
57 * TODO(haruki): Add namespaces support. http://crbug.com/174233. | 61 * TODO(haruki): Add namespaces support. http://crbug.com/174233. |
58 * @enum {string} | 62 * @enum {string} |
59 * @const | 63 * @const |
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
394 */ | 398 */ |
395 PathUtil.splitExtension = function(path) { | 399 PathUtil.splitExtension = function(path) { |
396 var dotPosition = path.lastIndexOf('.'); | 400 var dotPosition = path.lastIndexOf('.'); |
397 if (dotPosition <= path.lastIndexOf('/')) | 401 if (dotPosition <= path.lastIndexOf('/')) |
398 dotPosition = -1; | 402 dotPosition = -1; |
399 | 403 |
400 var filename = dotPosition != -1 ? path.substr(0, dotPosition) : path; | 404 var filename = dotPosition != -1 ? path.substr(0, dotPosition) : path; |
401 var extension = dotPosition != -1 ? path.substr(dotPosition) : ''; | 405 var extension = dotPosition != -1 ? path.substr(dotPosition) : ''; |
402 return [filename, extension]; | 406 return [filename, extension]; |
403 }; | 407 }; |
404 | |
OLD | NEW |