| 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/sandboxed_file_system_context.h" | 5 #include "webkit/fileapi/sandboxed_file_system_context.h" |
| 6 | 6 |
| 7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
| 8 #include "base/file_util_proxy.h" |
| 8 #include "base/message_loop_proxy.h" | 9 #include "base/message_loop_proxy.h" |
| 9 #include "webkit/fileapi/file_system_path_manager.h" | 10 #include "webkit/fileapi/file_system_path_manager.h" |
| 10 #include "webkit/fileapi/file_system_quota_manager.h" | 11 #include "webkit/fileapi/file_system_quota_manager.h" |
| 12 #include "webkit/fileapi/obfuscated_file_util_proxy.h" |
| 11 | 13 |
| 12 namespace fileapi { | 14 namespace fileapi { |
| 13 | 15 |
| 14 SandboxedFileSystemContext::SandboxedFileSystemContext( | 16 SandboxedFileSystemContext::SandboxedFileSystemContext( |
| 15 scoped_refptr<base::MessageLoopProxy> file_message_loop, | 17 scoped_refptr<base::MessageLoopProxy> file_message_loop, |
| 16 scoped_refptr<base::MessageLoopProxy> io_message_loop, | 18 scoped_refptr<base::MessageLoopProxy> io_message_loop, |
| 17 const FilePath& profile_path, | 19 const FilePath& profile_path, |
| 18 bool is_incognito, | 20 bool is_incognito, |
| 19 bool allow_file_access, | 21 bool allow_file_access, |
| 20 bool unlimited_quota) | 22 bool unlimited_quota, |
| 23 bool obfuscate) |
| 21 : file_message_loop_(file_message_loop), | 24 : file_message_loop_(file_message_loop), |
| 22 io_message_loop_(io_message_loop), | 25 io_message_loop_(io_message_loop), |
| 23 path_manager_(new FileSystemPathManager( | 26 path_manager_(new FileSystemPathManager( |
| 24 file_message_loop, profile_path, is_incognito, allow_file_access)), | 27 file_message_loop, profile_path, is_incognito, allow_file_access)), |
| 25 quota_manager_(new FileSystemQuotaManager( | 28 quota_manager_(new FileSystemQuotaManager( |
| 26 allow_file_access, unlimited_quota)) { | 29 allow_file_access, unlimited_quota)) { |
| 30 if (obfuscate) { |
| 31 delete_file_util_proxy_ = true; |
| 32 file_util_proxy_ = new ObfuscatedFileUtilProxy(this); |
| 33 } else { |
| 34 delete_file_util_proxy_ = false; |
| 35 file_util_proxy_ = base::FileUtilProxy::GetInstance(); |
| 36 } |
| 27 } | 37 } |
| 28 | 38 |
| 29 SandboxedFileSystemContext::~SandboxedFileSystemContext() { | 39 SandboxedFileSystemContext::~SandboxedFileSystemContext() { |
| 40 if (delete_file_util_proxy_) |
| 41 delete file_util_proxy_; |
| 30 } | 42 } |
| 31 | 43 |
| 32 void SandboxedFileSystemContext::Shutdown() { | 44 void SandboxedFileSystemContext::Shutdown() { |
| 33 DCHECK(io_message_loop_->BelongsToCurrentThread()); | 45 DCHECK(io_message_loop_->BelongsToCurrentThread()); |
| 34 path_manager_.reset(); | 46 path_manager_.reset(); |
| 35 quota_manager_.reset(); | 47 quota_manager_.reset(); |
| 36 } | 48 } |
| 37 | 49 |
| 38 void SandboxedFileSystemContext::DeleteDataForOriginOnFileThread( | 50 void SandboxedFileSystemContext::DeleteDataForOriginOnFileThread( |
| 39 const GURL& origin_url) { | 51 const GURL& origin_url) { |
| (...skipping 20 matching lines...) Expand all Loading... |
| 60 | 72 |
| 61 void SandboxedFileSystemContext::DeleteOnCorrectThread() const { | 73 void SandboxedFileSystemContext::DeleteOnCorrectThread() const { |
| 62 if (!io_message_loop_->BelongsToCurrentThread()) { | 74 if (!io_message_loop_->BelongsToCurrentThread()) { |
| 63 io_message_loop_->DeleteSoon(FROM_HERE, this); | 75 io_message_loop_->DeleteSoon(FROM_HERE, this); |
| 64 return; | 76 return; |
| 65 } | 77 } |
| 66 delete this; | 78 delete this; |
| 67 } | 79 } |
| 68 | 80 |
| 69 } // namespace fileapi | 81 } // namespace fileapi |
| OLD | NEW |