Index: content/browser/fileapi/fileapi_message_filter.cc |
diff --git a/content/browser/fileapi/fileapi_message_filter.cc b/content/browser/fileapi/fileapi_message_filter.cc |
index 5258fbffd541a9015b580ed36a18ee9c8c53a99d..8e0959503dbb9bd474f982d075f1a3aeeaaa7980 100644 |
--- a/content/browser/fileapi/fileapi_message_filter.cc |
+++ b/content/browser/fileapi/fileapi_message_filter.cc |
@@ -146,6 +146,7 @@ bool FileAPIMessageFilter::OnMessageReceived( |
IPC_MESSAGE_HANDLER(FileSystemHostMsg_TouchFile, OnTouchFile) |
IPC_MESSAGE_HANDLER(FileSystemHostMsg_CancelWrite, OnCancel) |
IPC_MESSAGE_HANDLER(FileSystemHostMsg_OpenFile, OnOpenFile) |
+ IPC_MESSAGE_HANDLER(FileSystemHostMsg_NotifyCloseFile, OnNotifyCloseFile) |
IPC_MESSAGE_HANDLER(FileSystemHostMsg_CreateSnapshotFile, |
OnCreateSnapshotFile) |
IPC_MESSAGE_HANDLER(FileSystemHostMsg_WillUpdate, OnWillUpdate) |
@@ -393,6 +394,20 @@ void FileAPIMessageFilter::OnOpenFile( |
base::Bind(&FileAPIMessageFilter::DidOpenFile, this, request_id)); |
} |
+void FileAPIMessageFilter::OnNotifyCloseFile(int request_id, const GURL& path) { |
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
+ base::PlatformFileError error; |
+ const int open_permissions = base::PLATFORM_FILE_OPEN; |
+ if (!HasPermissionsForFile(path, open_permissions, &error)) { |
+ Send(new FileSystemMsg_DidFail(request_id, error)); |
kinuko
2012/06/13 06:38:29
What could happen if one opens a writable file, wr
kinaba
2012/06/25 11:14:02
Fm, right. Removed the permission check.
|
+ return; |
+ } |
+ |
+ GetNewOperation(path, request_id)->NotifyCloseFile( |
+ path, |
+ base::Bind(&FileAPIMessageFilter::DidFinish, this, request_id)); |
+} |
+ |
void FileAPIMessageFilter::OnWillUpdate(const GURL& path) { |
GURL origin_url; |
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |