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 "base/files/file_util_proxy.h" | 5 #include "base/files/file_util_proxy.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
| 10 #include "base/files/file.h" |
10 #include "base/location.h" | 11 #include "base/location.h" |
11 #include "base/message_loop/message_loop_proxy.h" | 12 #include "base/message_loop/message_loop_proxy.h" |
12 #include "base/task_runner.h" | 13 #include "base/task_runner.h" |
13 #include "base/task_runner_util.h" | 14 #include "base/task_runner_util.h" |
14 | 15 |
15 namespace base { | 16 namespace base { |
16 | 17 |
17 namespace { | 18 namespace { |
18 | 19 |
19 void CallWithTranslatedParameter(const FileUtilProxy::StatusCallback& callback, | 20 void CallWithTranslatedParameter(const FileUtilProxy::StatusCallback& callback, |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 class GetFileInfoHelper { | 105 class GetFileInfoHelper { |
105 public: | 106 public: |
106 GetFileInfoHelper() | 107 GetFileInfoHelper() |
107 : error_(PLATFORM_FILE_OK) {} | 108 : error_(PLATFORM_FILE_OK) {} |
108 | 109 |
109 void RunWorkForFilePath(const FilePath& file_path) { | 110 void RunWorkForFilePath(const FilePath& file_path) { |
110 if (!PathExists(file_path)) { | 111 if (!PathExists(file_path)) { |
111 error_ = PLATFORM_FILE_ERROR_NOT_FOUND; | 112 error_ = PLATFORM_FILE_ERROR_NOT_FOUND; |
112 return; | 113 return; |
113 } | 114 } |
114 if (!GetFileInfo(file_path, &file_info_)) | 115 // TODO(rvargas): switch this file to base::File. |
| 116 if (!GetFileInfo(file_path, reinterpret_cast<File::Info*>(&file_info_))) |
115 error_ = PLATFORM_FILE_ERROR_FAILED; | 117 error_ = PLATFORM_FILE_ERROR_FAILED; |
116 } | 118 } |
117 | 119 |
118 void RunWorkForPlatformFile(PlatformFile file) { | 120 void RunWorkForPlatformFile(PlatformFile file) { |
119 if (!GetPlatformFileInfo(file, &file_info_)) | 121 if (!GetPlatformFileInfo(file, &file_info_)) |
120 error_ = PLATFORM_FILE_ERROR_FAILED; | 122 error_ = PLATFORM_FILE_ERROR_FAILED; |
121 } | 123 } |
122 | 124 |
123 void Reply(const FileUtilProxy::GetFileInfoCallback& callback) { | 125 void Reply(const FileUtilProxy::GetFileInfoCallback& callback) { |
124 if (!callback.is_null()) { | 126 if (!callback.is_null()) { |
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
404 bool FileUtilProxy::RelayClose( | 406 bool FileUtilProxy::RelayClose( |
405 TaskRunner* task_runner, | 407 TaskRunner* task_runner, |
406 const CloseTask& close_task, | 408 const CloseTask& close_task, |
407 PlatformFile file_handle, | 409 PlatformFile file_handle, |
408 const StatusCallback& callback) { | 410 const StatusCallback& callback) { |
409 return base::PostTaskAndReplyWithResult( | 411 return base::PostTaskAndReplyWithResult( |
410 task_runner, FROM_HERE, Bind(close_task, file_handle), callback); | 412 task_runner, FROM_HERE, Bind(close_task, file_handle), callback); |
411 } | 413 } |
412 | 414 |
413 } // namespace base | 415 } // namespace base |
OLD | NEW |