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

Unified Diff: content/browser/fileapi/fileapi_message_filter.cc

Issue 11787028: New FileSystemURL cracking (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Couple of nits I noticed Created 7 years, 11 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 dcba381a25e689b9c1e5a91aab1bb72b26ec3959..0c01f38af6fa2e3b1ff574f3af0fbc306af6681a 100644
--- a/content/browser/fileapi/fileapi_message_filter.cc
+++ b/content/browser/fileapi/fileapi_message_filter.cc
@@ -115,7 +115,7 @@ void FileAPIMessageFilter::OnChannelClosing() {
for (std::multiset<GURL>::const_iterator iter =
open_filesystem_urls_.begin();
iter != open_filesystem_urls_.end(); ++iter) {
- FileSystemURL url(*iter);
+ FileSystemURL url(context_->CrackURL(*iter));
FileSystemOperation* operation = context_->CreateFileSystemOperation(
url, NULL);
if (operation)
@@ -207,8 +207,8 @@ void FileAPIMessageFilter::OnMove(
int request_id, const GURL& src_path, const GURL& dest_path) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
base::PlatformFileError error;
- FileSystemURL src_url(src_path);
- FileSystemURL dest_url(dest_path);
+ FileSystemURL src_url(context_->CrackURL(src_path));
+ FileSystemURL dest_url(context_->CrackURL(dest_path));
const int src_permissions =
fileapi::kReadFilePermissions | fileapi::kWriteFilePermissions;
if (!HasPermissionsForFile(src_url, src_permissions, &error) ||
@@ -230,8 +230,8 @@ void FileAPIMessageFilter::OnCopy(
int request_id, const GURL& src_path, const GURL& dest_path) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
base::PlatformFileError error;
- FileSystemURL src_url(src_path);
- FileSystemURL dest_url(dest_path);
+ FileSystemURL src_url(context_->CrackURL(src_path));
+ FileSystemURL dest_url(context_->CrackURL(dest_path));
if (!HasPermissionsForFile(src_url, fileapi::kReadFilePermissions, &error) ||
!HasPermissionsForFile(
dest_url, fileapi::kCreateFilePermissions, &error)) {
@@ -251,7 +251,7 @@ void FileAPIMessageFilter::OnRemove(
int request_id, const GURL& path, bool recursive) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
base::PlatformFileError error;
- FileSystemURL url(path);
+ FileSystemURL url(context_->CrackURL(path));
if (!HasPermissionsForFile(url, fileapi::kWriteFilePermissions, &error)) {
Send(new FileSystemMsg_DidFail(request_id, error));
return;
@@ -269,7 +269,7 @@ void FileAPIMessageFilter::OnReadMetadata(
int request_id, const GURL& path) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
base::PlatformFileError error;
- FileSystemURL url(path);
+ FileSystemURL url(context_->CrackURL(path));
if (!HasPermissionsForFile(url, fileapi::kReadFilePermissions, &error)) {
Send(new FileSystemMsg_DidFail(request_id, error));
return;
@@ -288,7 +288,7 @@ void FileAPIMessageFilter::OnCreate(
bool is_directory, bool recursive) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
base::PlatformFileError error;
- FileSystemURL url(path);
+ FileSystemURL url(context_->CrackURL(path));
if (!HasPermissionsForFile(url, fileapi::kCreateFilePermissions, &error)) {
Send(new FileSystemMsg_DidFail(request_id, error));
return;
@@ -312,7 +312,7 @@ void FileAPIMessageFilter::OnExists(
int request_id, const GURL& path, bool is_directory) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
base::PlatformFileError error;
- FileSystemURL url(path);
+ FileSystemURL url(context_->CrackURL(path));
if (!HasPermissionsForFile(url, fileapi::kReadFilePermissions, &error)) {
Send(new FileSystemMsg_DidFail(request_id, error));
return;
@@ -336,7 +336,7 @@ void FileAPIMessageFilter::OnReadDirectory(
int request_id, const GURL& path) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
base::PlatformFileError error;
- FileSystemURL url(path);
+ FileSystemURL url(context_->CrackURL(path));
if (!HasPermissionsForFile(url, fileapi::kReadFilePermissions, &error)) {
Send(new FileSystemMsg_DidFail(request_id, error));
return;
@@ -362,7 +362,7 @@ void FileAPIMessageFilter::OnWrite(
return;
}
- FileSystemURL url(path);
+ FileSystemURL url(context_->CrackURL(path));
base::PlatformFileError error;
if (!HasPermissionsForFile(url, fileapi::kWriteFilePermissions, &error)) {
Send(new FileSystemMsg_DidFail(request_id, error));
@@ -382,7 +382,7 @@ void FileAPIMessageFilter::OnTruncate(
const GURL& path,
int64 length) {
base::PlatformFileError error;
- FileSystemURL url(path);
+ FileSystemURL url(context_->CrackURL(path));
if (!HasPermissionsForFile(url, fileapi::kWriteFilePermissions, &error)) {
Send(new FileSystemMsg_DidFail(request_id, error));
return;
@@ -402,7 +402,7 @@ void FileAPIMessageFilter::OnTouchFile(
const base::Time& last_access_time,
const base::Time& last_modified_time) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
- FileSystemURL url(path);
+ FileSystemURL url(context_->CrackURL(path));
base::PlatformFileError error;
if (!HasPermissionsForFile(url, fileapi::kCreateFilePermissions, &error)) {
Send(new FileSystemMsg_DidFail(request_id, error));
@@ -440,7 +440,7 @@ void FileAPIMessageFilter::OnOpenFile(
base::PlatformFileError error;
const int open_permissions = base::PLATFORM_FILE_OPEN |
(file_flags & fileapi::kOpenFilePermissions);
- FileSystemURL url(path);
+ FileSystemURL url(context_->CrackURL(path));
if (!HasPermissionsForFile(url, open_permissions, &error)) {
Send(new FileSystemMsg_DidFail(request_id, error));
return;
@@ -463,7 +463,7 @@ void FileAPIMessageFilter::OnNotifyCloseFile(const GURL& path) {
DCHECK(iter != open_filesystem_urls_.end());
open_filesystem_urls_.erase(iter);
- FileSystemURL url(path);
+ FileSystemURL url(context_->CrackURL(path));
// Do not use GetNewOperation() here, because NotifyCloseFile is a one-way
// operation that does not have request_id by which we respond back.
@@ -475,7 +475,7 @@ void FileAPIMessageFilter::OnNotifyCloseFile(const GURL& path) {
void FileAPIMessageFilter::OnWillUpdate(const GURL& path) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
- FileSystemURL url(path);
+ FileSystemURL url(context_->CrackURL(path));
if (!url.is_valid())
return;
const UpdateObserverList* observers =
@@ -487,7 +487,7 @@ void FileAPIMessageFilter::OnWillUpdate(const GURL& path) {
void FileAPIMessageFilter::OnDidUpdate(const GURL& path, int64 delta) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
- FileSystemURL url(path);
+ FileSystemURL url(context_->CrackURL(path));
if (!url.is_valid())
return;
const UpdateObserverList* observers =
@@ -503,7 +503,7 @@ void FileAPIMessageFilter::OnSyncGetPlatformPath(
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
DCHECK(platform_path);
*platform_path = FilePath();
- FileSystemURL url(path);
+ FileSystemURL url(context_->CrackURL(path));
if (!url.is_valid())
return;
@@ -541,7 +541,7 @@ void FileAPIMessageFilter::OnSyncGetPlatformPath(
void FileAPIMessageFilter::OnCreateSnapshotFile(
int request_id, const GURL& blob_url, const GURL& path) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
- FileSystemURL url(path);
+ FileSystemURL url(context_->CrackURL(path));
base::Callback<void(const FilePath&)> register_file_callback =
base::Bind(&FileAPIMessageFilter::RegisterFileAsBlob,
this, blob_url, url);

Powered by Google App Engine
This is Rietveld 408576698