Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(947)

Unified Diff: content/browser/fileapi/fileapi_message_filter.cc

Issue 10541113: Notify CloseFile from Pepper to FileSystem. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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));

Powered by Google App Engine
This is Rietveld 408576698