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 if (!cache->GetCacheEntry(local_id, &cache_entry) || !cache_entry.is_dirty()) | 67 if (!cache->GetCacheEntry(local_id, &cache_entry) || !cache_entry.is_dirty()) |
68 return FILE_ERROR_OK; | 68 return FILE_ERROR_OK; |
69 | 69 |
70 // If the cache is dirty, obtain the file info from the cache file itself. | 70 // If the cache is dirty, obtain the file info from the cache file itself. |
71 base::FilePath local_cache_path; | 71 base::FilePath local_cache_path; |
72 error = cache->GetFile(local_id, &local_cache_path); | 72 error = cache->GetFile(local_id, &local_cache_path); |
73 if (error != FILE_ERROR_OK) | 73 if (error != FILE_ERROR_OK) |
74 return error; | 74 return error; |
75 | 75 |
76 // TODO(rvargas): Convert this code to use base::File::Info. | 76 // TODO(rvargas): Convert this code to use base::File::Info. |
77 base::PlatformFileInfo file_info; | 77 base::File::Info file_info; |
78 if (!base::GetFileInfo(local_cache_path, | 78 if (!base::GetFileInfo(local_cache_path, |
79 reinterpret_cast<base::File::Info*>(&file_info))) { | 79 reinterpret_cast<base::File::Info*>(&file_info))) { |
80 return FILE_ERROR_NOT_FOUND; | 80 return FILE_ERROR_NOT_FOUND; |
81 } | 81 } |
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. |
(...skipping 817 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
905 OpenMode open_mode, | 905 OpenMode open_mode, |
906 const std::string& mime_type, | 906 const std::string& mime_type, |
907 const OpenFileCallback& callback) { | 907 const OpenFileCallback& callback) { |
908 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 908 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
909 DCHECK(!callback.is_null()); | 909 DCHECK(!callback.is_null()); |
910 | 910 |
911 open_file_operation_->OpenFile(file_path, open_mode, mime_type, callback); | 911 open_file_operation_->OpenFile(file_path, open_mode, mime_type, callback); |
912 } | 912 } |
913 | 913 |
914 } // namespace drive | 914 } // namespace drive |
OLD | NEW |