| 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/file_system_path_manager.h" | 5 #include "webkit/fileapi/file_system_path_manager.h" |
| 6 | 6 |
| 7 #include "base/rand_util.h" | 7 #include "base/rand_util.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" |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 namespace fileapi { | 35 namespace fileapi { |
| 36 | 36 |
| 37 FileSystemPathManager::FileSystemPathManager( | 37 FileSystemPathManager::FileSystemPathManager( |
| 38 scoped_refptr<base::MessageLoopProxy> file_message_loop, | 38 scoped_refptr<base::MessageLoopProxy> file_message_loop, |
| 39 const FilePath& profile_path, | 39 const FilePath& profile_path, |
| 40 scoped_refptr<quota::SpecialStoragePolicy> special_storage_policy, | 40 scoped_refptr<quota::SpecialStoragePolicy> special_storage_policy, |
| 41 bool is_incognito, | 41 bool is_incognito, |
| 42 bool allow_file_access_from_files) | 42 bool allow_file_access_from_files) |
| 43 : is_incognito_(is_incognito), | 43 : is_incognito_(is_incognito), |
| 44 allow_file_access_from_files_(allow_file_access_from_files), | 44 allow_file_access_from_files_(allow_file_access_from_files), |
| 45 local_file_util_( |
| 46 new LocalFileSystemFileUtil(FileSystemFileUtil::GetInstance())), |
| 45 sandbox_provider_( | 47 sandbox_provider_( |
| 46 new SandboxMountPointProvider( | 48 new SandboxMountPointProvider( |
| 47 ALLOW_THIS_IN_INITIALIZER_LIST(this), | 49 ALLOW_THIS_IN_INITIALIZER_LIST(this), |
| 48 file_message_loop, | 50 file_message_loop, |
| 49 profile_path)) { | 51 profile_path)) { |
| 50 #if defined(OS_CHROMEOS) | 52 #if defined(OS_CHROMEOS) |
| 51 external_provider_.reset( | 53 external_provider_.reset( |
| 52 new chromeos::CrosMountPointProvider(special_storage_policy)); | 54 new chromeos::CrosMountPointProvider(special_storage_policy)); |
| 53 #endif | 55 #endif |
| 54 } | 56 } |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 return true; | 163 return true; |
| 162 } | 164 } |
| 163 | 165 |
| 164 FileSystemFileUtil* FileSystemPathManager::GetFileSystemFileUtil( | 166 FileSystemFileUtil* FileSystemPathManager::GetFileSystemFileUtil( |
| 165 FileSystemType type) const { | 167 FileSystemType type) const { |
| 166 switch (type) { | 168 switch (type) { |
| 167 case kFileSystemTypeTemporary: | 169 case kFileSystemTypeTemporary: |
| 168 case kFileSystemTypePersistent: | 170 case kFileSystemTypePersistent: |
| 169 return sandbox_provider_->GetFileSystemFileUtil(); | 171 return sandbox_provider_->GetFileSystemFileUtil(); |
| 170 case kFileSystemTypeExternal: | 172 case kFileSystemTypeExternal: |
| 171 return LocalFileSystemFileUtil::GetInstance(); | 173 return local_file_util_.get(); |
| 172 case kFileSystemTypeUnknown: | 174 case kFileSystemTypeUnknown: |
| 173 default: | 175 default: |
| 174 NOTREACHED(); | 176 NOTREACHED(); |
| 175 return NULL; | 177 return NULL; |
| 176 } | 178 } |
| 177 } | 179 } |
| 178 | 180 |
| 179 } // namespace fileapi | 181 } // namespace fileapi |
| 180 | 182 |
| 181 COMPILE_ASSERT(int(WebFileSystem::TypeTemporary) == \ | 183 COMPILE_ASSERT(int(WebFileSystem::TypeTemporary) == \ |
| 182 int(fileapi::kFileSystemTypeTemporary), mismatching_enums); | 184 int(fileapi::kFileSystemTypeTemporary), mismatching_enums); |
| 183 COMPILE_ASSERT(int(WebFileSystem::TypePersistent) == \ | 185 COMPILE_ASSERT(int(WebFileSystem::TypePersistent) == \ |
| 184 int(fileapi::kFileSystemTypePersistent), mismatching_enums); | 186 int(fileapi::kFileSystemTypePersistent), mismatching_enums); |
| 185 COMPILE_ASSERT(int(WebFileSystem::TypeExternal) == \ | 187 COMPILE_ASSERT(int(WebFileSystem::TypeExternal) == \ |
| 186 int(fileapi::kFileSystemTypeExternal), mismatching_enums); | 188 int(fileapi::kFileSystemTypeExternal), mismatching_enums); |
| OLD | NEW |