OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "components/filesystem/directory_impl.h" | 5 #include "components/filesystem/directory_impl.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/files/file.h" | 9 #include "base/files/file.h" |
10 #include "base/files/file_enumerator.h" | 10 #include "base/files/file_enumerator.h" |
11 #include "base/files/file_util.h" | 11 #include "base/files/file_util.h" |
12 #include "base/files/scoped_temp_dir.h" | 12 #include "base/files/scoped_temp_dir.h" |
13 #include "base/logging.h" | 13 #include "base/logging.h" |
14 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
15 #include "build/build_config.h" | 15 #include "build/build_config.h" |
16 #include "components/filesystem/file_impl.h" | 16 #include "components/filesystem/file_impl.h" |
| 17 #include "components/filesystem/lock_table.h" |
17 #include "components/filesystem/util.h" | 18 #include "components/filesystem/util.h" |
18 #include "mojo/common/common_type_converters.h" | 19 #include "mojo/common/common_type_converters.h" |
19 #include "mojo/platform_handle/platform_handle_functions.h" | 20 #include "mojo/platform_handle/platform_handle_functions.h" |
20 | 21 |
21 using mojo::ScopedHandle; | 22 using mojo::ScopedHandle; |
22 | 23 |
23 namespace filesystem { | 24 namespace filesystem { |
24 | 25 |
25 DirectoryImpl::DirectoryImpl(mojo::InterfaceRequest<Directory> request, | 26 DirectoryImpl::DirectoryImpl(mojo::InterfaceRequest<Directory> request, |
26 base::FilePath directory_path, | 27 base::FilePath directory_path, |
27 scoped_ptr<base::ScopedTempDir> temp_dir, | 28 scoped_ptr<base::ScopedTempDir> temp_dir, |
28 LockTable* lock_table) | 29 scoped_refptr<LockTable> lock_table) |
29 : binding_(this, std::move(request)), | 30 : binding_(this, std::move(request)), |
30 directory_path_(directory_path), | 31 directory_path_(directory_path), |
31 temp_dir_(std::move(temp_dir)), | 32 temp_dir_(std::move(temp_dir)), |
32 lock_table_(lock_table) {} | 33 lock_table_(std::move(lock_table)) {} |
33 | 34 |
34 DirectoryImpl::~DirectoryImpl() { | 35 DirectoryImpl::~DirectoryImpl() { |
35 } | 36 } |
36 | 37 |
37 void DirectoryImpl::Read(const ReadCallback& callback) { | 38 void DirectoryImpl::Read(const ReadCallback& callback) { |
38 mojo::Array<DirectoryEntryPtr> entries; | 39 mojo::Array<DirectoryEntryPtr> entries; |
39 base::FileEnumerator directory_enumerator( | 40 base::FileEnumerator directory_enumerator( |
40 directory_path_, false, | 41 directory_path_, false, |
41 base::FileEnumerator::DIRECTORIES | base::FileEnumerator::FILES); | 42 base::FileEnumerator::DIRECTORIES | base::FileEnumerator::FILES); |
42 for (base::FilePath name = directory_enumerator.Next(); !name.empty(); | 43 for (base::FilePath name = directory_enumerator.Next(); !name.empty(); |
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
327 data_size) == -1) { | 328 data_size) == -1) { |
328 callback.Run(GetError(base_file)); | 329 callback.Run(GetError(base_file)); |
329 return; | 330 return; |
330 } | 331 } |
331 } | 332 } |
332 | 333 |
333 callback.Run(FileError::OK); | 334 callback.Run(FileError::OK); |
334 } | 335 } |
335 | 336 |
336 } // namespace filesystem | 337 } // namespace filesystem |
OLD | NEW |