| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/sandbox_mount_point_provider.h" | 5 #include "webkit/fileapi/sandbox_mount_point_provider.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/memory/scoped_callback_factory.h" | 9 #include "base/memory/scoped_callback_factory.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| 11 #include "base/message_loop.h" | 11 #include "base/message_loop.h" |
| 12 #include "base/message_loop_proxy.h" | 12 #include "base/message_loop_proxy.h" |
| 13 #include "base/rand_util.h" | 13 #include "base/rand_util.h" |
| 14 #include "base/string_util.h" | 14 #include "base/string_util.h" |
| 15 #include "base/stringprintf.h" | 15 #include "base/stringprintf.h" |
| 16 #include "googleurl/src/gurl.h" | 16 #include "googleurl/src/gurl.h" |
| 17 #include "net/base/net_util.h" | 17 #include "net/base/net_util.h" |
| 18 #include "webkit/fileapi/file_system_path_manager.h" | 18 #include "webkit/fileapi/file_system_path_manager.h" |
| 19 #include "webkit/fileapi/file_system_types.h" | 19 #include "webkit/fileapi/file_system_types.h" |
| 20 #include "webkit/fileapi/file_system_usage_cache.h" | 20 #include "webkit/fileapi/file_system_usage_cache.h" |
| 21 #include "webkit/fileapi/file_system_util.h" | 21 #include "webkit/fileapi/file_system_util.h" |
| 22 #include "webkit/fileapi/local_file_system_file_util.h" | 22 #include "webkit/fileapi/local_file_system_file_util.h" |
| 23 #include "webkit/fileapi/obfuscated_file_system_file_util.h" | 23 #include "webkit/fileapi/obfuscated_file_system_file_util.h" |
| 24 #include "webkit/fileapi/quota_file_util.h" |
| 24 #include "webkit/fileapi/sandbox_mount_point_provider.h" | 25 #include "webkit/fileapi/sandbox_mount_point_provider.h" |
| 25 #include "webkit/glue/webkit_glue.h" | 26 #include "webkit/glue/webkit_glue.h" |
| 26 #include "webkit/quota/quota_manager.h" | 27 #include "webkit/quota/quota_manager.h" |
| 27 | 28 |
| 28 using quota::QuotaManagerProxy; | 29 using quota::QuotaManagerProxy; |
| 29 | 30 |
| 30 namespace { | 31 namespace { |
| 31 | 32 |
| 32 static const FilePath::CharType kOldFileSystemUniqueNamePrefix[] = | 33 static const FilePath::CharType kOldFileSystemUniqueNamePrefix[] = |
| 33 FILE_PATH_LITERAL("chrome-"); | 34 FILE_PATH_LITERAL("chrome-"); |
| (...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 272 SandboxMountPointProvider::SandboxMountPointProvider( | 273 SandboxMountPointProvider::SandboxMountPointProvider( |
| 273 FileSystemPathManager* path_manager, | 274 FileSystemPathManager* path_manager, |
| 274 scoped_refptr<base::MessageLoopProxy> file_message_loop, | 275 scoped_refptr<base::MessageLoopProxy> file_message_loop, |
| 275 const FilePath& profile_path) | 276 const FilePath& profile_path) |
| 276 : FileSystemQuotaUtil(file_message_loop), | 277 : FileSystemQuotaUtil(file_message_loop), |
| 277 path_manager_(path_manager), | 278 path_manager_(path_manager), |
| 278 file_message_loop_(file_message_loop), | 279 file_message_loop_(file_message_loop), |
| 279 profile_path_(profile_path), | 280 profile_path_(profile_path), |
| 280 sandbox_file_util_( | 281 sandbox_file_util_( |
| 281 new ObfuscatedFileSystemFileUtil( | 282 new ObfuscatedFileSystemFileUtil( |
| 282 profile_path.Append(kNewFileSystemDirectory))) { | 283 profile_path.Append(kNewFileSystemDirectory), |
| 284 QuotaFileUtil::GetInstance())) { |
| 283 } | 285 } |
| 284 | 286 |
| 285 SandboxMountPointProvider::~SandboxMountPointProvider() { | 287 SandboxMountPointProvider::~SandboxMountPointProvider() { |
| 286 if (!file_message_loop_->BelongsToCurrentThread()) | 288 if (!file_message_loop_->BelongsToCurrentThread()) |
| 287 file_message_loop_->ReleaseSoon(FROM_HERE, sandbox_file_util_.release()); | 289 file_message_loop_->ReleaseSoon(FROM_HERE, sandbox_file_util_.release()); |
| 288 } | 290 } |
| 289 | 291 |
| 290 bool SandboxMountPointProvider::IsAccessAllowed(const GURL& origin_url, | 292 bool SandboxMountPointProvider::IsAccessAllowed(const GURL& origin_url, |
| 291 FileSystemType type, | 293 FileSystemType type, |
| 292 const FilePath& unused) { | 294 const FilePath& unused) { |
| (...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 633 | 635 |
| 634 // Creates the root directory. | 636 // Creates the root directory. |
| 635 root = origin_base_path.Append(OldCreateUniqueDirectoryName(origin_url)); | 637 root = origin_base_path.Append(OldCreateUniqueDirectoryName(origin_url)); |
| 636 if (!file_util::CreateDirectory(root)) | 638 if (!file_util::CreateDirectory(root)) |
| 637 return FilePath(); | 639 return FilePath(); |
| 638 | 640 |
| 639 return root; | 641 return root; |
| 640 } | 642 } |
| 641 | 643 |
| 642 } // namespace fileapi | 644 } // namespace fileapi |
| OLD | NEW |