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 #ifndef GOOGLE_APIS_DRIVE_DRIVE_ENTRY_KINDS_H_ | 5 #ifndef GOOGLE_APIS_DRIVE_DRIVE_ENTRY_KINDS_H_ |
6 #define GOOGLE_APIS_DRIVE_DRIVE_ENTRY_KINDS_H_ | 6 #define GOOGLE_APIS_DRIVE_DRIVE_ENTRY_KINDS_H_ |
7 | 7 |
| 8 #include <string> |
| 9 |
| 10 namespace base { |
| 11 class FilePath; |
| 12 } // namespace base |
| 13 |
8 namespace google_apis { | 14 namespace google_apis { |
9 | 15 |
10 // DriveEntryKind specifies the kind of a Drive entry. | 16 // DriveEntryKind specifies the kind of a Drive entry. |
11 // | 17 // |
12 // kEntryKindMap in gdata_wapi_parser.cc should also be updated if you modify | 18 // kEntryKindMap in gdata_wapi_parser.cc should also be updated if you modify |
13 // DriveEntryKind. The compiler will catch if they are not in sync. | 19 // DriveEntryKind. The compiler will catch if they are not in sync. |
14 enum DriveEntryKind { | 20 enum DriveEntryKind { |
15 ENTRY_KIND_UNKNOWN, | 21 ENTRY_KIND_UNKNOWN, |
16 // Special entries. | 22 // Special entries. |
17 ENTRY_KIND_ITEM, | 23 ENTRY_KIND_ITEM, |
(...skipping 10 matching lines...) Expand all Loading... |
28 // Folders; collections. | 34 // Folders; collections. |
29 ENTRY_KIND_FOLDER, | 35 ENTRY_KIND_FOLDER, |
30 // Regular files. | 36 // Regular files. |
31 ENTRY_KIND_FILE, | 37 ENTRY_KIND_FILE, |
32 ENTRY_KIND_PDF, | 38 ENTRY_KIND_PDF, |
33 | 39 |
34 // This should be the last item. | 40 // This should be the last item. |
35 ENTRY_KIND_MAX_VALUE, | 41 ENTRY_KIND_MAX_VALUE, |
36 }; | 42 }; |
37 | 43 |
| 44 // Classes of EntryKind. Used for ClassifyEntryKind(). |
| 45 enum DriveEntryKindClass { |
| 46 KIND_OF_NONE = 0, |
| 47 KIND_OF_HOSTED_DOCUMENT = 1, |
| 48 KIND_OF_GOOGLE_DOCUMENT = 1 << 1, |
| 49 KIND_OF_EXTERNAL_DOCUMENT = 1 << 2, |
| 50 KIND_OF_FOLDER = 1 << 3, |
| 51 KIND_OF_FILE = 1 << 4, |
| 52 }; |
| 53 |
| 54 // Returns preferred file extension for hosted documents. If entry is not |
| 55 // a hosted document, this call returns an empty string. |
| 56 std::string GetHostedDocumentExtension(DriveEntryKind kind); |
| 57 |
| 58 // Returns the kind enum corresponding to the extension in form ".xxx". |
| 59 DriveEntryKind GetEntryKindFromExtension(const std::string& extension); |
| 60 |
| 61 // Classifies the EntryKind. The returned value is a bitmask of |
| 62 // DriveEntryKindClass. For example, DOCUMENT is classified as |
| 63 // KIND_OF_HOSTED_DOCUMENT and KIND_OF_GOOGLE_DOCUMENT, hence the returned |
| 64 // value is KIND_OF_HOSTED_DOCUMENT | KIND_OF_GOOGLE_DOCUMENT. |
| 65 int ClassifyEntryKind(DriveEntryKind kind); |
| 66 |
| 67 // Classifies the EntryKind by the file extension of specific path. The |
| 68 // returned value is a bitmask of DriveEntryKindClass. See also |
| 69 // ClassifyEntryKind. |
| 70 int ClassifyEntryKindByFileExtension(const base::FilePath& file); |
| 71 |
38 } // namespace google_apis | 72 } // namespace google_apis |
39 | 73 |
40 #endif // GOOGLE_APIS_DRIVE_DRIVE_ENTRY_KINDS_H_ | 74 #endif // GOOGLE_APIS_DRIVE_DRIVE_ENTRY_KINDS_H_ |
OLD | NEW |