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

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

Issue 279213002: [fsp] Add support for closing files. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased. Created 6 years, 7 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 | Annotate | Revision Log
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 "webkit/browser/fileapi/async_file_util.h" 8 #include "webkit/browser/fileapi/async_file_util.h"
9 9
10 class EventRouter; 10 class EventRouter;
11 11
12 namespace base { 12 namespace base {
13 class FilePath; 13 class FilePath;
14 } // namespace base 14 } // namespace base
15 15
16 namespace chromeos { 16 namespace chromeos {
17 namespace file_system_provider { 17 namespace file_system_provider {
18 18
19 class ProvidedFileSystemInfo; 19 class ProvidedFileSystemInfo;
20 class RequestManager; 20 class RequestManager;
21 21
22 // Interface for a provided file system. Acts as a proxy between providers 22 // Interface for a provided file system. Acts as a proxy between providers
23 // and clients. 23 // and clients.
24 // TODO(mtomasz): Add more methods once implemented. 24 // TODO(mtomasz): Add more methods once implemented.
25 class ProvidedFileSystemInterface { 25 class ProvidedFileSystemInterface {
26 public: 26 public:
27 typedef base::Callback<void(int file_handle, base::File::Error result)>
28 OpenFileCallback;
29
27 // Mode of opening a file. Used by OpenFile(). 30 // Mode of opening a file. Used by OpenFile().
28 enum OpenFileMode { OPEN_FILE_MODE_READ, OPEN_FILE_MODE_WRITE }; 31 enum OpenFileMode { OPEN_FILE_MODE_READ, OPEN_FILE_MODE_WRITE };
29 32
30 virtual ~ProvidedFileSystemInterface() {} 33 virtual ~ProvidedFileSystemInterface() {}
31 34
32 // Requests unmounting of the file system. The callback is called when the 35 // Requests unmounting of the file system. The callback is called when the
33 // request is accepted or rejected, with an error code. 36 // request is accepted or rejected, with an error code.
34 virtual void RequestUnmount( 37 virtual void RequestUnmount(
35 const fileapi::AsyncFileUtil::StatusCallback& callback) = 0; 38 const fileapi::AsyncFileUtil::StatusCallback& callback) = 0;
36 39
37 // Requests metadata of the passed |entry_path|. It can be either a file 40 // Requests metadata of the passed |entry_path|. It can be either a file
38 // or a directory. 41 // or a directory.
39 virtual void GetMetadata( 42 virtual void GetMetadata(
40 const base::FilePath& entry_path, 43 const base::FilePath& entry_path,
41 const fileapi::AsyncFileUtil::GetFileInfoCallback& callback) = 0; 44 const fileapi::AsyncFileUtil::GetFileInfoCallback& callback) = 0;
45
42 // Requests enumerating entries from the passed |directory_path|. The callback 46 // Requests enumerating entries from the passed |directory_path|. The callback
43 // can be called multiple times until either an error is returned or the 47 // can be called multiple times until either an error is returned or the
44 // has_more field is set to false. 48 // has_more field is set to false.
45 virtual void ReadDirectory( 49 virtual void ReadDirectory(
46 const base::FilePath& directory_path, 50 const base::FilePath& directory_path,
47 const fileapi::AsyncFileUtil::ReadDirectoryCallback& callback) = 0; 51 const fileapi::AsyncFileUtil::ReadDirectoryCallback& callback) = 0;
48 52
49 // Requests opening a file at |file_path|. If |create| is set to true, it will 53 // Requests opening a file at |file_path|. If |create| is set to true, it will
50 // create a file and return succes in case it didn't exist. 54 // create a file and return success in case it didn't exist.
51 virtual void OpenFile( 55 virtual void OpenFile(const base::FilePath& file_path,
52 const base::FilePath& file_path, 56 OpenFileMode mode,
53 OpenFileMode mode, 57 bool create,
54 bool create, 58 const OpenFileCallback& callback) = 0;
59
60 // Requests closing a file, previously opened with OpenFile() as a file with
61 // |file_handle|. For either succes or error |callback| must be called.
62 virtual void CloseFile(
63 int file_handle,
55 const fileapi::AsyncFileUtil::StatusCallback& callback) = 0; 64 const fileapi::AsyncFileUtil::StatusCallback& callback) = 0;
56 65
57 // Returns a provided file system info for this file system. 66 // Returns a provided file system info for this file system.
58 virtual const ProvidedFileSystemInfo& GetFileSystemInfo() const = 0; 67 virtual const ProvidedFileSystemInfo& GetFileSystemInfo() const = 0;
59 68
60 // Returns a request manager for the file system. 69 // Returns a request manager for the file system.
61 virtual RequestManager* GetRequestManager() = 0; 70 virtual RequestManager* GetRequestManager() = 0;
62 }; 71 };
63 72
64 } // namespace file_system_provider 73 } // namespace file_system_provider
65 } // namespace chromeos 74 } // namespace chromeos
66 75
67 #endif // CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_PROVIDED_FILE_SYSTEM_INT ERFACE_H_ 76 #endif // CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_PROVIDED_FILE_SYSTEM_INT ERFACE_H_
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/file_system_provider/provided_file_system.cc ('k') | chrome/chrome_browser_chromeos.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698