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::QuotaPolicy quota_policy = quota::kQuotaPolicyUnknown; | |
697 quota::QuotaManagerProxy* quota_manager_proxy = | |
698 context_->quota_manager_proxy(); | |
699 DCHECK(quota_manager_proxy); | |
700 DCHECK(quota_manager_proxy->quota_manager()); | |
dmichael (off chromium)
2013/04/05 15:39:28
If quota_manager_proxy is ever actually NULL, you'
hamaji
2013/04/05 17:00:49
Done, by CHECK
On 2013/04/05 15:39:28, dmichael w
| |
701 FileSystemURL url = context_->CrackURL(path); | |
702 if (quota_manager_proxy->quota_manager()->IsStorageUnlimited( | |
703 url.origin(), FileSystemTypeToQuotaStorageType(url.type()))) { | |
704 // TODO(hamaji): We are planning to introduce a special | |
705 // permission which is stronger than unlimitedStorage. | |
706 // We'll return kQuotaPolicyCanBypassCheck for apps with | |
707 // unlimitedStorage for now, but ideally, we should return | |
708 // kQuotaPolicyCanBypassCheck only when the app has the | |
709 // special permission. | |
710 // TODO(hamaji): Return kQuotaPolicyCanBypassCheck only for | |
711 // dev channels for the meantime. | |
712 // http://crbug.com/220029 | |
713 quota_policy = quota::kQuotaPolicyCanBypassCheck; | |
714 } else { | |
715 quota_policy = quota::kQuotaPolicyCheckRequired; | |
716 } | |
717 | |
718 Send(new FileSystemMsg_DidOpenFile(request_id, | |
719 file_for_transit, | |
720 quota_policy)); | |
695 } else { | 721 } else { |
696 Send(new FileSystemMsg_DidFail(request_id, result)); | 722 Send(new FileSystemMsg_DidFail(request_id, |
723 result)); | |
697 } | 724 } |
698 UnregisterOperation(request_id); | 725 UnregisterOperation(request_id); |
699 } | 726 } |
700 | 727 |
701 void FileAPIMessageFilter::DidWrite(int request_id, | 728 void FileAPIMessageFilter::DidWrite(int request_id, |
702 base::PlatformFileError result, | 729 base::PlatformFileError result, |
703 int64 bytes, | 730 int64 bytes, |
704 bool complete) { | 731 bool complete) { |
705 if (result == base::PLATFORM_FILE_OK) { | 732 if (result == base::PLATFORM_FILE_OK) { |
706 Send(new FileSystemMsg_DidWrite(request_id, bytes, complete)); | 733 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)); | 905 Send(new FileSystemMsg_DidFail(request_id, error_code)); |
879 return NULL; | 906 return NULL; |
880 } | 907 } |
881 | 908 |
882 DCHECK(operation); | 909 DCHECK(operation); |
883 operations_.AddWithID(operation, request_id); | 910 operations_.AddWithID(operation, request_id); |
884 return operation; | 911 return operation; |
885 } | 912 } |
886 | 913 |
887 } // namespace content | 914 } // namespace content |
OLD | NEW |