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