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 <map> |
8 #include <set> | 9 #include <set> |
9 #include <string> | 10 #include <string> |
10 | 11 |
11 #include "base/callback.h" | 12 #include "base/callback.h" |
12 #include "base/files/file_util_proxy.h" | 13 #include "base/files/file_util_proxy.h" |
13 #include "base/hash_tables.h" | 14 #include "base/hash_tables.h" |
14 #include "base/id_map.h" | 15 #include "base/id_map.h" |
15 #include "base/platform_file.h" | 16 #include "base/platform_file.h" |
16 #include "base/shared_memory.h" | 17 #include "base/shared_memory.h" |
17 #include "content/public/browser/browser_message_filter.h" | 18 #include "content/public/browser/browser_message_filter.h" |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 const base::Time& last_access_time, | 109 const base::Time& last_access_time, |
109 const base::Time& last_modified_time); | 110 const base::Time& last_modified_time); |
110 void OnCancel(int request_id, int request_to_cancel); | 111 void OnCancel(int request_id, int request_to_cancel); |
111 void OnOpenFile(int request_id, const GURL& path, int file_flags); | 112 void OnOpenFile(int request_id, const GURL& path, int file_flags); |
112 void OnNotifyCloseFile(const GURL& path); | 113 void OnNotifyCloseFile(const GURL& path); |
113 void OnWillUpdate(const GURL& path); | 114 void OnWillUpdate(const GURL& path); |
114 void OnDidUpdate(const GURL& path, int64 delta); | 115 void OnDidUpdate(const GURL& path, int64 delta); |
115 void OnSyncGetPlatformPath(const GURL& path, | 116 void OnSyncGetPlatformPath(const GURL& path, |
116 base::FilePath* platform_path); | 117 base::FilePath* platform_path); |
117 void OnCreateSnapshotFile(int request_id, | 118 void OnCreateSnapshotFile(int request_id, |
118 const GURL& blob_url, | |
119 const GURL& path); | 119 const GURL& path); |
| 120 void OnDidReceiveSnapshotFile(int request_id); |
| 121 |
| 122 void OnCreateSnapshotFile_Deprecated(int request_id, |
| 123 const GURL& blob_url, |
| 124 const GURL& path); |
120 | 125 |
121 void OnStartBuildingBlob(const GURL& url); | 126 void OnStartBuildingBlob(const GURL& url); |
122 void OnAppendBlobDataItem(const GURL& url, | 127 void OnAppendBlobDataItem(const GURL& url, |
123 const webkit_blob::BlobData::Item& item); | 128 const webkit_blob::BlobData::Item& item); |
124 void OnAppendSharedMemory(const GURL& url, base::SharedMemoryHandle handle, | 129 void OnAppendSharedMemory(const GURL& url, base::SharedMemoryHandle handle, |
125 size_t buffer_size); | 130 size_t buffer_size); |
126 void OnFinishBuildingBlob(const GURL& url, const std::string& content_type); | 131 void OnFinishBuildingBlob(const GURL& url, const std::string& content_type); |
127 void OnCloneBlob(const GURL& url, const GURL& src_url); | 132 void OnCloneBlob(const GURL& url, const GURL& src_url); |
128 void OnRemoveBlob(const GURL& url); | 133 void OnRemoveBlob(const GURL& url); |
129 | 134 |
(...skipping 18 matching lines...) Expand all Loading... |
148 int64 bytes, | 153 int64 bytes, |
149 bool complete); | 154 bool complete); |
150 void DidOpenFileSystem(int request_id, | 155 void DidOpenFileSystem(int request_id, |
151 base::PlatformFileError result, | 156 base::PlatformFileError result, |
152 const std::string& name, | 157 const std::string& name, |
153 const GURL& root); | 158 const GURL& root); |
154 void DidDeleteFileSystem(int request_id, | 159 void DidDeleteFileSystem(int request_id, |
155 base::PlatformFileError result); | 160 base::PlatformFileError result); |
156 void DidCreateSnapshot( | 161 void DidCreateSnapshot( |
157 int request_id, | 162 int request_id, |
| 163 const fileapi::FileSystemURL& url, |
| 164 base::PlatformFileError result, |
| 165 const base::PlatformFileInfo& info, |
| 166 const base::FilePath& platform_path, |
| 167 const scoped_refptr<webkit_blob::ShareableFileReference>& file_ref); |
| 168 |
| 169 void DidCreateSnapshot_Deprecated( |
| 170 int request_id, |
158 const base::Callback<void(const base::FilePath&)>& register_file_callback, | 171 const base::Callback<void(const base::FilePath&)>& register_file_callback, |
159 base::PlatformFileError result, | 172 base::PlatformFileError result, |
160 const base::PlatformFileInfo& info, | 173 const base::PlatformFileInfo& info, |
161 const base::FilePath& platform_path, | 174 const base::FilePath& platform_path, |
162 const scoped_refptr<webkit_blob::ShareableFileReference>& file_ref); | 175 const scoped_refptr<webkit_blob::ShareableFileReference>& file_ref); |
163 | |
164 // Registers the given file pointed by |virtual_path| and backed by | 176 // Registers the given file pointed by |virtual_path| and backed by |
165 // |platform_path| as the |blob_url|. Called by DidCreateSnapshot. | 177 // |platform_path| as the |blob_url|. Called by DidCreateSnapshot_Deprecated. |
166 void RegisterFileAsBlob(const GURL& blob_url, | 178 void RegisterFileAsBlob(const GURL& blob_url, |
167 const fileapi::FileSystemURL& url, | 179 const fileapi::FileSystemURL& url, |
168 const base::FilePath& platform_path); | 180 const base::FilePath& platform_path); |
169 | 181 |
170 // Checks renderer's access permissions for single file. | 182 // Checks renderer's access permissions for single file. |
171 bool HasPermissionsForFile(const fileapi::FileSystemURL& url, | 183 bool HasPermissionsForFile(const fileapi::FileSystemURL& url, |
172 int permissions, | 184 int permissions, |
173 base::PlatformFileError* error); | 185 base::PlatformFileError* error); |
174 | 186 |
175 // Creates a new FileSystemOperation based on |target_url|. | 187 // Creates a new FileSystemOperation based on |target_url|. |
(...skipping 13 matching lines...) Expand all Loading... |
189 // IO thread, which will extract the net::URLRequestContext from it. | 201 // IO thread, which will extract the net::URLRequestContext from it. |
190 scoped_refptr<net::URLRequestContextGetter> request_context_getter_; | 202 scoped_refptr<net::URLRequestContextGetter> request_context_getter_; |
191 net::URLRequestContext* request_context_; | 203 net::URLRequestContext* request_context_; |
192 | 204 |
193 scoped_refptr<ChromeBlobStorageContext> blob_storage_context_; | 205 scoped_refptr<ChromeBlobStorageContext> blob_storage_context_; |
194 | 206 |
195 // Keep track of blob URLs registered in this process. Need to unregister | 207 // Keep track of blob URLs registered in this process. Need to unregister |
196 // all of them when the renderer process dies. | 208 // all of them when the renderer process dies. |
197 base::hash_set<std::string> blob_urls_; | 209 base::hash_set<std::string> blob_urls_; |
198 | 210 |
| 211 // Used to keep snapshot files alive while a DidCreateSnapshot |
| 212 // is being sent to the renderer. |
| 213 std::map<int, scoped_refptr<webkit_blob::ShareableFileReference> > |
| 214 in_transit_snapshot_files_; |
| 215 |
199 // Keep track of file system file URLs opened by OpenFile() in this process. | 216 // 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. | 217 // Need to close all of them when the renderer process dies. |
201 std::multiset<GURL> open_filesystem_urls_; | 218 std::multiset<GURL> open_filesystem_urls_; |
202 | 219 |
203 DISALLOW_COPY_AND_ASSIGN(FileAPIMessageFilter); | 220 DISALLOW_COPY_AND_ASSIGN(FileAPIMessageFilter); |
204 }; | 221 }; |
205 | 222 |
206 } // namespace content | 223 } // namespace content |
207 | 224 |
208 #endif // CONTENT_BROWSER_FILEAPI_FILEAPI_MESSAGE_FILTER_H_ | 225 #endif // CONTENT_BROWSER_FILEAPI_FILEAPI_MESSAGE_FILTER_H_ |
OLD | NEW |