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

Unified 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, 9 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/fileapi/fileapi_message_filter.cc
diff --git a/content/browser/fileapi/fileapi_message_filter.cc b/content/browser/fileapi/fileapi_message_filter.cc
index 7472115213db042bb44b6e3fc10a9ee4b1b1d499..1736bdcdb5551c999f5299b3c9c4b3ec9f06f89f 100644
--- a/content/browser/fileapi/fileapi_message_filter.cc
+++ b/content/browser/fileapi/fileapi_message_filter.cc
@@ -35,6 +35,7 @@
#include "webkit/fileapi/isolated_context.h"
#include "webkit/fileapi/local_file_system_operation.h"
#include "webkit/fileapi/sandbox_mount_point_provider.h"
+#include "webkit/quota/quota_manager.h"
using fileapi::FileSystemFileUtil;
using fileapi::FileSystemMountPointProvider;
@@ -680,20 +681,47 @@ void FileAPIMessageFilter::DidReadDirectory(
UnregisterOperation(request_id);
}
-void FileAPIMessageFilter::DidOpenFile(int request_id,
- const GURL& path,
- base::PlatformFileError result,
- base::PlatformFile file,
- base::ProcessHandle peer_handle) {
+void FileAPIMessageFilter::DidOpenFile(
+ int request_id,
+ const GURL& path,
+ base::PlatformFileError result,
+ base::PlatformFile file,
+ 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
if (result == base::PLATFORM_FILE_OK) {
IPC::PlatformFileForTransit file_for_transit =
file != base::kInvalidPlatformFileValue ?
IPC::GetFileHandleForProcess(file, peer_handle, true) :
IPC::InvalidPlatformFileForTransit();
open_filesystem_urls_.insert(path);
- Send(new FileSystemMsg_DidOpenFile(request_id, file_for_transit));
+
+ quota::QuotaPolicy quota_policy = quota::kQuotaPolicyUnknown;
+ quota::QuotaManagerProxy* quota_manager_proxy =
+ context_->quota_manager_proxy();
+ 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.
+ FileSystemURL url = context_->CrackURL(path);
+ if (quota_manager_proxy->quota_manager()->IsStorageUnlimited(
+ url.origin(), FileSystemTypeToQuotaStorageType(url.type()))) {
+ // TODO(hamaji): We are planning to introduce a special
+ // permission which is stronger than unlimitedStorage.
+ // We'll return kQuotaPolicyCanBypassCheck for apps with
+ // unlimitedStorage for now, but ideally, we should return
+ // kQuotaPolicyCanBypassCheck only when the app has the
+ // special permission.
+ // TODO(hamaji): Return kQuotaPolicyCanBypassCheck only for
+ // dev channels for the meantime.
+ // http://crbug.com/220029
+ quota_policy = quota::kQuotaPolicyCanBypassCheck;
+ } else {
+ quota_policy = quota::kQuotaPolicyCheckRequired;
+ }
+ }
+
+ Send(new FileSystemMsg_DidOpenFile(request_id,
+ file_for_transit,
+ quota_policy));
} else {
- Send(new FileSystemMsg_DidFail(request_id, result));
+ Send(new FileSystemMsg_DidFail(request_id,
+ result));
}
UnregisterOperation(request_id);
}

Powered by Google App Engine
This is Rietveld 408576698