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 "webkit/browser/fileapi/dragged_file_util.h" | 5 #include "webkit/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/file_util.h" | 10 #include "base/file_util.h" |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 // NULL as it is not really clear what to be set for this virtual directory. | 74 // NULL as it is not really clear what to be set for this virtual directory. |
75 // TODO(kinuko): Maybe we want to set the time when this filesystem is | 75 // TODO(kinuko): Maybe we want to set the time when this filesystem is |
76 // created (i.e. when the files/directories are dropped). | 76 // created (i.e. when the files/directories are dropped). |
77 file_info->is_directory = true; | 77 file_info->is_directory = true; |
78 file_info->is_symbolic_link = false; | 78 file_info->is_symbolic_link = false; |
79 file_info->size = 0; | 79 file_info->size = 0; |
80 return base::PLATFORM_FILE_OK; | 80 return base::PLATFORM_FILE_OK; |
81 } | 81 } |
82 base::PlatformFileError error = | 82 base::PlatformFileError error = |
83 NativeFileUtil::GetFileInfo(url.path(), file_info); | 83 NativeFileUtil::GetFileInfo(url.path(), file_info); |
84 if (file_util::IsLink(url.path()) && !base::FilePath().IsParent(url.path())) { | 84 if (base::IsLink(url.path()) && !base::FilePath().IsParent(url.path())) { |
85 // Don't follow symlinks unless it's the one that are selected by the user. | 85 // Don't follow symlinks unless it's the one that are selected by the user. |
86 return base::PLATFORM_FILE_ERROR_NOT_FOUND; | 86 return base::PLATFORM_FILE_ERROR_NOT_FOUND; |
87 } | 87 } |
88 if (error == base::PLATFORM_FILE_OK) | 88 if (error == base::PLATFORM_FILE_OK) |
89 *platform_path = url.path(); | 89 *platform_path = url.path(); |
90 return error; | 90 return error; |
91 } | 91 } |
92 | 92 |
93 scoped_ptr<FileSystemFileUtil::AbstractFileEnumerator> | 93 scoped_ptr<FileSystemFileUtil::AbstractFileEnumerator> |
94 DraggedFileUtil::CreateFileEnumerator( | 94 DraggedFileUtil::CreateFileEnumerator( |
95 FileSystemOperationContext* context, | 95 FileSystemOperationContext* context, |
96 const FileSystemURL& root) { | 96 const FileSystemURL& root) { |
97 DCHECK(root.is_valid()); | 97 DCHECK(root.is_valid()); |
98 if (!root.path().empty()) | 98 if (!root.path().empty()) |
99 return LocalFileUtil::CreateFileEnumerator(context, root); | 99 return LocalFileUtil::CreateFileEnumerator(context, root); |
100 | 100 |
101 // Root path case. | 101 // Root path case. |
102 std::vector<FileInfo> toplevels; | 102 std::vector<FileInfo> toplevels; |
103 IsolatedContext::GetInstance()->GetDraggedFileInfo( | 103 IsolatedContext::GetInstance()->GetDraggedFileInfo( |
104 root.filesystem_id(), &toplevels); | 104 root.filesystem_id(), &toplevels); |
105 return scoped_ptr<AbstractFileEnumerator>(new SetFileEnumerator(toplevels)); | 105 return scoped_ptr<AbstractFileEnumerator>(new SetFileEnumerator(toplevels)); |
106 } | 106 } |
107 | 107 |
108 } // namespace fileapi | 108 } // namespace fileapi |
OLD | NEW |