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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 if (!cache->GetCacheEntry(local_id, &cache_entry) || !cache_entry.is_dirty()) | 70 if (!cache->GetCacheEntry(local_id, &cache_entry) || !cache_entry.is_dirty()) |
71 return FILE_ERROR_OK; | 71 return FILE_ERROR_OK; |
72 | 72 |
73 // If the cache is dirty, obtain the file info from the cache file itself. | 73 // If the cache is dirty, obtain the file info from the cache file itself. |
74 base::FilePath local_cache_path; | 74 base::FilePath local_cache_path; |
75 error = cache->GetFile(local_id, &local_cache_path); | 75 error = cache->GetFile(local_id, &local_cache_path); |
76 if (error != FILE_ERROR_OK) | 76 if (error != FILE_ERROR_OK) |
77 return error; | 77 return error; |
78 | 78 |
79 base::PlatformFileInfo file_info; | 79 base::PlatformFileInfo file_info; |
80 if (!file_util::GetFileInfo(local_cache_path, &file_info)) | 80 if (!base::GetFileInfo(local_cache_path, &file_info)) |
81 return FILE_ERROR_NOT_FOUND; | 81 return FILE_ERROR_NOT_FOUND; |
82 | 82 |
83 SetPlatformFileInfoToResourceEntry(file_info, entry); | 83 SetPlatformFileInfoToResourceEntry(file_info, entry); |
84 return FILE_ERROR_OK; | 84 return FILE_ERROR_OK; |
85 } | 85 } |
86 | 86 |
87 // Runs the callback with parameters. | 87 // Runs the callback with parameters. |
88 void RunGetResourceEntryCallback(const GetResourceEntryCallback& callback, | 88 void RunGetResourceEntryCallback(const GetResourceEntryCallback& callback, |
89 scoped_ptr<ResourceEntry> entry, | 89 scoped_ptr<ResourceEntry> entry, |
90 FileError error) { | 90 FileError error) { |
(...skipping 903 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
994 OpenMode open_mode, | 994 OpenMode open_mode, |
995 const std::string& mime_type, | 995 const std::string& mime_type, |
996 const OpenFileCallback& callback) { | 996 const OpenFileCallback& callback) { |
997 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 997 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
998 DCHECK(!callback.is_null()); | 998 DCHECK(!callback.is_null()); |
999 | 999 |
1000 open_file_operation_->OpenFile(file_path, open_mode, mime_type, callback); | 1000 open_file_operation_->OpenFile(file_path, open_mode, mime_type, callback); |
1001 } | 1001 } |
1002 | 1002 |
1003 } // namespace drive | 1003 } // namespace drive |
OLD | NEW |