Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(415)

Side by Side Diff: chromeos/dbus/cros_disks_client.h

Issue 11365142: Small refactoring in DiskMountManager (event reporting; format method). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: few lint nits Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chromeos/chromeos.gyp ('k') | chromeos/dbus/cros_disks_client.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #ifndef CHROMEOS_DBUS_CROS_DISKS_CLIENT_H_ 5 #ifndef CHROMEOS_DBUS_CROS_DISKS_CLIENT_H_
6 #define CHROMEOS_DBUS_CROS_DISKS_CLIENT_H_ 6 #define CHROMEOS_DBUS_CROS_DISKS_CLIENT_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/basictypes.h" 11 #include "base/basictypes.h"
12 #include "base/callback.h" 12 #include "base/callback.h"
13 #include "chromeos/chromeos_export.h" 13 #include "chromeos/chromeos_export.h"
14 #include "chromeos/dbus/dbus_client_implementation_type.h" 14 #include "chromeos/dbus/dbus_client_implementation_type.h"
15 15
16 namespace dbus { 16 namespace dbus {
17 class Bus; 17 class Bus;
18 class Response; 18 class Response;
19 } 19 }
20 20
21 // TODO(tbarzic): We should probably move these enums inside CrosDisksClient, 21 // TODO(tbarzic): We should move these enums inside CrosDisksClient,
22 // to be clearer where they come from. 22 // to be clearer where they come from. Also, most of these are partially or
23 // completely duplicated in third_party/dbus/service_constants.h. We should
24 // probably use enums from service_contstants directly.
23 namespace chromeos { 25 namespace chromeos {
24 26
25 // Enum describing types of mount used by cros-disks. 27 // Enum describing types of mount used by cros-disks.
26 enum MountType { 28 enum MountType {
27 MOUNT_TYPE_INVALID, 29 MOUNT_TYPE_INVALID,
28 MOUNT_TYPE_DEVICE, 30 MOUNT_TYPE_DEVICE,
29 MOUNT_TYPE_ARCHIVE, 31 MOUNT_TYPE_ARCHIVE,
30 MOUNT_TYPE_GDATA, 32 MOUNT_TYPE_GDATA,
31 MOUNT_TYPE_NETWORK_STORAGE, 33 MOUNT_TYPE_NETWORK_STORAGE,
32 }; 34 };
33 35
34 // Type of device. 36 // Type of device.
35 enum DeviceType { 37 enum DeviceType {
36 DEVICE_TYPE_UNKNOWN, 38 DEVICE_TYPE_UNKNOWN,
37 DEVICE_TYPE_USB, // USB stick. 39 DEVICE_TYPE_USB, // USB stick.
38 DEVICE_TYPE_SD, // SD card. 40 DEVICE_TYPE_SD, // SD card.
39 DEVICE_TYPE_OPTICAL_DISC, // e.g. Optical disc excluding DVD. 41 DEVICE_TYPE_OPTICAL_DISC, // e.g. Optical disc excluding DVD.
40 DEVICE_TYPE_MOBILE, // Storage on a mobile device (e.g. Android). 42 DEVICE_TYPE_MOBILE, // Storage on a mobile device (e.g. Android).
41 DEVICE_TYPE_DVD, // DVD. 43 DEVICE_TYPE_DVD, // DVD.
42 }; 44 };
43 45
44 // Mount error code used by cros-disks. 46 // Mount error code used by cros-disks.
45 enum MountError { 47 enum MountError {
46 MOUNT_ERROR_NONE = 0, 48 MOUNT_ERROR_NONE = 0,
47 MOUNT_ERROR_UNKNOWN = 1, 49 MOUNT_ERROR_UNKNOWN = 1,
48 MOUNT_ERROR_INTERNAL = 2, 50 MOUNT_ERROR_INTERNAL = 2,
51 MOUNT_ERROR_INVALID_ARGUMENT = 3,
52 MOUNT_ERROR_INVALID_PATH = 4,
53 MOUNT_ERROR_PATH_ALREADY_MOUNTED = 5,
54 MOUNT_ERROR_PATH_NOT_MOUNTED = 6,
55 MOUNT_ERROR_DIRECTORY_CREATION_FAILED = 7,
56 MOUNT_ERROR_INVALID_MOUNT_OPTIONS = 8,
57 MOUNT_ERROR_INVALID_UNMOUNT_OPTIONS = 9,
58 MOUNT_ERROR_INSUFFICIENT_PERMISSIONS = 10,
59 MOUNT_ERROR_MOUNT_PROGRAM_NOT_FOUND = 11,
60 MOUNT_ERROR_MOUNT_PROGRAM_FAILED = 12,
61 MOUNT_ERROR_INVALID_DEVICE_PATH = 100,
49 MOUNT_ERROR_UNKNOWN_FILESYSTEM = 101, 62 MOUNT_ERROR_UNKNOWN_FILESYSTEM = 101,
50 MOUNT_ERROR_UNSUPPORTED_FILESYSTEM = 102, 63 MOUNT_ERROR_UNSUPPORTED_FILESYSTEM = 102,
51 MOUNT_ERROR_INVALID_ARCHIVE = 201, 64 MOUNT_ERROR_INVALID_ARCHIVE = 201,
52 MOUNT_ERROR_NOT_AUTHENTICATED = 601, 65 MOUNT_ERROR_NOT_AUTHENTICATED = 601,
53 MOUNT_ERROR_PATH_UNMOUNTED = 901, 66 MOUNT_ERROR_PATH_UNMOUNTED = 901,
54 // TODO(tbarzic): Add more error codes as they get added to cros-disks and 67 // TODO(tbarzic): Add more error codes as they get added to cros-disks and
55 // consider doing explicit translation from cros-disks error_types. 68 // consider doing explicit translation from cros-disks error_types.
56 }; 69 };
57 70
71 // Format error reported by cros-disks.
72 enum FormatError {
73 FORMAT_ERROR_NONE,
74 FORMAT_ERROR_UNKNOWN,
75 FORMAT_ERROR_INTERNAL,
76 FORMAT_ERROR_INVALID_DEVICE_PATH,
77 FORMAT_ERROR_DEVICE_BEING_FORMATTED,
78 FORMAT_ERROR_UNSUPPORTED_FILESYSTEM,
79 FORMAT_ERROR_FORMAT_PROGRAM_NOT_FOUND,
80 FORMAT_ERROR_FORMAT_PROGRAM_FAILED,
81 FORMAT_ERROR_DEVICE_NOT_ALLOWED,
82 };
83
58 // Event type each corresponding to a signal sent from cros-disks. 84 // Event type each corresponding to a signal sent from cros-disks.
59 enum MountEventType { 85 enum MountEventType {
60 DISK_ADDED, 86 CROS_DISKS_DISK_ADDED,
61 DISK_REMOVED, 87 CROS_DISKS_DISK_REMOVED,
62 DISK_CHANGED, 88 CROS_DISKS_DISK_CHANGED,
63 DEVICE_ADDED, 89 CROS_DISKS_DEVICE_ADDED,
64 DEVICE_REMOVED, 90 CROS_DISKS_DEVICE_REMOVED,
65 DEVICE_SCANNED, 91 CROS_DISKS_DEVICE_SCANNED,
66 FORMATTING_FINISHED, 92 CROS_DISKS_FORMATTING_FINISHED,
67 }; 93 };
68 94
69 // Additional unmount flags to be added to unmount request. 95 // Additional unmount flags to be added to unmount request.
70 enum UnmountOptions { 96 enum UnmountOptions {
71 UNMOUNT_OPTIONS_NONE, 97 UNMOUNT_OPTIONS_NONE,
72 UNMOUNT_OPTIONS_LAZY, // Do lazy unmount. 98 UNMOUNT_OPTIONS_LAZY, // Do lazy unmount.
73 }; 99 };
74 100
75 // A class to represent information about a disk sent from cros-disks. 101 // A class to represent information about a disk sent from cros-disks.
76 class DiskInfo { 102 class DiskInfo {
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 // Create() should be used instead. 292 // Create() should be used instead.
267 CrosDisksClient(); 293 CrosDisksClient();
268 294
269 private: 295 private:
270 DISALLOW_COPY_AND_ASSIGN(CrosDisksClient); 296 DISALLOW_COPY_AND_ASSIGN(CrosDisksClient);
271 }; 297 };
272 298
273 } // namespace chromeos 299 } // namespace chromeos
274 300
275 #endif // CHROMEOS_DBUS_CROS_DISKS_CLIENT_H_ 301 #endif // CHROMEOS_DBUS_CROS_DISKS_CLIENT_H_
OLDNEW
« no previous file with comments | « chromeos/chromeos.gyp ('k') | chromeos/dbus/cros_disks_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698