Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1147)

Side by Side Diff: content/browser/fileapi/fileapi_message_filter.cc

Issue 13508005: Allow RequestOSFileHandle if an app has unlimited storage (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: per kinuko's comment Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 625 matching lines...) Expand 10 before | Expand all | Expand 10 after
673 base::PlatformFileError result, 674 base::PlatformFileError result,
674 const std::vector<base::FileUtilProxy::Entry>& entries, 675 const std::vector<base::FileUtilProxy::Entry>& entries,
675 bool has_more) { 676 bool has_more) {
676 if (result == base::PLATFORM_FILE_OK) 677 if (result == base::PLATFORM_FILE_OK)
677 Send(new FileSystemMsg_DidReadDirectory(request_id, entries, has_more)); 678 Send(new FileSystemMsg_DidReadDirectory(request_id, entries, has_more));
678 else 679 else
679 Send(new FileSystemMsg_DidFail(request_id, result)); 680 Send(new FileSystemMsg_DidFail(request_id, result));
680 UnregisterOperation(request_id); 681 UnregisterOperation(request_id);
681 } 682 }
682 683
683 void FileAPIMessageFilter::DidOpenFile(int request_id, 684 void FileAPIMessageFilter::DidOpenFile(
684 const GURL& path, 685 int request_id,
685 base::PlatformFileError result, 686 const GURL& path,
686 base::PlatformFile file, 687 base::PlatformFileError result,
687 base::ProcessHandle peer_handle) { 688 base::PlatformFile file,
689 base::ProcessHandle peer_handle) {
dmichael (off chromium) 2013/04/04 17:25:09 nit: Why did you move these? If they still fit, it
hamaji 2013/04/04 22:27:22 Oops, I modified here because I was adding one mor
688 if (result == base::PLATFORM_FILE_OK) { 690 if (result == base::PLATFORM_FILE_OK) {
689 IPC::PlatformFileForTransit file_for_transit = 691 IPC::PlatformFileForTransit file_for_transit =
690 file != base::kInvalidPlatformFileValue ? 692 file != base::kInvalidPlatformFileValue ?
691 IPC::GetFileHandleForProcess(file, peer_handle, true) : 693 IPC::GetFileHandleForProcess(file, peer_handle, true) :
692 IPC::InvalidPlatformFileForTransit(); 694 IPC::InvalidPlatformFileForTransit();
693 open_filesystem_urls_.insert(path); 695 open_filesystem_urls_.insert(path);
694 Send(new FileSystemMsg_DidOpenFile(request_id, file_for_transit)); 696
697 quota::QuotaPolicy quota_policy = quota::kQuotaPolicyUnknown;
698 quota::QuotaManagerProxy* quota_manager_proxy =
699 context_->quota_manager_proxy();
700 if (quota_manager_proxy) {
dmichael (off chromium) 2013/04/04 17:25:09 It looks like if there is no quota_manager_proxy,
hamaji 2013/04/04 22:27:22 webkit/fileapi/local_file_system_operation.cc seem
kinuko 2013/04/05 02:37:11 Actually in the content/ layer I think we must alw
hamaji 2013/04/05 03:33:19 I see, thanks! I added DCHECK and removed this if.
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
719 Send(new FileSystemMsg_DidOpenFile(request_id,
720 file_for_transit,
721 quota_policy));
695 } else { 722 } else {
696 Send(new FileSystemMsg_DidFail(request_id, result)); 723 Send(new FileSystemMsg_DidFail(request_id,
724 result));
697 } 725 }
698 UnregisterOperation(request_id); 726 UnregisterOperation(request_id);
699 } 727 }
700 728
701 void FileAPIMessageFilter::DidWrite(int request_id, 729 void FileAPIMessageFilter::DidWrite(int request_id,
702 base::PlatformFileError result, 730 base::PlatformFileError result,
703 int64 bytes, 731 int64 bytes,
704 bool complete) { 732 bool complete) {
705 if (result == base::PLATFORM_FILE_OK) { 733 if (result == base::PLATFORM_FILE_OK) {
706 Send(new FileSystemMsg_DidWrite(request_id, bytes, complete)); 734 Send(new FileSystemMsg_DidWrite(request_id, bytes, complete));
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
878 Send(new FileSystemMsg_DidFail(request_id, error_code)); 906 Send(new FileSystemMsg_DidFail(request_id, error_code));
879 return NULL; 907 return NULL;
880 } 908 }
881 909
882 DCHECK(operation); 910 DCHECK(operation);
883 operations_.AddWithID(operation, request_id); 911 operations_.AddWithID(operation, request_id);
884 return operation; 912 return operation;
885 } 913 }
886 914
887 } // namespace content 915 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698