Index: content/browser/renderer_host/blob_message_filter.cc |
=================================================================== |
--- content/browser/renderer_host/blob_message_filter.cc (revision 102629) |
+++ content/browser/renderer_host/blob_message_filter.cc (working copy) |
@@ -38,7 +38,10 @@ |
bool handled = true; |
IPC_BEGIN_MESSAGE_MAP_EX(BlobMessageFilter, message, *message_was_ok) |
- IPC_MESSAGE_HANDLER(BlobHostMsg_RegisterBlobUrl, OnRegisterBlobUrl) |
+ IPC_MESSAGE_HANDLER(BlobHostMsg_RegisterUnfinalizedBlobUrl, |
+ OnRegisterUnfinalizedBlobUrl) |
+ IPC_MESSAGE_HANDLER(BlobHostMsg_AppendBlobDataItem, OnAppendBlobDataItem) |
+ IPC_MESSAGE_HANDLER(BlobHostMsg_FinalizeBlob, OnFinalizeBlob) |
IPC_MESSAGE_HANDLER(BlobHostMsg_RegisterBlobUrlFrom, OnRegisterBlobUrlFrom) |
IPC_MESSAGE_HANDLER(BlobHostMsg_UnregisterBlobUrl, OnUnregisterBlobUrl) |
IPC_MESSAGE_UNHANDLED(handled = false) |
@@ -46,31 +49,30 @@ |
return handled; |
} |
-// Check if the child process has been granted permission to register the files. |
-bool BlobMessageFilter::CheckPermission( |
- webkit_blob::BlobData* blob_data) const { |
- ChildProcessSecurityPolicy* policy = |
- ChildProcessSecurityPolicy::GetInstance(); |
- for (std::vector<webkit_blob::BlobData::Item>::const_iterator iter = |
- blob_data->items().begin(); |
- iter != blob_data->items().end(); ++iter) { |
- if (iter->type() == webkit_blob::BlobData::TYPE_FILE) { |
- if (!policy->CanReadFile(process_id_, iter->file_path())) |
- return false; |
- } |
- } |
- return true; |
+void BlobMessageFilter::OnRegisterUnfinalizedBlobUrl(const GURL& url) { |
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
+ blob_storage_context_->controller()->RegisterUnfinalizedBlobUrl(url); |
+ blob_urls_.insert(url.spec()); |
} |
-void BlobMessageFilter::OnRegisterBlobUrl( |
- const GURL& url, const scoped_refptr<webkit_blob::BlobData>& blob_data) { |
+void BlobMessageFilter::OnAppendBlobDataItem( |
+ const GURL& url, const webkit_blob::BlobData::Item& item) { |
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
- if (!CheckPermission(blob_data.get())) |
+ if (item.type() == webkit_blob::BlobData::TYPE_FILE && |
+ !ChildProcessSecurityPolicy::GetInstance()->CanReadFile( |
+ process_id_, item.file_path())) { |
+ OnUnregisterBlobUrl(url); |
return; |
- blob_storage_context_->controller()->RegisterBlobUrl(url, blob_data); |
- blob_urls_.insert(url.spec()); |
+ } |
+ blob_storage_context_->controller()->AppendBlobDataItem(url, item); |
} |
+void BlobMessageFilter::OnFinalizeBlob( |
+ const GURL& url, const std::string& content_type) { |
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
+ blob_storage_context_->controller()->FinalizeBlob(url, content_type); |
+} |
+ |
void BlobMessageFilter::OnRegisterBlobUrlFrom( |
const GURL& url, const GURL& src_url) { |
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |