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/platform_file.h" | 9 #include "base/platform_file.h" |
10 #include "base/prefs/pref_service.h" | 10 #include "base/prefs/pref_service.h" |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 FileCacheEntry cache_entry; | 67 FileCacheEntry cache_entry; |
68 if (!cache->GetCacheEntry(local_id, &cache_entry) || !cache_entry.is_dirty()) | 68 if (!cache->GetCacheEntry(local_id, &cache_entry) || !cache_entry.is_dirty()) |
69 return FILE_ERROR_OK; | 69 return FILE_ERROR_OK; |
70 | 70 |
71 // If the cache is dirty, obtain the file info from the cache file itself. | 71 // If the cache is dirty, obtain the file info from the cache file itself. |
72 base::FilePath local_cache_path; | 72 base::FilePath local_cache_path; |
73 error = cache->GetFile(local_id, &local_cache_path); | 73 error = cache->GetFile(local_id, &local_cache_path); |
74 if (error != FILE_ERROR_OK) | 74 if (error != FILE_ERROR_OK) |
75 return error; | 75 return error; |
76 | 76 |
| 77 // TODO(rvargas): Convert this code to use base::File::Info. |
77 base::PlatformFileInfo file_info; | 78 base::PlatformFileInfo file_info; |
78 if (!base::GetFileInfo(local_cache_path, &file_info)) | 79 if (!base::GetFileInfo(local_cache_path, |
| 80 reinterpret_cast<base::File::Info*>(&file_info))) { |
79 return FILE_ERROR_NOT_FOUND; | 81 return FILE_ERROR_NOT_FOUND; |
| 82 } |
80 | 83 |
81 SetPlatformFileInfoToResourceEntry(file_info, entry); | 84 SetPlatformFileInfoToResourceEntry(file_info, entry); |
82 return FILE_ERROR_OK; | 85 return FILE_ERROR_OK; |
83 } | 86 } |
84 | 87 |
85 // Runs the callback with parameters. | 88 // Runs the callback with parameters. |
86 void RunGetResourceEntryCallback(const GetResourceEntryCallback& callback, | 89 void RunGetResourceEntryCallback(const GetResourceEntryCallback& callback, |
87 scoped_ptr<ResourceEntry> entry, | 90 scoped_ptr<ResourceEntry> entry, |
88 FileError error) { | 91 FileError error) { |
89 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 92 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
(...skipping 833 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
923 OpenMode open_mode, | 926 OpenMode open_mode, |
924 const std::string& mime_type, | 927 const std::string& mime_type, |
925 const OpenFileCallback& callback) { | 928 const OpenFileCallback& callback) { |
926 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 929 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
927 DCHECK(!callback.is_null()); | 930 DCHECK(!callback.is_null()); |
928 | 931 |
929 open_file_operation_->OpenFile(file_path, open_mode, mime_type, callback); | 932 open_file_operation_->OpenFile(file_path, open_mode, mime_type, callback); |
930 } | 933 } |
931 | 934 |
932 } // namespace drive | 935 } // namespace drive |
OLD | NEW |