OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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 CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_PROVIDED_FILE_SYSTEM_INTERF
ACE_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_PROVIDED_FILE_SYSTEM_INTERF
ACE_H_ |
6 #define CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_PROVIDED_FILE_SYSTEM_INTERF
ACE_H_ | 6 #define CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_PROVIDED_FILE_SYSTEM_INTERF
ACE_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 std::string name; | 44 std::string name; |
45 int64 size; | 45 int64 size; |
46 base::Time modification_time; | 46 base::Time modification_time; |
47 std::string mime_type; | 47 std::string mime_type; |
48 std::string thumbnail; | 48 std::string thumbnail; |
49 | 49 |
50 private: | 50 private: |
51 DISALLOW_COPY_AND_ASSIGN(EntryMetadata); | 51 DISALLOW_COPY_AND_ASSIGN(EntryMetadata); |
52 }; | 52 }; |
53 | 53 |
| 54 // Represents actions for either a file or a directory. |
| 55 struct Action { |
| 56 std::string id; |
| 57 std::string title; |
| 58 }; |
| 59 |
| 60 typedef std::vector<Action> Actions; |
| 61 |
54 // Mode of opening a file. Used by OpenFile(). | 62 // Mode of opening a file. Used by OpenFile(). |
55 enum OpenFileMode { OPEN_FILE_MODE_READ, OPEN_FILE_MODE_WRITE }; | 63 enum OpenFileMode { OPEN_FILE_MODE_READ, OPEN_FILE_MODE_WRITE }; |
56 | 64 |
57 // Contains information about an opened file. | 65 // Contains information about an opened file. |
58 struct OpenedFile { | 66 struct OpenedFile { |
59 OpenedFile(const base::FilePath& file_path, OpenFileMode& mode); | 67 OpenedFile(const base::FilePath& file_path, OpenFileMode& mode); |
60 OpenedFile(); | 68 OpenedFile(); |
61 ~OpenedFile(); | 69 ~OpenedFile(); |
62 | 70 |
63 base::FilePath file_path; | 71 base::FilePath file_path; |
(...skipping 20 matching lines...) Expand all Loading... |
84 typedef base::Callback<void(int file_handle, base::File::Error result)> | 92 typedef base::Callback<void(int file_handle, base::File::Error result)> |
85 OpenFileCallback; | 93 OpenFileCallback; |
86 | 94 |
87 typedef base::Callback< | 95 typedef base::Callback< |
88 void(int chunk_length, bool has_more, base::File::Error result)> | 96 void(int chunk_length, bool has_more, base::File::Error result)> |
89 ReadChunkReceivedCallback; | 97 ReadChunkReceivedCallback; |
90 | 98 |
91 typedef base::Callback<void(scoped_ptr<EntryMetadata> entry_metadata, | 99 typedef base::Callback<void(scoped_ptr<EntryMetadata> entry_metadata, |
92 base::File::Error result)> GetMetadataCallback; | 100 base::File::Error result)> GetMetadataCallback; |
93 | 101 |
| 102 typedef base::Callback<void(const Actions& actions, base::File::Error result)> |
| 103 GetActionsCallback; |
| 104 |
94 // Mask of fields requested from the GetMetadata() call. | 105 // Mask of fields requested from the GetMetadata() call. |
95 typedef int MetadataFieldMask; | 106 typedef int MetadataFieldMask; |
96 | 107 |
97 virtual ~ProvidedFileSystemInterface() {} | 108 virtual ~ProvidedFileSystemInterface() {} |
98 | 109 |
99 // Requests unmounting of the file system. The callback is called when the | 110 // Requests unmounting of the file system. The callback is called when the |
100 // request is accepted or rejected, with an error code. | 111 // request is accepted or rejected, with an error code. |
101 virtual AbortCallback RequestUnmount( | 112 virtual AbortCallback RequestUnmount( |
102 const storage::AsyncFileUtil::StatusCallback& callback) = 0; | 113 const storage::AsyncFileUtil::StatusCallback& callback) = 0; |
103 | 114 |
104 // Requests metadata of the passed |entry_path|. It can be either a file | 115 // Requests metadata of the passed |entry_path|. It can be either a file |
105 // or a directory. All |fields| will be returned if supported. Note, that | 116 // or a directory. All |fields| will be returned if supported. Note, that |
106 // default fields are always returned. | 117 // default fields are always returned. |
107 virtual AbortCallback GetMetadata(const base::FilePath& entry_path, | 118 virtual AbortCallback GetMetadata(const base::FilePath& entry_path, |
108 MetadataFieldMask fields, | 119 MetadataFieldMask fields, |
109 const GetMetadataCallback& callback) = 0; | 120 const GetMetadataCallback& callback) = 0; |
110 | 121 |
| 122 // Requests list of actions for the passed |entry_path|. It can be either a |
| 123 // file or a directory. |
| 124 virtual AbortCallback GetActions(const base::FilePath& entry_path, |
| 125 const GetActionsCallback& callback) = 0; |
| 126 |
111 // Requests enumerating entries from the passed |directory_path|. The callback | 127 // Requests enumerating entries from the passed |directory_path|. The callback |
112 // can be called multiple times until |has_more| is set to false. | 128 // can be called multiple times until |has_more| is set to false. |
113 virtual AbortCallback ReadDirectory( | 129 virtual AbortCallback ReadDirectory( |
114 const base::FilePath& directory_path, | 130 const base::FilePath& directory_path, |
115 const storage::AsyncFileUtil::ReadDirectoryCallback& callback) = 0; | 131 const storage::AsyncFileUtil::ReadDirectoryCallback& callback) = 0; |
116 | 132 |
117 // Requests opening a file at |file_path|. If the file doesn't exist, then the | 133 // Requests opening a file at |file_path|. If the file doesn't exist, then the |
118 // operation will fail. | 134 // operation will fail. |
119 virtual AbortCallback OpenFile(const base::FilePath& file_path, | 135 virtual AbortCallback OpenFile(const base::FilePath& file_path, |
120 OpenFileMode mode, | 136 OpenFileMode mode, |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
243 virtual void RemoveObserver(ProvidedFileSystemObserver* observer) = 0; | 259 virtual void RemoveObserver(ProvidedFileSystemObserver* observer) = 0; |
244 | 260 |
245 // Returns a weak pointer to this object. | 261 // Returns a weak pointer to this object. |
246 virtual base::WeakPtr<ProvidedFileSystemInterface> GetWeakPtr() = 0; | 262 virtual base::WeakPtr<ProvidedFileSystemInterface> GetWeakPtr() = 0; |
247 }; | 263 }; |
248 | 264 |
249 } // namespace file_system_provider | 265 } // namespace file_system_provider |
250 } // namespace chromeos | 266 } // namespace chromeos |
251 | 267 |
252 #endif // CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_PROVIDED_FILE_SYSTEM_INT
ERFACE_H_ | 268 #endif // CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_PROVIDED_FILE_SYSTEM_INT
ERFACE_H_ |
OLD | NEW |