| 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/drive/file_cache.h" | 5 #include "chrome/browser/chromeos/drive/file_cache.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
| 10 #include "base/files/file_enumerator.h" | 10 #include "base/files/file_enumerator.h" |
| (...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 487 } | 487 } |
| 488 | 488 |
| 489 FileError FileCache::StoreInternal(const std::string& id, | 489 FileError FileCache::StoreInternal(const std::string& id, |
| 490 const std::string& md5, | 490 const std::string& md5, |
| 491 const base::FilePath& source_path, | 491 const base::FilePath& source_path, |
| 492 FileOperationType file_operation_type) { | 492 FileOperationType file_operation_type) { |
| 493 AssertOnSequencedWorkerPool(); | 493 AssertOnSequencedWorkerPool(); |
| 494 | 494 |
| 495 int64 file_size = 0; | 495 int64 file_size = 0; |
| 496 if (file_operation_type == FILE_OPERATION_COPY) { | 496 if (file_operation_type == FILE_OPERATION_COPY) { |
| 497 if (!file_util::GetFileSize(source_path, &file_size)) { | 497 if (!base::GetFileSize(source_path, &file_size)) { |
| 498 LOG(WARNING) << "Couldn't get file size for: " << source_path.value(); | 498 LOG(WARNING) << "Couldn't get file size for: " << source_path.value(); |
| 499 return FILE_ERROR_FAILED; | 499 return FILE_ERROR_FAILED; |
| 500 } | 500 } |
| 501 } | 501 } |
| 502 if (!FreeDiskSpaceIfNeededFor(file_size)) | 502 if (!FreeDiskSpaceIfNeededFor(file_size)) |
| 503 return FILE_ERROR_NO_LOCAL_SPACE; | 503 return FILE_ERROR_NO_LOCAL_SPACE; |
| 504 | 504 |
| 505 FileCacheEntry cache_entry; | 505 FileCacheEntry cache_entry; |
| 506 storage_->GetCacheEntry(id, &cache_entry); | 506 storage_->GetCacheEntry(id, &cache_entry); |
| 507 | 507 |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 586 const std::string& id = GetIdFromPath(new_path); | 586 const std::string& id = GetIdFromPath(new_path); |
| 587 new_path = GetCacheFilePath(util::CanonicalizeResourceId(id)); | 587 new_path = GetCacheFilePath(util::CanonicalizeResourceId(id)); |
| 588 if (new_path != current && !base::Move(current, new_path)) | 588 if (new_path != current && !base::Move(current, new_path)) |
| 589 return false; | 589 return false; |
| 590 } | 590 } |
| 591 return true; | 591 return true; |
| 592 } | 592 } |
| 593 | 593 |
| 594 } // namespace internal | 594 } // namespace internal |
| 595 } // namespace drive | 595 } // namespace drive |
| OLD | NEW |