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

Side by Side Diff: webkit/browser/fileapi/file_system_context.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 unified diff | Download patch | Annotate | Revision Log
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 "webkit/browser/fileapi/file_system_context.h" 5 #include "webkit/browser/fileapi/file_system_context.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/single_thread_task_runner.h" 8 #include "base/single_thread_task_runner.h"
9 #include "base/stl_util.h" 9 #include "base/stl_util.h"
10 #include "base/task_runner_util.h" 10 #include "base/task_runner_util.h"
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 file_task_runner, 113 file_task_runner,
114 partition_path, 114 partition_path,
115 special_storage_policy, 115 special_storage_policy,
116 options)), 116 options)),
117 sandbox_backend_(new SandboxFileSystemBackend( 117 sandbox_backend_(new SandboxFileSystemBackend(
118 sandbox_delegate_.get())), 118 sandbox_delegate_.get())),
119 isolated_backend_(new IsolatedFileSystemBackend()), 119 isolated_backend_(new IsolatedFileSystemBackend()),
120 additional_backends_(additional_backends.Pass()), 120 additional_backends_(additional_backends.Pass()),
121 external_mount_points_(external_mount_points), 121 external_mount_points_(external_mount_points),
122 partition_path_(partition_path), 122 partition_path_(partition_path),
123 is_incognito_(options.is_incognito()),
123 operation_runner_(new FileSystemOperationRunner(this)) { 124 operation_runner_(new FileSystemOperationRunner(this)) {
124 RegisterBackend(sandbox_backend_.get()); 125 RegisterBackend(sandbox_backend_.get());
125 RegisterBackend(isolated_backend_.get()); 126 RegisterBackend(isolated_backend_.get());
126 127
127 for (ScopedVector<FileSystemBackend>::const_iterator iter = 128 for (ScopedVector<FileSystemBackend>::const_iterator iter =
128 additional_backends_.begin(); 129 additional_backends_.begin();
129 iter != additional_backends_.end(); ++iter) { 130 iter != additional_backends_.end(); ++iter) {
130 RegisterBackend(*iter); 131 RegisterBackend(*iter);
131 } 132 }
132 133
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
342 const base::FilePath& path) const { 343 const base::FilePath& path) const {
343 return CrackFileSystemURL(FileSystemURL(origin, type, path)); 344 return CrackFileSystemURL(FileSystemURL(origin, type, path));
344 } 345 }
345 346
346 #if defined(OS_CHROMEOS) && defined(GOOGLE_CHROME_BUILD) 347 #if defined(OS_CHROMEOS) && defined(GOOGLE_CHROME_BUILD)
347 void FileSystemContext::EnableTemporaryFileSystemInIncognito() { 348 void FileSystemContext::EnableTemporaryFileSystemInIncognito() {
348 sandbox_backend_->set_enable_temporary_file_system_in_incognito(true); 349 sandbox_backend_->set_enable_temporary_file_system_in_incognito(true);
349 } 350 }
350 #endif 351 #endif
351 352
353 bool FileSystemContext::CanServeURLRequest(const FileSystemURL& url) const {
354 if (!is_incognito_)
355 return true;
356 #if defined(OS_CHROMEOS) && defined(GOOGLE_CHROME_BUILD)
357 if (url.type() == kFileSystemTypeTemporary &&
358 sandbox_backend_->enable_temporary_file_system_in_incognito()) {
359 return true;
360 }
361 #endif
362 return false;
363 }
364
352 FileSystemContext::~FileSystemContext() { 365 FileSystemContext::~FileSystemContext() {
353 } 366 }
354 367
355 void FileSystemContext::DeleteOnCorrectThread() const { 368 void FileSystemContext::DeleteOnCorrectThread() const {
356 if (!io_task_runner_->RunsTasksOnCurrentThread() && 369 if (!io_task_runner_->RunsTasksOnCurrentThread() &&
357 io_task_runner_->DeleteSoon(FROM_HERE, this)) { 370 io_task_runner_->DeleteSoon(FROM_HERE, this)) {
358 return; 371 return;
359 } 372 }
360 delete this; 373 delete this;
361 } 374 }
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
433 FileSystemType type = static_cast<FileSystemType>(t); 446 FileSystemType type = static_cast<FileSystemType>(t);
434 if (backend->CanHandleType(type)) { 447 if (backend->CanHandleType(type)) {
435 const bool inserted = backend_map_.insert( 448 const bool inserted = backend_map_.insert(
436 std::make_pair(type, backend)).second; 449 std::make_pair(type, backend)).second;
437 DCHECK(inserted); 450 DCHECK(inserted);
438 } 451 }
439 } 452 }
440 } 453 }
441 454
442 } // namespace fileapi 455 } // namespace fileapi
OLDNEW
« no previous file with comments | « webkit/browser/fileapi/file_system_context.h ('k') | webkit/browser/fileapi/file_system_dir_url_request_job.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698