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" |
(...skipping 17 matching lines...) Expand all Loading... | |
28 #include "webkit/blob/blob_storage_controller.h" | 28 #include "webkit/blob/blob_storage_controller.h" |
29 #include "webkit/blob/shareable_file_reference.h" | 29 #include "webkit/blob/shareable_file_reference.h" |
30 #include "webkit/fileapi/file_observers.h" | 30 #include "webkit/fileapi/file_observers.h" |
31 #include "webkit/fileapi/file_permission_policy.h" | 31 #include "webkit/fileapi/file_permission_policy.h" |
32 #include "webkit/fileapi/file_system_context.h" | 32 #include "webkit/fileapi/file_system_context.h" |
33 #include "webkit/fileapi/file_system_types.h" | 33 #include "webkit/fileapi/file_system_types.h" |
34 #include "webkit/fileapi/file_system_util.h" | 34 #include "webkit/fileapi/file_system_util.h" |
35 #include "webkit/fileapi/isolated_context.h" | 35 #include "webkit/fileapi/isolated_context.h" |
36 #include "webkit/fileapi/local_file_system_operation.h" | 36 #include "webkit/fileapi/local_file_system_operation.h" |
37 #include "webkit/fileapi/sandbox_mount_point_provider.h" | 37 #include "webkit/fileapi/sandbox_mount_point_provider.h" |
38 #include "webkit/quota/quota_manager.h" | |
38 | 39 |
39 using fileapi::FileSystemFileUtil; | 40 using fileapi::FileSystemFileUtil; |
40 using fileapi::FileSystemMountPointProvider; | 41 using fileapi::FileSystemMountPointProvider; |
41 using fileapi::FileSystemOperation; | 42 using fileapi::FileSystemOperation; |
42 using fileapi::FileSystemURL; | 43 using fileapi::FileSystemURL; |
43 using fileapi::FileUpdateObserver; | 44 using fileapi::FileUpdateObserver; |
44 using fileapi::LocalFileSystemOperation; | 45 using fileapi::LocalFileSystemOperation; |
45 using fileapi::UpdateObserverList; | 46 using fileapi::UpdateObserverList; |
46 using webkit_blob::BlobData; | 47 using webkit_blob::BlobData; |
47 using webkit_blob::BlobStorageController; | 48 using webkit_blob::BlobStorageController; |
(...skipping 636 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
684 const GURL& path, | 685 const GURL& path, |
685 base::PlatformFileError result, | 686 base::PlatformFileError result, |
686 base::PlatformFile file, | 687 base::PlatformFile file, |
687 base::ProcessHandle peer_handle) { | 688 base::ProcessHandle peer_handle) { |
688 if (result == base::PLATFORM_FILE_OK) { | 689 if (result == base::PLATFORM_FILE_OK) { |
689 IPC::PlatformFileForTransit file_for_transit = | 690 IPC::PlatformFileForTransit file_for_transit = |
690 file != base::kInvalidPlatformFileValue ? | 691 file != base::kInvalidPlatformFileValue ? |
691 IPC::GetFileHandleForProcess(file, peer_handle, true) : | 692 IPC::GetFileHandleForProcess(file, peer_handle, true) : |
692 IPC::InvalidPlatformFileForTransit(); | 693 IPC::InvalidPlatformFileForTransit(); |
693 open_filesystem_urls_.insert(path); | 694 open_filesystem_urls_.insert(path); |
694 Send(new FileSystemMsg_DidOpenFile(request_id, file_for_transit)); | 695 |
696 quota::QuotaLimitType quota_policy = quota::kQuotaLimitTypeUnknown; | |
697 quota::QuotaManagerProxy* quota_manager_proxy = | |
698 context_->quota_manager_proxy(); | |
699 CHECK(quota_manager_proxy); | |
700 CHECK(quota_manager_proxy->quota_manager()); | |
701 FileSystemURL url = context_->CrackURL(path); | |
702 if (quota_manager_proxy->quota_manager()->IsStorageUnlimited( | |
703 url.origin(), FileSystemTypeToQuotaStorageType(url.type()))) { | |
kinuko
2013/04/10 03:35:19
From the discussion, probably we should also check
hamaji
2013/04/10 14:49:18
Hmm, I'm not sure, but if we add this check, we en
dmichael (off chromium)
2013/04/10 16:02:42
I'm not sure I understand. IsInstalledApp(path) lo
kinuko
2013/04/11 02:32:45
Chatted /w hamaji. Currently the only unlimited&&!
| |
704 quota_policy = quota::kQuotaLimitTypeUnlimited; | |
705 } else { | |
706 quota_policy = quota::kQuotaLimitTypeLimited; | |
707 } | |
708 | |
709 Send(new FileSystemMsg_DidOpenFile(request_id, | |
710 file_for_transit, | |
711 quota_policy)); | |
695 } else { | 712 } else { |
696 Send(new FileSystemMsg_DidFail(request_id, result)); | 713 Send(new FileSystemMsg_DidFail(request_id, |
714 result)); | |
697 } | 715 } |
698 UnregisterOperation(request_id); | 716 UnregisterOperation(request_id); |
699 } | 717 } |
700 | 718 |
701 void FileAPIMessageFilter::DidWrite(int request_id, | 719 void FileAPIMessageFilter::DidWrite(int request_id, |
702 base::PlatformFileError result, | 720 base::PlatformFileError result, |
703 int64 bytes, | 721 int64 bytes, |
704 bool complete) { | 722 bool complete) { |
705 if (result == base::PLATFORM_FILE_OK) { | 723 if (result == base::PLATFORM_FILE_OK) { |
706 Send(new FileSystemMsg_DidWrite(request_id, bytes, complete)); | 724 Send(new FileSystemMsg_DidWrite(request_id, bytes, complete)); |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
878 Send(new FileSystemMsg_DidFail(request_id, error_code)); | 896 Send(new FileSystemMsg_DidFail(request_id, error_code)); |
879 return NULL; | 897 return NULL; |
880 } | 898 } |
881 | 899 |
882 DCHECK(operation); | 900 DCHECK(operation); |
883 operations_.AddWithID(operation, request_id); | 901 operations_.AddWithID(operation, request_id); |
884 return operation; | 902 return operation; |
885 } | 903 } |
886 | 904 |
887 } // namespace content | 905 } // namespace content |
OLD | NEW |