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_BROWSER_FILEAPI_FILEAPI_MESSAGE_FILTER_H_ | 5 #ifndef CONTENT_BROWSER_FILEAPI_FILEAPI_MESSAGE_FILTER_H_ |
6 #define CONTENT_BROWSER_FILEAPI_FILEAPI_MESSAGE_FILTER_H_ | 6 #define CONTENT_BROWSER_FILEAPI_FILEAPI_MESSAGE_FILTER_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/callback.h" | 11 #include "base/callback.h" |
12 #include "base/files/file_util_proxy.h" | 12 #include "base/files/file_util_proxy.h" |
13 #include "base/hash_tables.h" | 13 #include "base/hash_tables.h" |
14 #include "base/id_map.h" | 14 #include "base/id_map.h" |
15 #include "base/platform_file.h" | 15 #include "base/platform_file.h" |
16 #include "base/shared_memory.h" | 16 #include "base/shared_memory.h" |
17 #include "content/public/browser/browser_message_filter.h" | 17 #include "content/public/browser/browser_message_filter.h" |
18 #include "webkit/blob/blob_data.h" | 18 #include "webkit/blob/blob_data.h" |
19 #include "webkit/fileapi/file_system_types.h" | 19 #include "webkit/fileapi/file_system_types.h" |
20 | 20 |
21 class FilePath; | |
22 class GURL; | 21 class GURL; |
23 | 22 |
24 namespace base { | 23 namespace base { |
| 24 class FilePath; |
25 class Time; | 25 class Time; |
26 } | 26 } |
27 | 27 |
28 namespace fileapi { | 28 namespace fileapi { |
29 class FileSystemURL; | 29 class FileSystemURL; |
30 class FileSystemContext; | 30 class FileSystemContext; |
31 class FileSystemOperation; | 31 class FileSystemOperation; |
32 } | 32 } |
33 | 33 |
34 namespace net { | 34 namespace net { |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 void OnTouchFile(int request_id, | 106 void OnTouchFile(int request_id, |
107 const GURL& path, | 107 const GURL& path, |
108 const base::Time& last_access_time, | 108 const base::Time& last_access_time, |
109 const base::Time& last_modified_time); | 109 const base::Time& last_modified_time); |
110 void OnCancel(int request_id, int request_to_cancel); | 110 void OnCancel(int request_id, int request_to_cancel); |
111 void OnOpenFile(int request_id, const GURL& path, int file_flags); | 111 void OnOpenFile(int request_id, const GURL& path, int file_flags); |
112 void OnNotifyCloseFile(const GURL& path); | 112 void OnNotifyCloseFile(const GURL& path); |
113 void OnWillUpdate(const GURL& path); | 113 void OnWillUpdate(const GURL& path); |
114 void OnDidUpdate(const GURL& path, int64 delta); | 114 void OnDidUpdate(const GURL& path, int64 delta); |
115 void OnSyncGetPlatformPath(const GURL& path, | 115 void OnSyncGetPlatformPath(const GURL& path, |
116 FilePath* platform_path); | 116 base::FilePath* platform_path); |
117 void OnCreateSnapshotFile(int request_id, | 117 void OnCreateSnapshotFile(int request_id, |
118 const GURL& blob_url, | 118 const GURL& blob_url, |
119 const GURL& path); | 119 const GURL& path); |
120 | 120 |
121 void OnStartBuildingBlob(const GURL& url); | 121 void OnStartBuildingBlob(const GURL& url); |
122 void OnAppendBlobDataItem(const GURL& url, | 122 void OnAppendBlobDataItem(const GURL& url, |
123 const webkit_blob::BlobData::Item& item); | 123 const webkit_blob::BlobData::Item& item); |
124 void OnAppendSharedMemory(const GURL& url, base::SharedMemoryHandle handle, | 124 void OnAppendSharedMemory(const GURL& url, base::SharedMemoryHandle handle, |
125 size_t buffer_size); | 125 size_t buffer_size); |
126 void OnFinishBuildingBlob(const GURL& url, const std::string& content_type); | 126 void OnFinishBuildingBlob(const GURL& url, const std::string& content_type); |
127 void OnCloneBlob(const GURL& url, const GURL& src_url); | 127 void OnCloneBlob(const GURL& url, const GURL& src_url); |
128 void OnRemoveBlob(const GURL& url); | 128 void OnRemoveBlob(const GURL& url); |
129 | 129 |
130 // Callback functions to be used when each file operation is finished. | 130 // Callback functions to be used when each file operation is finished. |
131 void DidFinish(int request_id, base::PlatformFileError result); | 131 void DidFinish(int request_id, base::PlatformFileError result); |
132 void DidCancel(int request_id, base::PlatformFileError result); | 132 void DidCancel(int request_id, base::PlatformFileError result); |
133 void DidGetMetadata(int request_id, | 133 void DidGetMetadata(int request_id, |
134 base::PlatformFileError result, | 134 base::PlatformFileError result, |
135 const base::PlatformFileInfo& info, | 135 const base::PlatformFileInfo& info, |
136 const FilePath& platform_path); | 136 const base::FilePath& platform_path); |
137 void DidReadDirectory(int request_id, | 137 void DidReadDirectory(int request_id, |
138 base::PlatformFileError result, | 138 base::PlatformFileError result, |
139 const std::vector<base::FileUtilProxy::Entry>& entries, | 139 const std::vector<base::FileUtilProxy::Entry>& entries, |
140 bool has_more); | 140 bool has_more); |
141 void DidOpenFile(int request_id, | 141 void DidOpenFile(int request_id, |
142 const GURL& path, | 142 const GURL& path, |
143 base::PlatformFileError result, | 143 base::PlatformFileError result, |
144 base::PlatformFile file, | 144 base::PlatformFile file, |
145 base::ProcessHandle peer_handle); | 145 base::ProcessHandle peer_handle); |
146 void DidWrite(int request_id, | 146 void DidWrite(int request_id, |
147 base::PlatformFileError result, | 147 base::PlatformFileError result, |
148 int64 bytes, | 148 int64 bytes, |
149 bool complete); | 149 bool complete); |
150 void DidOpenFileSystem(int request_id, | 150 void DidOpenFileSystem(int request_id, |
151 base::PlatformFileError result, | 151 base::PlatformFileError result, |
152 const std::string& name, | 152 const std::string& name, |
153 const GURL& root); | 153 const GURL& root); |
154 void DidDeleteFileSystem(int request_id, | 154 void DidDeleteFileSystem(int request_id, |
155 base::PlatformFileError result); | 155 base::PlatformFileError result); |
156 void DidCreateSnapshot( | 156 void DidCreateSnapshot( |
157 int request_id, | 157 int request_id, |
158 const base::Callback<void(const FilePath&)>& register_file_callback, | 158 const base::Callback<void(const base::FilePath&)>& register_file_callback, |
159 base::PlatformFileError result, | 159 base::PlatformFileError result, |
160 const base::PlatformFileInfo& info, | 160 const base::PlatformFileInfo& info, |
161 const FilePath& platform_path, | 161 const base::FilePath& platform_path, |
162 const scoped_refptr<webkit_blob::ShareableFileReference>& file_ref); | 162 const scoped_refptr<webkit_blob::ShareableFileReference>& file_ref); |
163 | 163 |
164 // Registers the given file pointed by |virtual_path| and backed by | 164 // Registers the given file pointed by |virtual_path| and backed by |
165 // |platform_path| as the |blob_url|. Called by DidCreateSnapshot. | 165 // |platform_path| as the |blob_url|. Called by DidCreateSnapshot. |
166 void RegisterFileAsBlob(const GURL& blob_url, | 166 void RegisterFileAsBlob(const GURL& blob_url, |
167 const fileapi::FileSystemURL& url, | 167 const fileapi::FileSystemURL& url, |
168 const FilePath& platform_path); | 168 const base::FilePath& platform_path); |
169 | 169 |
170 // Checks renderer's access permissions for single file. | 170 // Checks renderer's access permissions for single file. |
171 bool HasPermissionsForFile(const fileapi::FileSystemURL& url, | 171 bool HasPermissionsForFile(const fileapi::FileSystemURL& url, |
172 int permissions, | 172 int permissions, |
173 base::PlatformFileError* error); | 173 base::PlatformFileError* error); |
174 | 174 |
175 // Creates a new FileSystemOperation based on |target_url|. | 175 // Creates a new FileSystemOperation based on |target_url|. |
176 fileapi::FileSystemOperation* GetNewOperation( | 176 fileapi::FileSystemOperation* GetNewOperation( |
177 const fileapi::FileSystemURL& target_url, | 177 const fileapi::FileSystemURL& target_url, |
178 int request_id); | 178 int request_id); |
(...skipping 20 matching lines...) Expand all Loading... |
199 // Keep track of file system file URLs opened by OpenFile() in this process. | 199 // Keep track of file system file URLs opened by OpenFile() in this process. |
200 // Need to close all of them when the renderer process dies. | 200 // Need to close all of them when the renderer process dies. |
201 std::multiset<GURL> open_filesystem_urls_; | 201 std::multiset<GURL> open_filesystem_urls_; |
202 | 202 |
203 DISALLOW_COPY_AND_ASSIGN(FileAPIMessageFilter); | 203 DISALLOW_COPY_AND_ASSIGN(FileAPIMessageFilter); |
204 }; | 204 }; |
205 | 205 |
206 } // namespace content | 206 } // namespace content |
207 | 207 |
208 #endif // CONTENT_BROWSER_FILEAPI_FILEAPI_MESSAGE_FILTER_H_ | 208 #endif // CONTENT_BROWSER_FILEAPI_FILEAPI_MESSAGE_FILTER_H_ |
OLD | NEW |