OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/file_system_provider/fake_provided_file_system
.h" | 5 #include "chrome/browser/chromeos/file_system_provider/fake_provided_file_system
.h" |
6 | 6 |
7 #include "base/thread_task_runner_handle.h" | 7 #include "base/thread_task_runner_handle.h" |
8 #include "net/base/io_buffer.h" | 8 #include "net/base/io_buffer.h" |
9 | 9 |
10 namespace chromeos { | 10 namespace chromeos { |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 const base::FilePath& directory_path, | 129 const base::FilePath& directory_path, |
130 const storage::AsyncFileUtil::ReadDirectoryCallback& callback) { | 130 const storage::AsyncFileUtil::ReadDirectoryCallback& callback) { |
131 storage::AsyncFileUtil::EntryList entry_list; | 131 storage::AsyncFileUtil::EntryList entry_list; |
132 | 132 |
133 for (Entries::const_iterator it = entries_.begin(); it != entries_.end(); | 133 for (Entries::const_iterator it = entries_.begin(); it != entries_.end(); |
134 ++it) { | 134 ++it) { |
135 const base::FilePath file_path = it->first; | 135 const base::FilePath file_path = it->first; |
136 if (file_path == directory_path || directory_path.IsParent(file_path)) { | 136 if (file_path == directory_path || directory_path.IsParent(file_path)) { |
137 const EntryMetadata* const metadata = it->second->metadata.get(); | 137 const EntryMetadata* const metadata = it->second->metadata.get(); |
138 entry_list.push_back(storage::DirectoryEntry( | 138 entry_list.push_back(storage::DirectoryEntry( |
139 metadata->name, | 139 metadata->name, metadata->is_directory |
140 metadata->is_directory ? storage::DirectoryEntry::DIRECTORY | 140 ? storage::DirectoryEntry::DIRECTORY |
141 : storage::DirectoryEntry::FILE, | 141 : storage::DirectoryEntry::FILE)); |
142 metadata->size, | |
143 metadata->modification_time)); | |
144 } | 142 } |
145 } | 143 } |
146 | 144 |
147 return PostAbortableTask(base::Bind( | 145 return PostAbortableTask(base::Bind( |
148 callback, base::File::FILE_OK, entry_list, false /* has_more */)); | 146 callback, base::File::FILE_OK, entry_list, false /* has_more */)); |
149 } | 147 } |
150 | 148 |
151 AbortCallback FakeProvidedFileSystem::OpenFile( | 149 AbortCallback FakeProvidedFileSystem::OpenFile( |
152 const base::FilePath& entry_path, | 150 const base::FilePath& entry_path, |
153 OpenFileMode mode, | 151 OpenFileMode mode, |
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
417 } | 415 } |
418 | 416 |
419 void FakeProvidedFileSystem::AbortMany(const std::vector<int>& task_ids) { | 417 void FakeProvidedFileSystem::AbortMany(const std::vector<int>& task_ids) { |
420 for (size_t i = 0; i < task_ids.size(); ++i) { | 418 for (size_t i = 0; i < task_ids.size(); ++i) { |
421 tracker_.TryCancel(task_ids[i]); | 419 tracker_.TryCancel(task_ids[i]); |
422 } | 420 } |
423 } | 421 } |
424 | 422 |
425 } // namespace file_system_provider | 423 } // namespace file_system_provider |
426 } // namespace chromeos | 424 } // namespace chromeos |
OLD | NEW |