| 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 "webkit/fileapi/file_system_file_util_proxy.h" | 5 #include "webkit/fileapi/file_system_file_util_proxy.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "base/sequenced_task_runner.h" | 9 #include "base/sequenced_task_runner.h" |
| 10 #include "base/task_runner_util.h" | 10 #include "base/task_runner_util.h" |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 | 72 |
| 73 void ReplySnapshotFile(const Proxy::SnapshotFileCallback& callback) { | 73 void ReplySnapshotFile(const Proxy::SnapshotFileCallback& callback) { |
| 74 DCHECK(snapshot_policy_ != FileSystemFileUtil::kSnapshotFileUnknown); | 74 DCHECK(snapshot_policy_ != FileSystemFileUtil::kSnapshotFileUnknown); |
| 75 if (!callback.is_null()) | 75 if (!callback.is_null()) |
| 76 callback.Run(error_, file_info_, platform_path_, snapshot_policy_); | 76 callback.Run(error_, file_info_, platform_path_, snapshot_policy_); |
| 77 } | 77 } |
| 78 | 78 |
| 79 private: | 79 private: |
| 80 base::PlatformFileError error_; | 80 base::PlatformFileError error_; |
| 81 base::PlatformFileInfo file_info_; | 81 base::PlatformFileInfo file_info_; |
| 82 FilePath platform_path_; | 82 base::FilePath platform_path_; |
| 83 FileSystemFileUtil::SnapshotFilePolicy snapshot_policy_; | 83 FileSystemFileUtil::SnapshotFilePolicy snapshot_policy_; |
| 84 DISALLOW_COPY_AND_ASSIGN(GetFileInfoHelper); | 84 DISALLOW_COPY_AND_ASSIGN(GetFileInfoHelper); |
| 85 }; | 85 }; |
| 86 | 86 |
| 87 class ReadDirectoryHelper { | 87 class ReadDirectoryHelper { |
| 88 public: | 88 public: |
| 89 ReadDirectoryHelper() : error_(base::PLATFORM_FILE_OK) {} | 89 ReadDirectoryHelper() : error_(base::PLATFORM_FILE_OK) {} |
| 90 | 90 |
| 91 void RunWork(FileSystemFileUtil* file_util, | 91 void RunWork(FileSystemFileUtil* file_util, |
| 92 FileSystemOperationContext* context, | 92 FileSystemOperationContext* context, |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 context->task_runner(), FROM_HERE, | 174 context->task_runner(), FROM_HERE, |
| 175 Bind(&FileSystemFileUtil::CopyOrMoveFile, Unretained(file_util), | 175 Bind(&FileSystemFileUtil::CopyOrMoveFile, Unretained(file_util), |
| 176 context, src_url, dest_url, false /* copy */), | 176 context, src_url, dest_url, false /* copy */), |
| 177 callback); | 177 callback); |
| 178 } | 178 } |
| 179 | 179 |
| 180 // static | 180 // static |
| 181 bool FileSystemFileUtilProxy::CopyInForeignFile( | 181 bool FileSystemFileUtilProxy::CopyInForeignFile( |
| 182 FileSystemOperationContext* context, | 182 FileSystemOperationContext* context, |
| 183 FileSystemFileUtil* file_util, | 183 FileSystemFileUtil* file_util, |
| 184 const FilePath& src_local_disk_file_path, | 184 const base::FilePath& src_local_disk_file_path, |
| 185 const FileSystemURL& dest_url, | 185 const FileSystemURL& dest_url, |
| 186 const StatusCallback& callback) { | 186 const StatusCallback& callback) { |
| 187 return base::PostTaskAndReplyWithResult( | 187 return base::PostTaskAndReplyWithResult( |
| 188 context->task_runner(), FROM_HERE, | 188 context->task_runner(), FROM_HERE, |
| 189 Bind(&FileSystemFileUtil::CopyInForeignFile, Unretained(file_util), | 189 Bind(&FileSystemFileUtil::CopyInForeignFile, Unretained(file_util), |
| 190 context, src_local_disk_file_path, dest_url), | 190 context, src_local_disk_file_path, dest_url), |
| 191 callback); | 191 callback); |
| 192 } | 192 } |
| 193 | 193 |
| 194 // static | 194 // static |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 285 int64 length, | 285 int64 length, |
| 286 const StatusCallback& callback) { | 286 const StatusCallback& callback) { |
| 287 return base::PostTaskAndReplyWithResult( | 287 return base::PostTaskAndReplyWithResult( |
| 288 context->task_runner(), FROM_HERE, | 288 context->task_runner(), FROM_HERE, |
| 289 Bind(&FileSystemFileUtil::Truncate, Unretained(file_util), | 289 Bind(&FileSystemFileUtil::Truncate, Unretained(file_util), |
| 290 context, url, length), | 290 context, url, length), |
| 291 callback); | 291 callback); |
| 292 } | 292 } |
| 293 | 293 |
| 294 } // namespace fileapi | 294 } // namespace fileapi |
| OLD | NEW |