| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/fileapi/file_system_context.h" | 5 #include "webkit/fileapi/file_system_context.h" |
| 6 | 6 |
| 7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
| 8 #include "base/message_loop_proxy.h" | 8 #include "base/message_loop_proxy.h" |
| 9 #include "googleurl/src/gurl.h" | 9 #include "googleurl/src/gurl.h" |
| 10 #include "webkit/fileapi/file_system_path_manager.h" | 10 #include "webkit/fileapi/file_system_path_manager.h" |
| 11 #include "webkit/fileapi/file_system_usage_tracker.h" | 11 #include "webkit/fileapi/file_system_usage_tracker.h" |
| 12 #include "webkit/fileapi/sandbox_mount_point_provider.h" | 12 #include "webkit/fileapi/sandbox_mount_point_provider.h" |
| 13 | 13 |
| 14 namespace fileapi { | 14 namespace fileapi { |
| 15 | 15 |
| 16 FileSystemContext::FileSystemContext( | 16 FileSystemContext::FileSystemContext( |
| 17 scoped_refptr<base::MessageLoopProxy> file_message_loop, | 17 scoped_refptr<base::MessageLoopProxy> file_message_loop, |
| 18 scoped_refptr<base::MessageLoopProxy> io_message_loop, | 18 scoped_refptr<base::MessageLoopProxy> io_message_loop, |
| 19 scoped_refptr<quota::SpecialStoragePolicy> special_storage_policy, | 19 scoped_refptr<quota::SpecialStoragePolicy> special_storage_policy, |
| 20 const FilePath& profile_path, | 20 const FilePath& profile_path, |
| 21 bool is_incognito, | 21 bool is_incognito, |
| 22 bool allow_file_access, | 22 bool allow_file_access, |
| 23 bool unlimited_quota) | 23 bool unlimited_quota, |
| 24 FileSystemPathManager* path_manager) |
| 24 : file_message_loop_(file_message_loop), | 25 : file_message_loop_(file_message_loop), |
| 25 io_message_loop_(io_message_loop), | 26 io_message_loop_(io_message_loop), |
| 26 special_storage_policy_(special_storage_policy), | 27 special_storage_policy_(special_storage_policy), |
| 27 allow_file_access_from_files_(allow_file_access), | 28 allow_file_access_from_files_(allow_file_access), |
| 28 unlimited_quota_(unlimited_quota), | 29 unlimited_quota_(unlimited_quota), |
| 29 path_manager_(new FileSystemPathManager( | 30 path_manager_(path_manager), |
| 30 file_message_loop, profile_path, special_storage_policy, is_incognito, | |
| 31 allow_file_access)), | |
| 32 usage_tracker_(new FileSystemUsageTracker( | 31 usage_tracker_(new FileSystemUsageTracker( |
| 33 file_message_loop, profile_path, is_incognito)) { | 32 file_message_loop, profile_path, is_incognito)) { |
| 33 if (!path_manager) { |
| 34 path_manager_.reset(new FileSystemPathManager( |
| 35 file_message_loop, profile_path, special_storage_policy, |
| 36 is_incognito, allow_file_access)); |
| 37 } |
| 34 } | 38 } |
| 35 | 39 |
| 36 FileSystemContext::~FileSystemContext() { | 40 FileSystemContext::~FileSystemContext() { |
| 37 } | 41 } |
| 38 | 42 |
| 39 bool FileSystemContext::IsStorageUnlimited(const GURL& origin) { | 43 bool FileSystemContext::IsStorageUnlimited(const GURL& origin) { |
| 40 // If allow-file-access-from-files flag is explicitly given and the scheme | 44 // If allow-file-access-from-files flag is explicitly given and the scheme |
| 41 // is file, or if unlimited quota for this process was explicitly requested, | 45 // is file, or if unlimited quota for this process was explicitly requested, |
| 42 // return true. | 46 // return true. |
| 43 return unlimited_quota_ || | 47 return unlimited_quota_ || |
| (...skipping 21 matching lines...) Expand all Loading... |
| 65 return; | 69 return; |
| 66 } | 70 } |
| 67 delete this; | 71 delete this; |
| 68 } | 72 } |
| 69 | 73 |
| 70 SandboxMountPointProvider* FileSystemContext::sandbox_provider() const { | 74 SandboxMountPointProvider* FileSystemContext::sandbox_provider() const { |
| 71 return path_manager_->sandbox_provider(); | 75 return path_manager_->sandbox_provider(); |
| 72 } | 76 } |
| 73 | 77 |
| 74 } // namespace fileapi | 78 } // namespace fileapi |
| OLD | NEW |