Chromium Code Reviews| 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 #include "content/browser/fileapi/fileapi_message_filter.h" | 5 #include "content/browser/fileapi/fileapi_message_filter.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| 11 #include "base/files/file_path.h" | 11 #include "base/files/file_path.h" |
| 12 #include "base/logging.h" | |
| 12 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
| 13 #include "base/platform_file.h" | 14 #include "base/platform_file.h" |
| 14 #include "base/sequenced_task_runner.h" | 15 #include "base/sequenced_task_runner.h" |
| 16 #include "base/strings/string_util.h" | |
| 15 #include "base/threading/thread.h" | 17 #include "base/threading/thread.h" |
| 16 #include "base/time/time.h" | 18 #include "base/time/time.h" |
| 17 #include "content/browser/child_process_security_policy_impl.h" | 19 #include "content/browser/child_process_security_policy_impl.h" |
| 18 #include "content/browser/fileapi/browser_file_system_helper.h" | 20 #include "content/browser/fileapi/browser_file_system_helper.h" |
| 19 #include "content/browser/fileapi/chrome_blob_storage_context.h" | 21 #include "content/browser/fileapi/chrome_blob_storage_context.h" |
| 22 #include "content/browser/streams/stream_registry.h" | |
| 20 #include "content/common/fileapi/file_system_messages.h" | 23 #include "content/common/fileapi/file_system_messages.h" |
| 21 #include "content/common/fileapi/webblob_messages.h" | 24 #include "content/common/fileapi/webblob_messages.h" |
| 22 #include "content/public/browser/user_metrics.h" | 25 #include "content/public/browser/user_metrics.h" |
| 23 #include "ipc/ipc_platform_file.h" | 26 #include "ipc/ipc_platform_file.h" |
| 24 #include "net/base/mime_util.h" | 27 #include "net/base/mime_util.h" |
| 25 #include "net/url_request/url_request_context.h" | 28 #include "net/url_request/url_request_context.h" |
| 26 #include "net/url_request/url_request_context_getter.h" | 29 #include "net/url_request/url_request_context_getter.h" |
| 27 #include "url/gurl.h" | 30 #include "url/gurl.h" |
| 28 #include "webkit/browser/blob/blob_storage_controller.h" | 31 #include "webkit/browser/blob/blob_storage_controller.h" |
| 29 #include "webkit/browser/fileapi/file_observers.h" | 32 #include "webkit/browser/fileapi/file_observers.h" |
| (...skipping 27 matching lines...) Expand all Loading... | |
| 57 ChildProcessSecurityPolicyImpl::GetInstance()->RevokeAllPermissionsForFile( | 60 ChildProcessSecurityPolicyImpl::GetInstance()->RevokeAllPermissionsForFile( |
| 58 child_id, path); | 61 child_id, path); |
| 59 } | 62 } |
| 60 | 63 |
| 61 } // namespace | 64 } // namespace |
| 62 | 65 |
| 63 FileAPIMessageFilter::FileAPIMessageFilter( | 66 FileAPIMessageFilter::FileAPIMessageFilter( |
| 64 int process_id, | 67 int process_id, |
| 65 net::URLRequestContextGetter* request_context_getter, | 68 net::URLRequestContextGetter* request_context_getter, |
| 66 fileapi::FileSystemContext* file_system_context, | 69 fileapi::FileSystemContext* file_system_context, |
| 67 ChromeBlobStorageContext* blob_storage_context) | 70 ChromeBlobStorageContext* blob_storage_context, |
| 71 StreamContext* stream_context) | |
| 68 : process_id_(process_id), | 72 : process_id_(process_id), |
| 69 context_(file_system_context), | 73 context_(file_system_context), |
| 70 request_context_getter_(request_context_getter), | 74 request_context_getter_(request_context_getter), |
| 71 request_context_(NULL), | 75 request_context_(NULL), |
| 72 blob_storage_context_(blob_storage_context) { | 76 blob_storage_context_(blob_storage_context), |
| 77 stream_context_(stream_context) { | |
| 73 DCHECK(context_); | 78 DCHECK(context_); |
| 74 DCHECK(request_context_getter_.get()); | 79 DCHECK(request_context_getter_.get()); |
| 75 DCHECK(blob_storage_context); | 80 DCHECK(blob_storage_context); |
| 81 DCHECK(stream_context); | |
| 76 } | 82 } |
| 77 | 83 |
| 78 FileAPIMessageFilter::FileAPIMessageFilter( | 84 FileAPIMessageFilter::FileAPIMessageFilter( |
| 79 int process_id, | 85 int process_id, |
| 80 net::URLRequestContext* request_context, | 86 net::URLRequestContext* request_context, |
| 81 fileapi::FileSystemContext* file_system_context, | 87 fileapi::FileSystemContext* file_system_context, |
| 82 ChromeBlobStorageContext* blob_storage_context) | 88 ChromeBlobStorageContext* blob_storage_context, |
| 89 StreamContext* stream_context) | |
| 83 : process_id_(process_id), | 90 : process_id_(process_id), |
| 84 context_(file_system_context), | 91 context_(file_system_context), |
| 85 request_context_(request_context), | 92 request_context_(request_context), |
| 86 blob_storage_context_(blob_storage_context) { | 93 blob_storage_context_(blob_storage_context), |
| 94 stream_context_(stream_context) { | |
| 87 DCHECK(context_); | 95 DCHECK(context_); |
| 88 DCHECK(request_context_); | 96 DCHECK(request_context_); |
| 89 DCHECK(blob_storage_context); | 97 DCHECK(blob_storage_context); |
| 98 DCHECK(stream_context); | |
| 90 } | 99 } |
| 91 | 100 |
| 92 void FileAPIMessageFilter::OnChannelConnected(int32 peer_pid) { | 101 void FileAPIMessageFilter::OnChannelConnected(int32 peer_pid) { |
| 93 BrowserMessageFilter::OnChannelConnected(peer_pid); | 102 BrowserMessageFilter::OnChannelConnected(peer_pid); |
| 94 | 103 |
| 95 if (request_context_getter_.get()) { | 104 if (request_context_getter_.get()) { |
| 96 DCHECK(!request_context_); | 105 DCHECK(!request_context_); |
| 97 request_context_ = request_context_getter_->GetURLRequestContext(); | 106 request_context_ = request_context_getter_->GetURLRequestContext(); |
| 98 request_context_getter_ = NULL; | 107 request_context_getter_ = NULL; |
| 99 DCHECK(request_context_); | 108 DCHECK(request_context_); |
| 100 } | 109 } |
| 101 } | 110 } |
| 102 | 111 |
| 103 void FileAPIMessageFilter::OnChannelClosing() { | 112 void FileAPIMessageFilter::OnChannelClosing() { |
| 104 BrowserMessageFilter::OnChannelClosing(); | 113 BrowserMessageFilter::OnChannelClosing(); |
| 105 | 114 |
| 106 // Unregister all the blob URLs that are previously registered in this | 115 // Unregister all the blob and stream URLs that are previously registered in |
| 107 // process. | 116 // this process. |
| 108 for (base::hash_set<std::string>::const_iterator iter = blob_urls_.begin(); | 117 for (base::hash_set<std::string>::const_iterator iter = blob_urls_.begin(); |
| 109 iter != blob_urls_.end(); ++iter) { | 118 iter != blob_urls_.end(); ++iter) { |
| 110 blob_storage_context_->controller()->RemoveBlob(GURL(*iter)); | 119 blob_storage_context_->controller()->RemoveBlob(GURL(*iter)); |
| 111 } | 120 } |
| 121 for (base::hash_set<std::string>::const_iterator iter = stream_urls_.begin(); | |
| 122 iter != stream_urls_.end(); ++iter) { | |
| 123 stream_context_->registry()->UnregisterStream(GURL(*iter)); | |
| 124 } | |
| 112 | 125 |
| 113 in_transit_snapshot_files_.clear(); | 126 in_transit_snapshot_files_.clear(); |
| 114 | 127 |
| 115 // Close all files that are previously OpenFile()'ed in this process. | 128 // Close all files that are previously OpenFile()'ed in this process. |
| 116 if (!on_close_callbacks_.IsEmpty()) { | 129 if (!on_close_callbacks_.IsEmpty()) { |
| 117 DLOG(INFO) | 130 DLOG(INFO) |
| 118 << "File API: Renderer process shut down before NotifyCloseFile" | 131 << "File API: Renderer process shut down before NotifyCloseFile" |
| 119 << " for " << on_close_callbacks_.size() << " files opened in PPAPI"; | 132 << " for " << on_close_callbacks_.size() << " files opened in PPAPI"; |
| 120 } | 133 } |
| 121 | 134 |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 160 IPC_MESSAGE_HANDLER(FileSystemHostMsg_OpenFile, OnOpenFile) | 173 IPC_MESSAGE_HANDLER(FileSystemHostMsg_OpenFile, OnOpenFile) |
| 161 IPC_MESSAGE_HANDLER(FileSystemHostMsg_NotifyCloseFile, OnNotifyCloseFile) | 174 IPC_MESSAGE_HANDLER(FileSystemHostMsg_NotifyCloseFile, OnNotifyCloseFile) |
| 162 IPC_MESSAGE_HANDLER(FileSystemHostMsg_CreateSnapshotFile, | 175 IPC_MESSAGE_HANDLER(FileSystemHostMsg_CreateSnapshotFile, |
| 163 OnCreateSnapshotFile) | 176 OnCreateSnapshotFile) |
| 164 IPC_MESSAGE_HANDLER(FileSystemHostMsg_DidReceiveSnapshotFile, | 177 IPC_MESSAGE_HANDLER(FileSystemHostMsg_DidReceiveSnapshotFile, |
| 165 OnDidReceiveSnapshotFile) | 178 OnDidReceiveSnapshotFile) |
| 166 IPC_MESSAGE_HANDLER(FileSystemHostMsg_WillUpdate, OnWillUpdate) | 179 IPC_MESSAGE_HANDLER(FileSystemHostMsg_WillUpdate, OnWillUpdate) |
| 167 IPC_MESSAGE_HANDLER(FileSystemHostMsg_DidUpdate, OnDidUpdate) | 180 IPC_MESSAGE_HANDLER(FileSystemHostMsg_DidUpdate, OnDidUpdate) |
| 168 IPC_MESSAGE_HANDLER(FileSystemHostMsg_SyncGetPlatformPath, | 181 IPC_MESSAGE_HANDLER(FileSystemHostMsg_SyncGetPlatformPath, |
| 169 OnSyncGetPlatformPath) | 182 OnSyncGetPlatformPath) |
| 170 IPC_MESSAGE_HANDLER(BlobHostMsg_StartBuildingBlob, OnStartBuildingBlob) | 183 IPC_MESSAGE_HANDLER(BlobHostMsg_StartBuilding, OnStartBuildingBlob) |
| 171 IPC_MESSAGE_HANDLER(BlobHostMsg_AppendBlobDataItem, OnAppendBlobDataItem) | 184 IPC_MESSAGE_HANDLER(BlobHostMsg_AppendBlobDataItem, |
| 185 OnAppendBlobDataItemToBlob) | |
| 172 IPC_MESSAGE_HANDLER(BlobHostMsg_SyncAppendSharedMemory, | 186 IPC_MESSAGE_HANDLER(BlobHostMsg_SyncAppendSharedMemory, |
| 173 OnAppendSharedMemory) | 187 OnAppendSharedMemoryToBlob) |
| 174 IPC_MESSAGE_HANDLER(BlobHostMsg_FinishBuildingBlob, OnFinishBuildingBlob) | 188 IPC_MESSAGE_HANDLER(BlobHostMsg_FinishBuilding, OnFinishBuildingBlob) |
| 175 IPC_MESSAGE_HANDLER(BlobHostMsg_CloneBlob, OnCloneBlob) | 189 IPC_MESSAGE_HANDLER(BlobHostMsg_Clone, OnCloneBlob) |
| 176 IPC_MESSAGE_HANDLER(BlobHostMsg_RemoveBlob, OnRemoveBlob) | 190 IPC_MESSAGE_HANDLER(BlobHostMsg_Remove, OnRemoveBlob) |
| 191 IPC_MESSAGE_HANDLER(StreamHostMsg_StartBuilding, OnStartBuildingStream) | |
| 192 IPC_MESSAGE_HANDLER(StreamHostMsg_AppendBlobDataItem, | |
| 193 OnAppendBlobDataItemToStream) | |
| 194 IPC_MESSAGE_HANDLER(StreamHostMsg_SyncAppendSharedMemory, | |
| 195 OnAppendSharedMemoryToStream) | |
| 196 IPC_MESSAGE_HANDLER(StreamHostMsg_FinishBuilding, OnFinishBuildingStream) | |
| 197 IPC_MESSAGE_HANDLER(StreamHostMsg_Clone, OnCloneStream) | |
| 198 IPC_MESSAGE_HANDLER(StreamHostMsg_Remove, OnRemoveStream) | |
| 177 IPC_MESSAGE_UNHANDLED(handled = false) | 199 IPC_MESSAGE_UNHANDLED(handled = false) |
| 178 IPC_END_MESSAGE_MAP_EX() | 200 IPC_END_MESSAGE_MAP_EX() |
| 179 return handled; | 201 return handled; |
| 180 } | 202 } |
| 181 | 203 |
| 182 FileAPIMessageFilter::~FileAPIMessageFilter() {} | 204 FileAPIMessageFilter::~FileAPIMessageFilter() {} |
| 183 | 205 |
| 184 void FileAPIMessageFilter::BadMessageReceived() { | 206 void FileAPIMessageFilter::BadMessageReceived() { |
| 185 RecordAction(UserMetricsAction("BadMessageTerminate_FAMF")); | 207 RecordAction(UserMetricsAction("BadMessageTerminate_FAMF")); |
| 186 BrowserMessageFilter::BadMessageReceived(); | 208 BrowserMessageFilter::BadMessageReceived(); |
| (...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 512 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 534 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 513 in_transit_snapshot_files_.erase(request_id); | 535 in_transit_snapshot_files_.erase(request_id); |
| 514 } | 536 } |
| 515 | 537 |
| 516 void FileAPIMessageFilter::OnStartBuildingBlob(const GURL& url) { | 538 void FileAPIMessageFilter::OnStartBuildingBlob(const GURL& url) { |
| 517 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 539 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 518 blob_storage_context_->controller()->StartBuildingBlob(url); | 540 blob_storage_context_->controller()->StartBuildingBlob(url); |
| 519 blob_urls_.insert(url.spec()); | 541 blob_urls_.insert(url.spec()); |
| 520 } | 542 } |
| 521 | 543 |
| 522 void FileAPIMessageFilter::OnAppendBlobDataItem( | 544 void FileAPIMessageFilter::OnAppendBlobDataItemToBlob( |
| 523 const GURL& url, const BlobData::Item& item) { | 545 const GURL& url, const BlobData::Item& item) { |
| 524 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 546 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 525 if (item.type() == BlobData::Item::TYPE_FILE_FILESYSTEM) { | 547 if (item.type() == BlobData::Item::TYPE_FILE_FILESYSTEM) { |
| 526 base::PlatformFileError error; | 548 base::PlatformFileError error; |
| 527 FileSystemURL filesystem_url(context_->CrackURL(item.url())); | 549 FileSystemURL filesystem_url(context_->CrackURL(item.url())); |
| 528 if (!HasPermissionsForFile(filesystem_url, | 550 if (!HasPermissionsForFile(filesystem_url, |
| 529 fileapi::kReadFilePermissions, &error)) { | 551 fileapi::kReadFilePermissions, &error)) { |
| 530 OnRemoveBlob(url); | 552 OnRemoveBlob(url); |
| 531 return; | 553 return; |
| 532 } | 554 } |
| 533 } | 555 } |
| 534 if (item.type() == BlobData::Item::TYPE_FILE && | 556 if (item.type() == BlobData::Item::TYPE_FILE && |
| 535 !ChildProcessSecurityPolicyImpl::GetInstance()->CanReadFile( | 557 !ChildProcessSecurityPolicyImpl::GetInstance()->CanReadFile( |
| 536 process_id_, item.path())) { | 558 process_id_, item.path())) { |
| 537 OnRemoveBlob(url); | 559 OnRemoveBlob(url); |
| 538 return; | 560 return; |
| 539 } | 561 } |
| 540 if (item.length() == 0) { | 562 if (item.length() == 0) { |
| 541 BadMessageReceived(); | 563 BadMessageReceived(); |
| 542 return; | 564 return; |
| 543 } | 565 } |
| 544 blob_storage_context_->controller()->AppendBlobDataItem(url, item); | 566 blob_storage_context_->controller()->AppendBlobDataItem(url, item); |
| 545 } | 567 } |
| 546 | 568 |
| 547 void FileAPIMessageFilter::OnAppendSharedMemory( | 569 void FileAPIMessageFilter::OnAppendSharedMemoryToBlob( |
| 548 const GURL& url, base::SharedMemoryHandle handle, size_t buffer_size) { | 570 const GURL& url, base::SharedMemoryHandle handle, size_t buffer_size) { |
| 549 DCHECK(base::SharedMemory::IsHandleValid(handle)); | 571 DCHECK(base::SharedMemory::IsHandleValid(handle)); |
| 550 if (!buffer_size) { | 572 if (!buffer_size) { |
| 551 BadMessageReceived(); | 573 BadMessageReceived(); |
| 552 return; | 574 return; |
| 553 } | 575 } |
| 554 #if defined(OS_WIN) | 576 #if defined(OS_WIN) |
| 555 base::SharedMemory shared_memory(handle, true, PeerHandle()); | 577 base::SharedMemory shared_memory(handle, true, PeerHandle()); |
| 556 #else | 578 #else |
| 557 base::SharedMemory shared_memory(handle, true); | 579 base::SharedMemory shared_memory(handle, true); |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 579 blob_storage_context_->controller()->CloneBlob(url, src_url); | 601 blob_storage_context_->controller()->CloneBlob(url, src_url); |
| 580 blob_urls_.insert(url.spec()); | 602 blob_urls_.insert(url.spec()); |
| 581 } | 603 } |
| 582 | 604 |
| 583 void FileAPIMessageFilter::OnRemoveBlob(const GURL& url) { | 605 void FileAPIMessageFilter::OnRemoveBlob(const GURL& url) { |
| 584 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 606 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 585 blob_storage_context_->controller()->RemoveBlob(url); | 607 blob_storage_context_->controller()->RemoveBlob(url); |
| 586 blob_urls_.erase(url.spec()); | 608 blob_urls_.erase(url.spec()); |
| 587 } | 609 } |
| 588 | 610 |
| 611 // Currently |content_type| is ignored inside Chromium. | |
| 612 // | |
| 613 // TODO(tyoshino): Set |content_type| to the stream. | |
|
kinuko
2013/07/24 13:11:05
nit: I think common comment style is to have metho
tyoshino (SeeGerritForStatus)
2013/07/24 13:56:22
Moved to .h thanks
tyoshino (SeeGerritForStatus)
2013/07/25 04:03:52
Oops. Removal was not applied yet. Done again.
| |
| 614 void FileAPIMessageFilter::OnStartBuildingStream( | |
| 615 const GURL& url, const std::string& content_type) { | |
| 616 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | |
| 617 // Only an internal Blob URL is expected here. See the BlobURL of the Blink. | |
| 618 if (!StartsWithASCII( | |
| 619 url.path(), "blobinternal%3A///", true /* case_sensitive */)) { | |
| 620 NOTREACHED() << "Malformed Stream URL: " << url.path(); | |
| 621 BadMessageReceived(); | |
| 622 return; | |
| 623 } | |
| 624 // Use an empty security origin for now. Stream accepts a security origin | |
| 625 // but how it's handled is not fixed yet. | |
| 626 new Stream(stream_context_->registry(), | |
| 627 NULL /* write_observer */, | |
| 628 GURL(), | |
| 629 url); | |
| 630 stream_urls_.insert(url.spec()); | |
| 631 } | |
| 632 | |
| 633 void FileAPIMessageFilter::OnAppendBlobDataItemToStream( | |
| 634 const GURL& url, const BlobData::Item& item) { | |
| 635 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | |
| 636 | |
| 637 scoped_refptr<Stream> stream(GetStreamForURL(url)); | |
| 638 if (!stream.get()) { | |
| 639 NOTREACHED(); | |
| 640 return; | |
| 641 } | |
| 642 | |
| 643 // Data for stream is delivered as TYPE_BYTES item. | |
| 644 if (item.type() != BlobData::Item::TYPE_BYTES) { | |
| 645 BadMessageReceived(); | |
| 646 return; | |
| 647 } | |
| 648 stream->AddData(item.bytes(), item.length()); | |
| 649 } | |
| 650 | |
| 651 void FileAPIMessageFilter::OnAppendSharedMemoryToStream( | |
| 652 const GURL& url, base::SharedMemoryHandle handle, size_t buffer_size) { | |
| 653 DCHECK(base::SharedMemory::IsHandleValid(handle)); | |
| 654 if (!buffer_size) { | |
| 655 BadMessageReceived(); | |
| 656 return; | |
| 657 } | |
| 658 #if defined(OS_WIN) | |
| 659 base::SharedMemory shared_memory(handle, true, PeerHandle()); | |
| 660 #else | |
| 661 base::SharedMemory shared_memory(handle, true); | |
| 662 #endif | |
| 663 if (!shared_memory.Map(buffer_size)) { | |
| 664 OnRemoveStream(url); | |
| 665 return; | |
| 666 } | |
| 667 | |
| 668 scoped_refptr<Stream> stream(GetStreamForURL(url)); | |
| 669 if (!stream.get()) { | |
| 670 NOTREACHED(); | |
| 671 return; | |
| 672 } | |
| 673 | |
| 674 stream->AddData(static_cast<char*>(shared_memory.memory()), buffer_size); | |
| 675 } | |
| 676 | |
| 677 void FileAPIMessageFilter::OnFinishBuildingStream(const GURL& url) { | |
| 678 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | |
| 679 scoped_refptr<Stream> stream(GetStreamForURL(url)); | |
| 680 if (stream.get()) | |
| 681 stream->Finalize(); | |
| 682 else | |
| 683 NOTREACHED(); | |
| 684 } | |
| 685 | |
| 686 void FileAPIMessageFilter::OnCloneStream( | |
| 687 const GURL& url, const GURL& src_url) { | |
| 688 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | |
| 689 if (!GetStreamForURL(src_url)) { | |
| 690 NOTREACHED(); | |
| 691 return; | |
| 692 } | |
| 693 | |
| 694 stream_context_->registry()->CloneStream(url, src_url); | |
| 695 stream_urls_.insert(url.spec()); | |
| 696 } | |
| 697 | |
| 698 void FileAPIMessageFilter::OnRemoveStream(const GURL& url) { | |
| 699 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | |
| 700 | |
| 701 if (!GetStreamForURL(url).get()) { | |
| 702 NOTREACHED(); | |
| 703 return; | |
| 704 } | |
| 705 | |
| 706 stream_context_->registry()->UnregisterStream(url); | |
| 707 stream_urls_.erase(url.spec()); | |
| 708 } | |
| 709 | |
| 589 void FileAPIMessageFilter::DidFinish(int request_id, | 710 void FileAPIMessageFilter::DidFinish(int request_id, |
| 590 base::PlatformFileError result) { | 711 base::PlatformFileError result) { |
| 591 if (result == base::PLATFORM_FILE_OK) | 712 if (result == base::PLATFORM_FILE_OK) |
| 592 Send(new FileSystemMsg_DidSucceed(request_id)); | 713 Send(new FileSystemMsg_DidSucceed(request_id)); |
| 593 else | 714 else |
| 594 Send(new FileSystemMsg_DidFail(request_id, result)); | 715 Send(new FileSystemMsg_DidFail(request_id, result)); |
| 595 operations_.erase(request_id); | 716 operations_.erase(request_id); |
| 596 } | 717 } |
| 597 | 718 |
| 598 void FileAPIMessageFilter::DidGetMetadata( | 719 void FileAPIMessageFilter::DidGetMetadata( |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 731 Send(new FileSystemMsg_DidCreateSnapshotFile( | 852 Send(new FileSystemMsg_DidCreateSnapshotFile( |
| 732 request_id, info, platform_path)); | 853 request_id, info, platform_path)); |
| 733 } | 854 } |
| 734 | 855 |
| 735 bool FileAPIMessageFilter::HasPermissionsForFile( | 856 bool FileAPIMessageFilter::HasPermissionsForFile( |
| 736 const FileSystemURL& url, int permissions, base::PlatformFileError* error) { | 857 const FileSystemURL& url, int permissions, base::PlatformFileError* error) { |
| 737 return CheckFileSystemPermissionsForProcess(context_, process_id_, url, | 858 return CheckFileSystemPermissionsForProcess(context_, process_id_, url, |
| 738 permissions, error); | 859 permissions, error); |
| 739 } | 860 } |
| 740 | 861 |
| 862 scoped_refptr<Stream> FileAPIMessageFilter::GetStreamForURL(const GURL& url) { | |
| 863 return stream_context_->registry()->GetStream(url); | |
| 864 } | |
| 865 | |
| 741 fileapi::FileSystemOperationRunner* FileAPIMessageFilter::operation_runner() { | 866 fileapi::FileSystemOperationRunner* FileAPIMessageFilter::operation_runner() { |
| 742 return context_->operation_runner(); | 867 return context_->operation_runner(); |
| 743 } | 868 } |
| 744 | 869 |
| 745 } // namespace content | 870 } // namespace content |
| OLD | NEW |