Upstream version 7.36.149.0
[platform/framework/web/crosswalk.git] / src / ui / file_manager / file_manager / common / js / volume_manager_common.js
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 'use strict';
6
7 /**
8  * Namespace for common types shared between VolumeManager and
9  * VolumeManagerWrapper.
10  */
11 var VolumeManagerCommon = {};
12
13 /**
14  * Type of a root directory.
15  * @enum {string}
16  * @const
17  */
18 VolumeManagerCommon.RootType = Object.freeze({
19   // Root for a downloads directory.
20   DOWNLOADS: 'downloads',
21
22   // Root for a mounted archive volume.
23   ARCHIVE: 'archive',
24
25   // Root for a removable volume.
26   REMOVABLE: 'removable',
27
28   // Root for a drive volume.
29   DRIVE: 'drive',
30
31   // Root for a privet storage volume.
32   CLOUD_DEVICE: 'cloud_device',
33
34   // Root for a MTP volume.
35   MTP: 'mtp',
36
37   // Root for entries that is not located under RootType.DRIVE. e.g. shared
38   // files.
39   DRIVE_OTHER: 'drive_other',
40
41   // Fake root for offline available files on the drive.
42   DRIVE_OFFLINE: 'drive_offline',
43
44   // Fake root for shared files on the drive.
45   DRIVE_SHARED_WITH_ME: 'drive_shared_with_me',
46
47   // Fake root for recent files on the drive.
48   DRIVE_RECENT: 'drive_recent'
49 });
50
51 /**
52  * Error type of VolumeManager.
53  * @enum {string}
54  * @const
55  */
56 VolumeManagerCommon.VolumeError = Object.freeze({
57   /* Internal errors */
58   TIMEOUT: 'timeout',
59
60   /* System events */
61   UNKNOWN: 'error_unknown',
62   INTERNAL: 'error_internal',
63   INVALID_ARGUMENT: 'error_invalid_argument',
64   INVALID_PATH: 'error_invalid_path',
65   ALREADY_MOUNTED: 'error_path_already_mounted',
66   PATH_NOT_MOUNTED: 'error_path_not_mounted',
67   DIRECTORY_CREATION_FAILED: 'error_directory_creation_failed',
68   INVALID_MOUNT_OPTIONS: 'error_invalid_mount_options',
69   INVALID_UNMOUNT_OPTIONS: 'error_invalid_unmount_options',
70   INSUFFICIENT_PERMISSIONS: 'error_insufficient_permissions',
71   MOUNT_PROGRAM_NOT_FOUND: 'error_mount_program_not_found',
72   MOUNT_PROGRAM_FAILED: 'error_mount_program_failed',
73   INVALID_DEVICE_PATH: 'error_invalid_device_path',
74   UNKNOWN_FILESYSTEM: 'error_unknown_filesystem',
75   UNSUPPORTED_FILESYSTEM: 'error_unsupported_filesystem',
76   INVALID_ARCHIVE: 'error_invalid_archive',
77   AUTHENTICATION: 'error_authentication',
78   PATH_UNMOUNTED: 'error_path_unmounted'
79 });
80
81 /**
82  * List of connection types of drive.
83  *
84  * Keep this in sync with the kDriveConnectionType* constants in
85  * private_api_dirve.cc.
86  *
87  * @enum {string}
88  * @const
89  */
90 VolumeManagerCommon.DriveConnectionType = Object.freeze({
91   OFFLINE: 'offline',  // Connection is offline or drive is unavailable.
92   METERED: 'metered',  // Connection is metered. Should limit traffic.
93   ONLINE: 'online'     // Connection is online.
94 });
95
96 /**
97  * List of reasons of DriveConnectionType.
98  *
99  * Keep this in sync with the kDriveConnectionReason constants in
100  * private_api_drive.cc.
101  *
102  * @enum {string}
103  * @const
104  */
105 VolumeManagerCommon.DriveConnectionReason = Object.freeze({
106   NOT_READY: 'not_ready',    // Drive is not ready or authentication is failed.
107   NO_NETWORK: 'no_network',  // Network connection is unavailable.
108   NO_SERVICE: 'no_service'   // Drive service is unavailable.
109 });
110
111 /**
112  * The type of each volume.
113  * @enum {string}
114  * @const
115  */
116 VolumeManagerCommon.VolumeType = Object.freeze({
117   DRIVE: 'drive',
118   DOWNLOADS: 'downloads',
119   REMOVABLE: 'removable',
120   ARCHIVE: 'archive',
121   CLOUD_DEVICE: 'cloud_device',
122   MTP: 'mtp',
123 });
124
125
126 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
127 // Use of this source code is governed by a BSD-style license that can be
128 // found in the LICENSE file.
129
130 'use strict';
131
132 /**
133  * Namespace for common types shared between VolumeManager and
134  * VolumeManagerWrapper.
135  */
136 var VolumeManagerCommon = {};
137
138 /**
139  * Type of a root directory.
140  * @enum {string}
141  * @const
142  */
143 VolumeManagerCommon.RootType = Object.freeze({
144   // Root for a downloads directory.
145   DOWNLOADS: 'downloads',
146
147   // Root for a mounted archive volume.
148   ARCHIVE: 'archive',
149
150   // Root for a removable volume.
151   REMOVABLE: 'removable',
152
153   // Root for a drive volume.
154   DRIVE: 'drive',
155
156   // Root for a privet storage volume.
157   CLOUD_DEVICE: 'cloud_device',
158
159   // Root for a MTP volume.
160   MTP: 'mtp',
161
162   // Root for entries that is not located under RootType.DRIVE. e.g. shared
163   // files.
164   DRIVE_OTHER: 'drive_other',
165
166   // Fake root for offline available files on the drive.
167   DRIVE_OFFLINE: 'drive_offline',
168
169   // Fake root for shared files on the drive.
170   DRIVE_SHARED_WITH_ME: 'drive_shared_with_me',
171
172   // Fake root for recent files on the drive.
173   DRIVE_RECENT: 'drive_recent'
174 });
175
176 /**
177  * Error type of VolumeManager.
178  * @enum {string}
179  * @const
180  */
181 VolumeManagerCommon.VolumeError = Object.freeze({
182   /* Internal errors */
183   NOT_MOUNTED: 'not_mounted',
184   TIMEOUT: 'timeout',
185
186   /* System events */
187   UNKNOWN: 'error_unknown',
188   INTERNAL: 'error_internal',
189   UNKNOWN_FILESYSTEM: 'error_unknown_filesystem',
190   UNSUPPORTED_FILESYSTEM: 'error_unsupported_filesystem',
191   INVALID_ARCHIVE: 'error_invalid_archive',
192   AUTHENTICATION: 'error_authentication',
193   PATH_UNMOUNTED: 'error_path_unmounted'
194 });
195
196 /**
197  * List of connection types of drive.
198  *
199  * Keep this in sync with the kDriveConnectionType* constants in
200  * private_api_dirve.cc.
201  *
202  * @enum {string}
203  * @const
204  */
205 VolumeManagerCommon.DriveConnectionType = Object.freeze({
206   OFFLINE: 'offline',  // Connection is offline or drive is unavailable.
207   METERED: 'metered',  // Connection is metered. Should limit traffic.
208   ONLINE: 'online'     // Connection is online.
209 });
210
211 /**
212  * List of reasons of DriveConnectionType.
213  *
214  * Keep this in sync with the kDriveConnectionReason constants in
215  * private_api_drive.cc.
216  *
217  * @enum {string}
218  * @const
219  */
220 VolumeManagerCommon.DriveConnectionReason = Object.freeze({
221   NOT_READY: 'not_ready',    // Drive is not ready or authentication is failed.
222   NO_NETWORK: 'no_network',  // Network connection is unavailable.
223   NO_SERVICE: 'no_service'   // Drive service is unavailable.
224 });
225
226 /**
227  * The type of each volume.
228  * @enum {string}
229  * @const
230  */
231 VolumeManagerCommon.VolumeType = Object.freeze({
232   DRIVE: 'drive',
233   DOWNLOADS: 'downloads',
234   REMOVABLE: 'removable',
235   ARCHIVE: 'archive',
236   CLOUD_DEVICE: 'cloud_device'
237 });
238
239