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

Side by Side Diff: webkit/browser/fileapi/file_system_context.cc

Issue 492873002: Collapse fileapi, webkit_blob, webkit_database, quota, and webkit_common namespaces into single sto… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix chromeos build Created 6 years, 4 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 13 matching lines...) Expand all
24 #include "webkit/browser/fileapi/isolated_context.h" 24 #include "webkit/browser/fileapi/isolated_context.h"
25 #include "webkit/browser/fileapi/isolated_file_system_backend.h" 25 #include "webkit/browser/fileapi/isolated_file_system_backend.h"
26 #include "webkit/browser/fileapi/mount_points.h" 26 #include "webkit/browser/fileapi/mount_points.h"
27 #include "webkit/browser/fileapi/quota/quota_reservation.h" 27 #include "webkit/browser/fileapi/quota/quota_reservation.h"
28 #include "webkit/browser/fileapi/sandbox_file_system_backend.h" 28 #include "webkit/browser/fileapi/sandbox_file_system_backend.h"
29 #include "webkit/browser/quota/quota_manager_proxy.h" 29 #include "webkit/browser/quota/quota_manager_proxy.h"
30 #include "webkit/browser/quota/special_storage_policy.h" 30 #include "webkit/browser/quota/special_storage_policy.h"
31 #include "webkit/common/fileapi/file_system_info.h" 31 #include "webkit/common/fileapi/file_system_info.h"
32 #include "webkit/common/fileapi/file_system_util.h" 32 #include "webkit/common/fileapi/file_system_util.h"
33 33
34 using quota::QuotaClient; 34 using storage::QuotaClient;
35 35
36 namespace fileapi { 36 namespace storage {
37 37
38 namespace { 38 namespace {
39 39
40 QuotaClient* CreateQuotaClient( 40 QuotaClient* CreateQuotaClient(
41 FileSystemContext* context, 41 FileSystemContext* context,
42 bool is_incognito) { 42 bool is_incognito) {
43 return new FileSystemQuotaClient(context, is_incognito); 43 return new FileSystemQuotaClient(context, is_incognito);
44 } 44 }
45 45
46 46
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 return FILE_PERMISSION_ALWAYS_DENY; 127 return FILE_PERMISSION_ALWAYS_DENY;
128 } 128 }
129 NOTREACHED(); 129 NOTREACHED();
130 return FILE_PERMISSION_ALWAYS_DENY; 130 return FILE_PERMISSION_ALWAYS_DENY;
131 } 131 }
132 132
133 FileSystemContext::FileSystemContext( 133 FileSystemContext::FileSystemContext(
134 base::SingleThreadTaskRunner* io_task_runner, 134 base::SingleThreadTaskRunner* io_task_runner,
135 base::SequencedTaskRunner* file_task_runner, 135 base::SequencedTaskRunner* file_task_runner,
136 ExternalMountPoints* external_mount_points, 136 ExternalMountPoints* external_mount_points,
137 quota::SpecialStoragePolicy* special_storage_policy, 137 storage::SpecialStoragePolicy* special_storage_policy,
138 quota::QuotaManagerProxy* quota_manager_proxy, 138 storage::QuotaManagerProxy* quota_manager_proxy,
139 ScopedVector<FileSystemBackend> additional_backends, 139 ScopedVector<FileSystemBackend> additional_backends,
140 const std::vector<URLRequestAutoMountHandler>& auto_mount_handlers, 140 const std::vector<URLRequestAutoMountHandler>& auto_mount_handlers,
141 const base::FilePath& partition_path, 141 const base::FilePath& partition_path,
142 const FileSystemOptions& options) 142 const FileSystemOptions& options)
143 : io_task_runner_(io_task_runner), 143 : io_task_runner_(io_task_runner),
144 default_file_task_runner_(file_task_runner), 144 default_file_task_runner_(file_task_runner),
145 quota_manager_proxy_(quota_manager_proxy), 145 quota_manager_proxy_(quota_manager_proxy),
146 sandbox_delegate_(new SandboxFileSystemBackendDelegate( 146 sandbox_delegate_(
147 quota_manager_proxy, 147 new SandboxFileSystemBackendDelegate(quota_manager_proxy,
148 file_task_runner, 148 file_task_runner,
149 partition_path, 149 partition_path,
150 special_storage_policy, 150 special_storage_policy,
151 options)), 151 options)),
152 sandbox_backend_(new SandboxFileSystemBackend( 152 sandbox_backend_(new SandboxFileSystemBackend(sandbox_delegate_.get())),
153 sandbox_delegate_.get())),
154 isolated_backend_(new IsolatedFileSystemBackend()), 153 isolated_backend_(new IsolatedFileSystemBackend()),
155 plugin_private_backend_(new PluginPrivateFileSystemBackend( 154 plugin_private_backend_(
156 file_task_runner, 155 new PluginPrivateFileSystemBackend(file_task_runner,
157 partition_path, 156 partition_path,
158 special_storage_policy, 157 special_storage_policy,
159 options)), 158 options)),
160 additional_backends_(additional_backends.Pass()), 159 additional_backends_(additional_backends.Pass()),
161 auto_mount_handlers_(auto_mount_handlers), 160 auto_mount_handlers_(auto_mount_handlers),
162 external_mount_points_(external_mount_points), 161 external_mount_points_(external_mount_points),
163 partition_path_(partition_path), 162 partition_path_(partition_path),
164 is_incognito_(options.is_incognito()), 163 is_incognito_(options.is_incognito()),
165 operation_runner_(new FileSystemOperationRunner(this)) { 164 operation_runner_(new FileSystemOperationRunner(this)) {
166 RegisterBackend(sandbox_backend_.get()); 165 RegisterBackend(sandbox_backend_.get());
167 RegisterBackend(isolated_backend_.get()); 166 RegisterBackend(isolated_backend_.get());
168 RegisterBackend(plugin_private_backend_.get()); 167 RegisterBackend(plugin_private_backend_.get());
169 168
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
412 // It is safe to pass Unretained(quota_util) since context owns it. 411 // It is safe to pass Unretained(quota_util) since context owns it.
413 base::Bind(&FileSystemQuotaUtil::DeleteOriginDataOnFileTaskRunner, 412 base::Bind(&FileSystemQuotaUtil::DeleteOriginDataOnFileTaskRunner,
414 base::Unretained(backend->GetQuotaUtil()), 413 base::Unretained(backend->GetQuotaUtil()),
415 make_scoped_refptr(this), 414 make_scoped_refptr(this),
416 base::Unretained(quota_manager_proxy()), 415 base::Unretained(quota_manager_proxy()),
417 origin_url, 416 origin_url,
418 type), 417 type),
419 callback); 418 callback);
420 } 419 }
421 420
422 scoped_ptr<webkit_blob::FileStreamReader> 421 scoped_ptr<storage::FileStreamReader> FileSystemContext::CreateFileStreamReader(
423 FileSystemContext::CreateFileStreamReader(
424 const FileSystemURL& url, 422 const FileSystemURL& url,
425 int64 offset, 423 int64 offset,
426 const base::Time& expected_modification_time) { 424 const base::Time& expected_modification_time) {
427 if (!url.is_valid()) 425 if (!url.is_valid())
428 return scoped_ptr<webkit_blob::FileStreamReader>(); 426 return scoped_ptr<storage::FileStreamReader>();
429 FileSystemBackend* backend = GetFileSystemBackend(url.type()); 427 FileSystemBackend* backend = GetFileSystemBackend(url.type());
430 if (!backend) 428 if (!backend)
431 return scoped_ptr<webkit_blob::FileStreamReader>(); 429 return scoped_ptr<storage::FileStreamReader>();
432 return backend->CreateFileStreamReader( 430 return backend->CreateFileStreamReader(
433 url, offset, expected_modification_time, this); 431 url, offset, expected_modification_time, this);
434 } 432 }
435 433
436 scoped_ptr<FileStreamWriter> FileSystemContext::CreateFileStreamWriter( 434 scoped_ptr<FileStreamWriter> FileSystemContext::CreateFileStreamWriter(
437 const FileSystemURL& url, 435 const FileSystemURL& url,
438 int64 offset) { 436 int64 offset) {
439 if (!url.is_valid()) 437 if (!url.is_valid())
440 return scoped_ptr<FileStreamWriter>(); 438 return scoped_ptr<FileStreamWriter>();
441 FileSystemBackend* backend = GetFileSystemBackend(url.type()); 439 FileSystemBackend* backend = GetFileSystemBackend(url.type());
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
601 const std::string& filesystem_name, 599 const std::string& filesystem_name,
602 base::File::Error error) { 600 base::File::Error error) {
603 DCHECK(io_task_runner_->RunsTasksOnCurrentThread()); 601 DCHECK(io_task_runner_->RunsTasksOnCurrentThread());
604 602
605 if (error != base::File::FILE_OK) { 603 if (error != base::File::FILE_OK) {
606 callback.Run(error, FileSystemInfo(), base::FilePath(), 604 callback.Run(error, FileSystemInfo(), base::FilePath(),
607 FileSystemContext::RESOLVED_ENTRY_NOT_FOUND); 605 FileSystemContext::RESOLVED_ENTRY_NOT_FOUND);
608 return; 606 return;
609 } 607 }
610 608
611 fileapi::FileSystemInfo info( 609 storage::FileSystemInfo info(
612 filesystem_name, filesystem_root, url.mount_type()); 610 filesystem_name, filesystem_root, url.mount_type());
613 611
614 // Extract the virtual path not containing a filesystem type part from |url|. 612 // Extract the virtual path not containing a filesystem type part from |url|.
615 base::FilePath parent = CrackURL(filesystem_root).virtual_path(); 613 base::FilePath parent = CrackURL(filesystem_root).virtual_path();
616 base::FilePath child = url.virtual_path(); 614 base::FilePath child = url.virtual_path();
617 base::FilePath path; 615 base::FilePath path;
618 616
619 if (parent.empty()) { 617 if (parent.empty()) {
620 path = child; 618 path = child;
621 } else if (parent != child) { 619 } else if (parent != child) {
622 bool result = parent.AppendRelativePath(child, &path); 620 bool result = parent.AppendRelativePath(child, &path);
623 DCHECK(result); 621 DCHECK(result);
624 } 622 }
625 623
626 operation_runner()->GetMetadata( 624 operation_runner()->GetMetadata(
627 url, base::Bind(&DidGetMetadataForResolveURL, path, callback, info)); 625 url, base::Bind(&DidGetMetadataForResolveURL, path, callback, info));
628 } 626 }
629 627
630 } // namespace fileapi 628 } // namespace storage
OLDNEW
« no previous file with comments | « webkit/browser/fileapi/file_system_context.h ('k') | webkit/browser/fileapi/file_system_dir_url_request_job.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698