Index: content/browser/renderer_host/blob_message_filter.cc |
=================================================================== |
--- content/browser/renderer_host/blob_message_filter.cc (revision 103169) |
+++ content/browser/renderer_host/blob_message_filter.cc (working copy) |
@@ -28,7 +28,7 @@ |
// process. |
for (base::hash_set<std::string>::const_iterator iter = blob_urls_.begin(); |
iter != blob_urls_.end(); ++iter) { |
- blob_storage_context_->controller()->UnregisterBlobUrl(GURL(*iter)); |
+ blob_storage_context_->controller()->RemoveBlob(GURL(*iter)); |
} |
} |
@@ -38,48 +38,49 @@ |
bool handled = true; |
IPC_BEGIN_MESSAGE_MAP_EX(BlobMessageFilter, message, *message_was_ok) |
- IPC_MESSAGE_HANDLER(BlobHostMsg_RegisterBlobUrl, OnRegisterBlobUrl) |
- IPC_MESSAGE_HANDLER(BlobHostMsg_RegisterBlobUrlFrom, OnRegisterBlobUrlFrom) |
- IPC_MESSAGE_HANDLER(BlobHostMsg_UnregisterBlobUrl, OnUnregisterBlobUrl) |
+ IPC_MESSAGE_HANDLER(BlobHostMsg_StartBuildingBlob, OnStartBuildingBlob) |
+ IPC_MESSAGE_HANDLER(BlobHostMsg_AppendBlobDataItem, OnAppendBlobDataItem) |
+ IPC_MESSAGE_HANDLER(BlobHostMsg_FinishBuildingBlob, OnFinishBuildingBlob) |
+ IPC_MESSAGE_HANDLER(BlobHostMsg_CloneBlob, OnCloneBlob) |
+ IPC_MESSAGE_HANDLER(BlobHostMsg_RemoveBlob, OnRemoveBlob) |
IPC_MESSAGE_UNHANDLED(handled = false) |
IPC_END_MESSAGE_MAP() |
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::OnStartBuildingBlob(const GURL& url) { |
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
+ blob_storage_context_->controller()->StartBuildingBlob(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)) { |
+ OnRemoveBlob(url); |
return; |
- blob_storage_context_->controller()->RegisterBlobUrl(url, blob_data); |
- blob_urls_.insert(url.spec()); |
+ } |
+ blob_storage_context_->controller()->AppendBlobDataItem(url, item); |
} |
-void BlobMessageFilter::OnRegisterBlobUrlFrom( |
+void BlobMessageFilter::OnFinishBuildingBlob( |
+ const GURL& url, const std::string& content_type) { |
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
+ blob_storage_context_->controller()->FinishBuildingBlob(url, content_type); |
+} |
+ |
+void BlobMessageFilter::OnCloneBlob( |
const GURL& url, const GURL& src_url) { |
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
- blob_storage_context_->controller()->RegisterBlobUrlFrom(url, src_url); |
+ blob_storage_context_->controller()->CloneBlob(url, src_url); |
blob_urls_.insert(url.spec()); |
} |
-void BlobMessageFilter::OnUnregisterBlobUrl(const GURL& url) { |
+void BlobMessageFilter::OnRemoveBlob(const GURL& url) { |
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
- blob_storage_context_->controller()->UnregisterBlobUrl(url); |
+ blob_storage_context_->controller()->RemoveBlob(url); |
blob_urls_.erase(url.spec()); |
} |