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

Side by Side Diff: chrome/browser/chromeos/file_system_provider/provided_file_system_interface.h

Issue 513683002: [fsp] Add support for providing thumbnails. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed comments. Created 6 years, 3 months 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
OLDNEW
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 9
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 22 matching lines...) Expand all
33 // method in ProvidedFileSystemInterface. 33 // method in ProvidedFileSystemInterface.
34 struct EntryMetadata { 34 struct EntryMetadata {
35 EntryMetadata(); 35 EntryMetadata();
36 ~EntryMetadata(); 36 ~EntryMetadata();
37 37
38 bool is_directory; 38 bool is_directory;
39 std::string name; 39 std::string name;
40 int64 size; 40 int64 size;
41 base::Time modification_time; 41 base::Time modification_time;
42 std::string mime_type; 42 std::string mime_type;
43 std::string thumbnail;
43 }; 44 };
44 45
45 // Interface for a provided file system. Acts as a proxy between providers 46 // Interface for a provided file system. Acts as a proxy between providers
46 // and clients. All of the request methods return an abort callback in order to 47 // and clients. All of the request methods return an abort callback in order to
47 // terminate it while running. They must be called on the same thread as the 48 // terminate it while running. They must be called on the same thread as the
48 // request methods. The cancellation callback may be null if the operation 49 // request methods. The cancellation callback may be null if the operation
49 // fails synchronously. 50 // fails synchronously.
50 class ProvidedFileSystemInterface { 51 class ProvidedFileSystemInterface {
51 public: 52 public:
53 // Mode of opening a file. Used by OpenFile().
54 enum OpenFileMode { OPEN_FILE_MODE_READ, OPEN_FILE_MODE_WRITE };
55
56 // Extra fields to be fetched with metadata.
57 enum MetadataField {
58 METADATA_FIELD_DEFAULT = 0,
59 METADATA_FIELD_THUMBNAIL = 1 << 0
60 };
61
52 typedef base::Callback<void(int file_handle, base::File::Error result)> 62 typedef base::Callback<void(int file_handle, base::File::Error result)>
53 OpenFileCallback; 63 OpenFileCallback;
54 64
55 typedef base::Callback< 65 typedef base::Callback<
56 void(int chunk_length, bool has_more, base::File::Error result)> 66 void(int chunk_length, bool has_more, base::File::Error result)>
57 ReadChunkReceivedCallback; 67 ReadChunkReceivedCallback;
58 68
59 typedef base::Callback<void(const EntryMetadata& entry_metadata, 69 typedef base::Callback<void(const EntryMetadata& entry_metadata,
60 base::File::Error result)> GetMetadataCallback; 70 base::File::Error result)> GetMetadataCallback;
61 71
62 typedef base::Callback<void( 72 typedef base::Callback<void(
63 const storage::AsyncFileUtil::StatusCallback& callback)> AbortCallback; 73 const storage::AsyncFileUtil::StatusCallback& callback)> AbortCallback;
64 74
65 // Mode of opening a file. Used by OpenFile(). 75 // Mask of fields requested from the GetMetadata() call.
66 enum OpenFileMode { OPEN_FILE_MODE_READ, OPEN_FILE_MODE_WRITE }; 76 typedef int MetadataFieldMask;
67 77
68 virtual ~ProvidedFileSystemInterface() {} 78 virtual ~ProvidedFileSystemInterface() {}
69 79
70 // Requests unmounting of the file system. The callback is called when the 80 // Requests unmounting of the file system. The callback is called when the
71 // request is accepted or rejected, with an error code. 81 // request is accepted or rejected, with an error code.
72 virtual AbortCallback RequestUnmount( 82 virtual AbortCallback RequestUnmount(
73 const storage::AsyncFileUtil::StatusCallback& callback) = 0; 83 const storage::AsyncFileUtil::StatusCallback& callback) = 0;
74 84
75 // Requests metadata of the passed |entry_path|. It can be either a file 85 // Requests metadata of the passed |entry_path|. It can be either a file
76 // or a directory. 86 // or a directory. All |fields| will be returned if supported. Note, that
87 // default fields are always returned.
77 virtual AbortCallback GetMetadata(const base::FilePath& entry_path, 88 virtual AbortCallback GetMetadata(const base::FilePath& entry_path,
89 MetadataFieldMask fields,
78 const GetMetadataCallback& callback) = 0; 90 const GetMetadataCallback& callback) = 0;
79 91
80 // Requests enumerating entries from the passed |directory_path|. The callback 92 // Requests enumerating entries from the passed |directory_path|. The callback
81 // can be called multiple times until |has_more| is set to false. 93 // can be called multiple times until |has_more| is set to false.
82 virtual AbortCallback ReadDirectory( 94 virtual AbortCallback ReadDirectory(
83 const base::FilePath& directory_path, 95 const base::FilePath& directory_path,
84 const storage::AsyncFileUtil::ReadDirectoryCallback& callback) = 0; 96 const storage::AsyncFileUtil::ReadDirectoryCallback& callback) = 0;
85 97
86 // Requests opening a file at |file_path|. If the file doesn't exist, then the 98 // Requests opening a file at |file_path|. If the file doesn't exist, then the
87 // operation will fail. 99 // operation will fail.
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 virtual RequestManager* GetRequestManager() = 0; 174 virtual RequestManager* GetRequestManager() = 0;
163 175
164 // Returns a weak pointer to this object. 176 // Returns a weak pointer to this object.
165 virtual base::WeakPtr<ProvidedFileSystemInterface> GetWeakPtr() = 0; 177 virtual base::WeakPtr<ProvidedFileSystemInterface> GetWeakPtr() = 0;
166 }; 178 };
167 179
168 } // namespace file_system_provider 180 } // namespace file_system_provider
169 } // namespace chromeos 181 } // namespace chromeos
170 182
171 #endif // CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_PROVIDED_FILE_SYSTEM_INT ERFACE_H_ 183 #endif // CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_PROVIDED_FILE_SYSTEM_INT ERFACE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698