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 | 13 |
13 namespace fileapi { | 14 namespace fileapi { |
14 | 15 |
15 FileSystemContext::FileSystemContext( | 16 FileSystemContext::FileSystemContext( |
16 scoped_refptr<base::MessageLoopProxy> file_message_loop, | 17 scoped_refptr<base::MessageLoopProxy> file_message_loop, |
17 scoped_refptr<base::MessageLoopProxy> io_message_loop, | 18 scoped_refptr<base::MessageLoopProxy> io_message_loop, |
18 scoped_refptr<quota::SpecialStoragePolicy> special_storage_policy, | 19 scoped_refptr<quota::SpecialStoragePolicy> special_storage_policy, |
19 const FilePath& profile_path, | 20 const FilePath& profile_path, |
20 bool is_incognito, | 21 bool is_incognito, |
21 bool allow_file_access, | 22 bool allow_file_access, |
(...skipping 21 matching lines...) Expand all Loading... |
43 (special_storage_policy_.get() && | 44 (special_storage_policy_.get() && |
44 special_storage_policy_->IsStorageUnlimited(origin)); | 45 special_storage_policy_->IsStorageUnlimited(origin)); |
45 } | 46 } |
46 | 47 |
47 void FileSystemContext::DeleteDataForOriginOnFileThread( | 48 void FileSystemContext::DeleteDataForOriginOnFileThread( |
48 const GURL& origin_url) { | 49 const GURL& origin_url) { |
49 DCHECK(path_manager_.get()); | 50 DCHECK(path_manager_.get()); |
50 DCHECK(file_message_loop_->BelongsToCurrentThread()); | 51 DCHECK(file_message_loop_->BelongsToCurrentThread()); |
51 | 52 |
52 std::string origin_identifier = | 53 std::string origin_identifier = |
53 FileSystemPathManager::GetOriginIdentifierFromURL(origin_url); | 54 SandboxMountPointProvider::GetOriginIdentifierFromURL(origin_url); |
54 FilePath path_for_origin = path_manager_->base_path().AppendASCII( | 55 FilePath path_for_origin = sandbox_provider()->base_path().AppendASCII( |
55 origin_identifier); | 56 origin_identifier); |
56 | 57 |
57 file_util::Delete(path_for_origin, true /* recursive */); | 58 file_util::Delete(path_for_origin, true /* recursive */); |
58 } | 59 } |
59 | 60 |
60 void FileSystemContext::DeleteOnCorrectThread() const { | 61 void FileSystemContext::DeleteOnCorrectThread() const { |
61 if (!io_message_loop_->BelongsToCurrentThread()) { | 62 if (!io_message_loop_->BelongsToCurrentThread()) { |
62 io_message_loop_->DeleteSoon(FROM_HERE, this); | 63 io_message_loop_->DeleteSoon(FROM_HERE, this); |
63 return; | 64 return; |
64 } | 65 } |
65 delete this; | 66 delete this; |
66 } | 67 } |
67 | 68 |
| 69 SandboxMountPointProvider* FileSystemContext::sandbox_provider() const { |
| 70 return path_manager_->sandbox_provider(); |
| 71 } |
| 72 |
68 } // namespace fileapi | 73 } // namespace fileapi |
OLD | NEW |