OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "storage/browser/fileapi/dragged_file_util.h" | 5 #include "storage/browser/fileapi/dragged_file_util.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/files/file_util.h" | 10 #include "base/files/file_util.h" |
(...skipping 14 matching lines...) Expand all Loading... |
25 // Used to enumerate top-level paths of an isolated filesystem. | 25 // Used to enumerate top-level paths of an isolated filesystem. |
26 class SetFileEnumerator : public FileSystemFileUtil::AbstractFileEnumerator { | 26 class SetFileEnumerator : public FileSystemFileUtil::AbstractFileEnumerator { |
27 public: | 27 public: |
28 explicit SetFileEnumerator(const std::vector<FileInfo>& files) | 28 explicit SetFileEnumerator(const std::vector<FileInfo>& files) |
29 : files_(files) { | 29 : files_(files) { |
30 file_iter_ = files_.begin(); | 30 file_iter_ = files_.begin(); |
31 } | 31 } |
32 virtual ~SetFileEnumerator() {} | 32 virtual ~SetFileEnumerator() {} |
33 | 33 |
34 // AbstractFileEnumerator overrides. | 34 // AbstractFileEnumerator overrides. |
35 virtual base::FilePath Next() OVERRIDE { | 35 virtual base::FilePath Next() override { |
36 if (file_iter_ == files_.end()) | 36 if (file_iter_ == files_.end()) |
37 return base::FilePath(); | 37 return base::FilePath(); |
38 base::FilePath platform_file = (file_iter_++)->path; | 38 base::FilePath platform_file = (file_iter_++)->path; |
39 NativeFileUtil::GetFileInfo(platform_file, &file_info_); | 39 NativeFileUtil::GetFileInfo(platform_file, &file_info_); |
40 return platform_file; | 40 return platform_file; |
41 } | 41 } |
42 virtual int64 Size() OVERRIDE { return file_info_.size; } | 42 virtual int64 Size() override { return file_info_.size; } |
43 virtual bool IsDirectory() OVERRIDE { return file_info_.is_directory; } | 43 virtual bool IsDirectory() override { return file_info_.is_directory; } |
44 virtual base::Time LastModifiedTime() OVERRIDE { | 44 virtual base::Time LastModifiedTime() override { |
45 return file_info_.last_modified; | 45 return file_info_.last_modified; |
46 } | 46 } |
47 | 47 |
48 private: | 48 private: |
49 std::vector<FileInfo> files_; | 49 std::vector<FileInfo> files_; |
50 std::vector<FileInfo>::const_iterator file_iter_; | 50 std::vector<FileInfo>::const_iterator file_iter_; |
51 base::File::Info file_info_; | 51 base::File::Info file_info_; |
52 }; | 52 }; |
53 | 53 |
54 } // namespace | 54 } // namespace |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 return LocalFileUtil::CreateFileEnumerator(context, root); | 96 return LocalFileUtil::CreateFileEnumerator(context, root); |
97 | 97 |
98 // Root path case. | 98 // Root path case. |
99 std::vector<FileInfo> toplevels; | 99 std::vector<FileInfo> toplevels; |
100 IsolatedContext::GetInstance()->GetDraggedFileInfo( | 100 IsolatedContext::GetInstance()->GetDraggedFileInfo( |
101 root.filesystem_id(), &toplevels); | 101 root.filesystem_id(), &toplevels); |
102 return scoped_ptr<AbstractFileEnumerator>(new SetFileEnumerator(toplevels)); | 102 return scoped_ptr<AbstractFileEnumerator>(new SetFileEnumerator(toplevels)); |
103 } | 103 } |
104 | 104 |
105 } // namespace storage | 105 } // namespace storage |
OLD | NEW |