| 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_system.h" | 5 #include "chrome/browser/chromeos/drive/file_system.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
| 9 #include "base/prefs/pref_service.h" | 9 #include "base/prefs/pref_service.h" |
| 10 #include "chrome/browser/chromeos/drive/change_list_loader.h" | 10 #include "chrome/browser/chromeos/drive/change_list_loader.h" |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 // If there's a valid cache, obtain the file info from the cache file itself. | 74 // If there's a valid cache, obtain the file info from the cache file itself. |
| 75 base::FilePath local_cache_path; | 75 base::FilePath local_cache_path; |
| 76 error = cache->GetFile(local_id, &local_cache_path); | 76 error = cache->GetFile(local_id, &local_cache_path); |
| 77 if (error != FILE_ERROR_OK) | 77 if (error != FILE_ERROR_OK) |
| 78 return error; | 78 return error; |
| 79 | 79 |
| 80 base::File::Info file_info; | 80 base::File::Info file_info; |
| 81 if (!base::GetFileInfo(local_cache_path, &file_info)) | 81 if (!base::GetFileInfo(local_cache_path, &file_info)) |
| 82 return FILE_ERROR_NOT_FOUND; | 82 return FILE_ERROR_NOT_FOUND; |
| 83 | 83 |
| 84 // TODO(hashimoto): crbug.com/346625. Also reflect timestamps. | |
| 85 entry->mutable_file_info()->set_size(file_info.size); | 84 entry->mutable_file_info()->set_size(file_info.size); |
| 86 return FILE_ERROR_OK; | 85 return FILE_ERROR_OK; |
| 87 } | 86 } |
| 88 | 87 |
| 89 // Runs the callback with parameters. | 88 // Runs the callback with parameters. |
| 90 void RunGetResourceEntryCallback(const GetResourceEntryCallback& callback, | 89 void RunGetResourceEntryCallback(const GetResourceEntryCallback& callback, |
| 91 scoped_ptr<ResourceEntry> entry, | 90 scoped_ptr<ResourceEntry> entry, |
| 92 FileError error) { | 91 FileError error) { |
| 93 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 92 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 94 DCHECK(!callback.is_null()); | 93 DCHECK(!callback.is_null()); |
| (...skipping 880 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 975 FROM_HERE, | 974 FROM_HERE, |
| 976 base::Bind(&GetPathFromResourceIdOnBlockingPool, | 975 base::Bind(&GetPathFromResourceIdOnBlockingPool, |
| 977 resource_metadata_, | 976 resource_metadata_, |
| 978 resource_id, | 977 resource_id, |
| 979 file_path), | 978 file_path), |
| 980 base::Bind(&GetPathFromResourceIdAfterGetPath, | 979 base::Bind(&GetPathFromResourceIdAfterGetPath, |
| 981 base::Owned(file_path), | 980 base::Owned(file_path), |
| 982 callback)); | 981 callback)); |
| 983 } | 982 } |
| 984 } // namespace drive | 983 } // namespace drive |
| OLD | NEW |