• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 */
11var VolumeManagerCommon = {};
12
13/**
14 * Type of a root directory.
15 * @enum {string}
16 * @const
17 */
18VolumeManagerCommon.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 a provided volume.
38  PROVIDED: 'provided',
39
40  // Root for entries that is not located under RootType.DRIVE. e.g. shared
41  // files.
42  DRIVE_OTHER: 'drive_other',
43
44  // Fake root for offline available files on the drive.
45  DRIVE_OFFLINE: 'drive_offline',
46
47  // Fake root for shared files on the drive.
48  DRIVE_SHARED_WITH_ME: 'drive_shared_with_me',
49
50  // Fake root for recent files on the drive.
51  DRIVE_RECENT: 'drive_recent'
52});
53
54/**
55 * Error type of VolumeManager.
56 * @enum {string}
57 * @const
58 */
59VolumeManagerCommon.VolumeError = Object.freeze({
60  /* Internal errors */
61  TIMEOUT: 'timeout',
62
63  /* System events */
64  UNKNOWN: 'error_unknown',
65  INTERNAL: 'error_internal',
66  INVALID_ARGUMENT: 'error_invalid_argument',
67  INVALID_PATH: 'error_invalid_path',
68  ALREADY_MOUNTED: 'error_path_already_mounted',
69  PATH_NOT_MOUNTED: 'error_path_not_mounted',
70  DIRECTORY_CREATION_FAILED: 'error_directory_creation_failed',
71  INVALID_MOUNT_OPTIONS: 'error_invalid_mount_options',
72  INVALID_UNMOUNT_OPTIONS: 'error_invalid_unmount_options',
73  INSUFFICIENT_PERMISSIONS: 'error_insufficient_permissions',
74  MOUNT_PROGRAM_NOT_FOUND: 'error_mount_program_not_found',
75  MOUNT_PROGRAM_FAILED: 'error_mount_program_failed',
76  INVALID_DEVICE_PATH: 'error_invalid_device_path',
77  UNKNOWN_FILESYSTEM: 'error_unknown_filesystem',
78  UNSUPPORTED_FILESYSTEM: 'error_unsupported_filesystem',
79  INVALID_ARCHIVE: 'error_invalid_archive',
80  AUTHENTICATION: 'error_authentication',
81  PATH_UNMOUNTED: 'error_path_unmounted'
82});
83
84/**
85 * List of connection types of drive.
86 *
87 * Keep this in sync with the kDriveConnectionType* constants in
88 * private_api_dirve.cc.
89 *
90 * @enum {string}
91 * @const
92 */
93VolumeManagerCommon.DriveConnectionType = Object.freeze({
94  OFFLINE: 'offline',  // Connection is offline or drive is unavailable.
95  METERED: 'metered',  // Connection is metered. Should limit traffic.
96  ONLINE: 'online'     // Connection is online.
97});
98
99/**
100 * List of reasons of DriveConnectionType.
101 *
102 * Keep this in sync with the kDriveConnectionReason constants in
103 * private_api_drive.cc.
104 *
105 * @enum {string}
106 * @const
107 */
108VolumeManagerCommon.DriveConnectionReason = Object.freeze({
109  NOT_READY: 'not_ready',    // Drive is not ready or authentication is failed.
110  NO_NETWORK: 'no_network',  // Network connection is unavailable.
111  NO_SERVICE: 'no_service'   // Drive service is unavailable.
112});
113
114/**
115 * The type of each volume.
116 * @enum {string}
117 * @const
118 */
119VolumeManagerCommon.VolumeType = Object.freeze({
120  DRIVE: 'drive',
121  DOWNLOADS: 'downloads',
122  REMOVABLE: 'removable',
123  ARCHIVE: 'archive',
124  CLOUD_DEVICE: 'cloud_device',
125  MTP: 'mtp',
126  PROVIDED: 'provided'
127});
128