| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/browser/chromeos/gdata/gdata_file_system.h" | 5 #include "chrome/browser/chromeos/gdata/gdata_file_system.h" |
| 6 | 6 |
| 7 #include <errno.h> | 7 #include <errno.h> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/eintr_wrapper.h" | 10 #include "base/eintr_wrapper.h" |
| (...skipping 2121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2132 return base::PLATFORM_FILE_ERROR_NOT_FOUND; | 2132 return base::PLATFORM_FILE_ERROR_NOT_FOUND; |
| 2133 | 2133 |
| 2134 return base::PLATFORM_FILE_OK; | 2134 return base::PLATFORM_FILE_OK; |
| 2135 } | 2135 } |
| 2136 | 2136 |
| 2137 //===================== GDataFileSystem: Cache entry points ==================== | 2137 //===================== GDataFileSystem: Cache entry points ==================== |
| 2138 | 2138 |
| 2139 FilePath GDataFileSystem::GetCacheFilePath(const std::string& resource_id, | 2139 FilePath GDataFileSystem::GetCacheFilePath(const std::string& resource_id, |
| 2140 const std::string& md5, | 2140 const std::string& md5, |
| 2141 CacheSubdir subdir_id, | 2141 CacheSubdir subdir_id, |
| 2142 CachedFileOrigin file_origin) { | 2142 CachedFileOrigin file_origin) const { |
| 2143 DCHECK(subdir_id != CACHE_TYPE_META); | 2143 DCHECK(subdir_id != CACHE_TYPE_META); |
| 2144 // Runs on any thread. | 2144 // Runs on any thread. |
| 2145 // Filename is formatted as resource_id.md5, i.e. resource_id is the base | 2145 // Filename is formatted as resource_id.md5, i.e. resource_id is the base |
| 2146 // name and md5 is the extension. | 2146 // name and md5 is the extension. |
| 2147 std::string base_name = GDataFileBase::EscapeUtf8FileName(resource_id); | 2147 std::string base_name = GDataFileBase::EscapeUtf8FileName(resource_id); |
| 2148 if (file_origin == CACHED_FILE_LOCALLY_MODIFIED) { | 2148 if (file_origin == CACHED_FILE_LOCALLY_MODIFIED) { |
| 2149 DCHECK(subdir_id == CACHE_TYPE_PERSISTENT); | 2149 DCHECK(subdir_id == CACHE_TYPE_PERSISTENT); |
| 2150 base_name += FilePath::kExtensionSeparator; | 2150 base_name += FilePath::kExtensionSeparator; |
| 2151 base_name += kLocallyModifiedFileExtension; | 2151 base_name += kLocallyModifiedFileExtension; |
| 2152 } else if (!md5.empty()) { | 2152 } else if (!md5.empty()) { |
| (...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2513 ProfileKeyedService* GDataFileSystemFactory::BuildServiceInstanceFor( | 2513 ProfileKeyedService* GDataFileSystemFactory::BuildServiceInstanceFor( |
| 2514 Profile* profile) const { | 2514 Profile* profile) const { |
| 2515 GDataFileSystem* file_system = new GDataFileSystem(profile, | 2515 GDataFileSystem* file_system = new GDataFileSystem(profile, |
| 2516 new DocumentsService, | 2516 new DocumentsService, |
| 2517 new GDataSyncClient); | 2517 new GDataSyncClient); |
| 2518 file_system->Initialize(); | 2518 file_system->Initialize(); |
| 2519 return file_system; | 2519 return file_system; |
| 2520 } | 2520 } |
| 2521 | 2521 |
| 2522 } // namespace gdata | 2522 } // namespace gdata |
| OLD | NEW |