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 CONTENT_COMMON_FILEAPI_FILE_SYSTEM_DISPATCHER_H_ | 5 #ifndef CONTENT_COMMON_FILEAPI_FILE_SYSTEM_DISPATCHER_H_ |
6 #define CONTENT_COMMON_FILEAPI_FILE_SYSTEM_DISPATCHER_H_ | 6 #define CONTENT_COMMON_FILEAPI_FILE_SYSTEM_DISPATCHER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 bool TouchFile(const GURL& file_path, | 75 bool TouchFile(const GURL& file_path, |
76 const base::Time& last_access_time, | 76 const base::Time& last_access_time, |
77 const base::Time& last_modified_time, | 77 const base::Time& last_modified_time, |
78 fileapi::FileSystemCallbackDispatcher* dispatcher); | 78 fileapi::FileSystemCallbackDispatcher* dispatcher); |
79 | 79 |
80 // This returns a raw open PlatformFile, unlike the above, which are | 80 // This returns a raw open PlatformFile, unlike the above, which are |
81 // self-contained operations. | 81 // self-contained operations. |
82 bool OpenFile(const GURL& file_path, | 82 bool OpenFile(const GURL& file_path, |
83 int file_flags, // passed to FileUtilProxy::CreateOrOpen | 83 int file_flags, // passed to FileUtilProxy::CreateOrOpen |
84 fileapi::FileSystemCallbackDispatcher* dispatcher); | 84 fileapi::FileSystemCallbackDispatcher* dispatcher); |
| 85 // This must be paired with OpenFile, and called after finished using the |
| 86 // raw PlatformFile returned from OpenFile. |
| 87 bool NotifyCloseFile(const GURL& file_path); |
85 | 88 |
86 bool CreateSnapshotFile(const GURL& blod_url, | 89 bool CreateSnapshotFile(const GURL& blod_url, |
87 const GURL& file_path, | 90 const GURL& file_path, |
88 fileapi::FileSystemCallbackDispatcher* dispatcher); | 91 fileapi::FileSystemCallbackDispatcher* dispatcher); |
89 private: | 92 private: |
90 // Message handlers. | 93 // Message handlers. |
91 void OnDidOpenFileSystem(int request_id, | 94 void OnDidOpenFileSystem(int request_id, |
92 const std::string& name, | 95 const std::string& name, |
93 const GURL& root); | 96 const GURL& root); |
94 void OnDidSucceed(int request_id); | 97 void OnDidSucceed(int request_id); |
95 void OnDidReadMetadata(int request_id, | 98 void OnDidReadMetadata(int request_id, |
96 const base::PlatformFileInfo& file_info, | 99 const base::PlatformFileInfo& file_info, |
97 const FilePath& platform_path); | 100 const FilePath& platform_path); |
98 void OnDidReadDirectory( | 101 void OnDidReadDirectory( |
99 int request_id, | 102 int request_id, |
100 const std::vector<base::FileUtilProxy::Entry>& entries, | 103 const std::vector<base::FileUtilProxy::Entry>& entries, |
101 bool has_more); | 104 bool has_more); |
102 void OnDidFail(int request_id, base::PlatformFileError error_code); | 105 void OnDidFail(int request_id, base::PlatformFileError error_code); |
103 void OnDidWrite(int request_id, int64 bytes, bool complete); | 106 void OnDidWrite(int request_id, int64 bytes, bool complete); |
104 void OnDidOpenFile( | 107 void OnDidOpenFile( |
105 int request_id, | 108 int request_id, |
106 IPC::PlatformFileForTransit file); | 109 IPC::PlatformFileForTransit file); |
107 | 110 |
108 IDMap<fileapi::FileSystemCallbackDispatcher, IDMapOwnPointer> dispatchers_; | 111 IDMap<fileapi::FileSystemCallbackDispatcher, IDMapOwnPointer> dispatchers_; |
109 | 112 |
110 DISALLOW_COPY_AND_ASSIGN(FileSystemDispatcher); | 113 DISALLOW_COPY_AND_ASSIGN(FileSystemDispatcher); |
111 }; | 114 }; |
112 | 115 |
113 #endif // CONTENT_COMMON_FILEAPI_FILE_SYSTEM_DISPATCHER_H_ | 116 #endif // CONTENT_COMMON_FILEAPI_FILE_SYSTEM_DISPATCHER_H_ |
OLD | NEW |