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

Unified Diff: webkit/browser/fileapi/file_system_dir_url_request_job.cc

Issue 23494028: Do not return FileSystem contents if the profile is in incognito mode. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 3 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: webkit/browser/fileapi/file_system_dir_url_request_job.cc
diff --git a/webkit/browser/fileapi/file_system_dir_url_request_job.cc b/webkit/browser/fileapi/file_system_dir_url_request_job.cc
index b91c7d00d9db77b82ab2e98b54ec3ceff6718591..721a228b94eae9478696afef14654f5a63c2c9aa 100644
--- a/webkit/browser/fileapi/file_system_dir_url_request_job.cc
+++ b/webkit/browser/fileapi/file_system_dir_url_request_job.cc
@@ -23,6 +23,7 @@
#include "webkit/browser/fileapi/file_system_operation_runner.h"
#include "webkit/browser/fileapi/file_system_url.h"
#include "webkit/common/fileapi/directory_entry.h"
+#include "webkit/common/fileapi/file_system_util.h"
using net::NetworkDelegate;
using net::URLRequest;
@@ -80,6 +81,19 @@ void FileSystemDirURLRequestJob::StartAsync() {
if (!request_)
return;
url_ = file_system_context_->CrackURL(request_->url());
+ if (!file_system_context_->CanServeURLRequest(url_)) {
+ // In incognito mode the API is not usable and there should be no data.
+ if (url_.is_valid() && VirtualPath::IsRootPath(url_.virtual_path())) {
+ // Return an empty directory if the filesystem root is queried.
+ DidReadDirectory(base::PLATFORM_FILE_OK,
+ std::vector<DirectoryEntry>(),
+ false);
+ return;
+ }
+ NotifyDone(URLRequestStatus(URLRequestStatus::FAILED,
+ net::ERR_FILE_NOT_FOUND));
+ return;
+ }
file_system_context_->operation_runner()->ReadDirectory(
url_,
base::Bind(&FileSystemDirURLRequestJob::DidReadDirectory, this));
« no previous file with comments | « webkit/browser/fileapi/file_system_context.cc ('k') | webkit/browser/fileapi/file_system_dir_url_request_job_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698