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

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

Issue 1151763007: Add the boilerplate for actions to File System Provider API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased + fixed a comment. Created 5 years, 6 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 #include <vector> 9 #include <vector>
10 10
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 // Type of an action.
55 enum ActionType {
56 ACTION_TYPE_SHARE,
57 ACTION_TYPE_PIN_TOGGLE,
58 ACTION_TYPE_CUSTOM
59 };
60
61 // Represents actions for either a file or a directory.
62 struct Action {
63 std::string id;
64 ActionType type;
65 std::string title;
66 };
67
68 typedef std::vector<Action> Actions;
69
54 // Mode of opening a file. Used by OpenFile(). 70 // Mode of opening a file. Used by OpenFile().
55 enum OpenFileMode { OPEN_FILE_MODE_READ, OPEN_FILE_MODE_WRITE }; 71 enum OpenFileMode { OPEN_FILE_MODE_READ, OPEN_FILE_MODE_WRITE };
56 72
57 // Contains information about an opened file. 73 // Contains information about an opened file.
58 struct OpenedFile { 74 struct OpenedFile {
59 OpenedFile(const base::FilePath& file_path, OpenFileMode& mode); 75 OpenedFile(const base::FilePath& file_path, OpenFileMode& mode);
60 OpenedFile(); 76 OpenedFile();
61 ~OpenedFile(); 77 ~OpenedFile();
62 78
63 base::FilePath file_path; 79 base::FilePath file_path;
(...skipping 20 matching lines...) Expand all
84 typedef base::Callback<void(int file_handle, base::File::Error result)> 100 typedef base::Callback<void(int file_handle, base::File::Error result)>
85 OpenFileCallback; 101 OpenFileCallback;
86 102
87 typedef base::Callback< 103 typedef base::Callback<
88 void(int chunk_length, bool has_more, base::File::Error result)> 104 void(int chunk_length, bool has_more, base::File::Error result)>
89 ReadChunkReceivedCallback; 105 ReadChunkReceivedCallback;
90 106
91 typedef base::Callback<void(scoped_ptr<EntryMetadata> entry_metadata, 107 typedef base::Callback<void(scoped_ptr<EntryMetadata> entry_metadata,
92 base::File::Error result)> GetMetadataCallback; 108 base::File::Error result)> GetMetadataCallback;
93 109
110 typedef base::Callback<void(const Actions& actions, base::File::Error result)>
111 GetActionsCallback;
112
94 // Mask of fields requested from the GetMetadata() call. 113 // Mask of fields requested from the GetMetadata() call.
95 typedef int MetadataFieldMask; 114 typedef int MetadataFieldMask;
96 115
97 virtual ~ProvidedFileSystemInterface() {} 116 virtual ~ProvidedFileSystemInterface() {}
98 117
99 // Requests unmounting of the file system. The callback is called when the 118 // Requests unmounting of the file system. The callback is called when the
100 // request is accepted or rejected, with an error code. 119 // request is accepted or rejected, with an error code.
101 virtual AbortCallback RequestUnmount( 120 virtual AbortCallback RequestUnmount(
102 const storage::AsyncFileUtil::StatusCallback& callback) = 0; 121 const storage::AsyncFileUtil::StatusCallback& callback) = 0;
103 122
104 // Requests metadata of the passed |entry_path|. It can be either a file 123 // 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 124 // or a directory. All |fields| will be returned if supported. Note, that
106 // default fields are always returned. 125 // default fields are always returned.
107 virtual AbortCallback GetMetadata(const base::FilePath& entry_path, 126 virtual AbortCallback GetMetadata(const base::FilePath& entry_path,
108 MetadataFieldMask fields, 127 MetadataFieldMask fields,
109 const GetMetadataCallback& callback) = 0; 128 const GetMetadataCallback& callback) = 0;
110 129
130 // Requests list of actions for the passed |entry_path|. It can be either a
131 // file or a directory.
132 virtual AbortCallback GetActions(const base::FilePath& entry_path,
133 const GetActionsCallback& callback) = 0;
134
111 // Requests enumerating entries from the passed |directory_path|. The callback 135 // Requests enumerating entries from the passed |directory_path|. The callback
112 // can be called multiple times until |has_more| is set to false. 136 // can be called multiple times until |has_more| is set to false.
113 virtual AbortCallback ReadDirectory( 137 virtual AbortCallback ReadDirectory(
114 const base::FilePath& directory_path, 138 const base::FilePath& directory_path,
115 const storage::AsyncFileUtil::ReadDirectoryCallback& callback) = 0; 139 const storage::AsyncFileUtil::ReadDirectoryCallback& callback) = 0;
116 140
117 // Requests opening a file at |file_path|. If the file doesn't exist, then the 141 // Requests opening a file at |file_path|. If the file doesn't exist, then the
118 // operation will fail. 142 // operation will fail.
119 virtual AbortCallback OpenFile(const base::FilePath& file_path, 143 virtual AbortCallback OpenFile(const base::FilePath& file_path,
120 OpenFileMode mode, 144 OpenFileMode mode,
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 virtual void RemoveObserver(ProvidedFileSystemObserver* observer) = 0; 267 virtual void RemoveObserver(ProvidedFileSystemObserver* observer) = 0;
244 268
245 // Returns a weak pointer to this object. 269 // Returns a weak pointer to this object.
246 virtual base::WeakPtr<ProvidedFileSystemInterface> GetWeakPtr() = 0; 270 virtual base::WeakPtr<ProvidedFileSystemInterface> GetWeakPtr() = 0;
247 }; 271 };
248 272
249 } // namespace file_system_provider 273 } // namespace file_system_provider
250 } // namespace chromeos 274 } // namespace chromeos
251 275
252 #endif // CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_PROVIDED_FILE_SYSTEM_INT ERFACE_H_ 276 #endif // CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_PROVIDED_FILE_SYSTEM_INT ERFACE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698