| 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 "webkit/fileapi/file_system_file_util_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" |
| 11 #include "webkit/fileapi/file_system_usage_tracker.h" | 12 #include "webkit/fileapi/file_system_usage_tracker.h" |
| 13 #include "webkit/fileapi/obfuscated_file_util.h" |
| 12 | 14 |
| 13 namespace fileapi { | 15 namespace fileapi { |
| 14 | 16 |
| 15 FileSystemContext::FileSystemContext( | 17 FileSystemContext::FileSystemContext( |
| 16 scoped_refptr<base::MessageLoopProxy> file_message_loop, | 18 scoped_refptr<base::MessageLoopProxy> file_message_loop, |
| 17 scoped_refptr<base::MessageLoopProxy> io_message_loop, | 19 scoped_refptr<base::MessageLoopProxy> io_message_loop, |
| 18 const FilePath& profile_path, | 20 const FilePath& profile_path, |
| 19 bool is_incognito, | 21 bool is_incognito, |
| 20 bool allow_file_access, | 22 bool allow_file_access, |
| 21 bool unlimited_quota) | 23 bool unlimited_quota, |
| 24 bool obfuscate) |
| 22 : file_message_loop_(file_message_loop), | 25 : file_message_loop_(file_message_loop), |
| 23 io_message_loop_(io_message_loop), | 26 io_message_loop_(io_message_loop), |
| 24 path_manager_(new FileSystemPathManager( | 27 path_manager_(new FileSystemPathManager( |
| 25 file_message_loop, profile_path, is_incognito, allow_file_access)), | 28 file_message_loop, profile_path, is_incognito, allow_file_access)), |
| 26 quota_manager_(new FileSystemQuotaManager( | 29 quota_manager_(new FileSystemQuotaManager( |
| 27 allow_file_access, unlimited_quota)), | 30 allow_file_access, unlimited_quota)), |
| 28 usage_tracker_(new FileSystemUsageTracker( | 31 usage_tracker_(new FileSystemUsageTracker( |
| 29 file_message_loop, profile_path, is_incognito)) { | 32 file_message_loop, profile_path, is_incognito)) { |
| 33 if (obfuscate) |
| 34 file_system_file_util_ = ObfuscatedFileUtil::GetInstance(); |
| 35 else |
| 36 file_system_file_util_ = FileSystemFileUtil::GetInstance(); |
| 30 } | 37 } |
| 31 | 38 |
| 32 FileSystemContext::~FileSystemContext() { | 39 FileSystemContext::~FileSystemContext() { |
| 33 } | 40 } |
| 34 | 41 |
| 35 void FileSystemContext::DeleteDataForOriginOnFileThread( | 42 void FileSystemContext::DeleteDataForOriginOnFileThread( |
| 36 const GURL& origin_url) { | 43 const GURL& origin_url) { |
| 37 DCHECK(path_manager_.get()); | 44 DCHECK(path_manager_.get()); |
| 38 DCHECK(file_message_loop_->BelongsToCurrentThread()); | 45 DCHECK(file_message_loop_->BelongsToCurrentThread()); |
| 39 | 46 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 57 | 64 |
| 58 void FileSystemContext::DeleteOnCorrectThread() const { | 65 void FileSystemContext::DeleteOnCorrectThread() const { |
| 59 if (!io_message_loop_->BelongsToCurrentThread()) { | 66 if (!io_message_loop_->BelongsToCurrentThread()) { |
| 60 io_message_loop_->DeleteSoon(FROM_HERE, this); | 67 io_message_loop_->DeleteSoon(FROM_HERE, this); |
| 61 return; | 68 return; |
| 62 } | 69 } |
| 63 delete this; | 70 delete this; |
| 64 } | 71 } |
| 65 | 72 |
| 66 } // namespace fileapi | 73 } // namespace fileapi |
| OLD | NEW |