| 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/isolated_file_util.h" | 5 #include "webkit/fileapi/isolated_file_util.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "webkit/blob/shareable_file_reference.h" | 10 #include "webkit/blob/shareable_file_reference.h" |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 IsolatedContext::GetInstance()->GetDraggedFileInfo( | 172 IsolatedContext::GetInstance()->GetDraggedFileInfo( |
| 173 root.filesystem_id(), &toplevels); | 173 root.filesystem_id(), &toplevels); |
| 174 if (!recursive) { | 174 if (!recursive) { |
| 175 return make_scoped_ptr(new SetFileEnumerator(toplevels)) | 175 return make_scoped_ptr(new SetFileEnumerator(toplevels)) |
| 176 .PassAs<FileSystemFileUtil::AbstractFileEnumerator>(); | 176 .PassAs<FileSystemFileUtil::AbstractFileEnumerator>(); |
| 177 } | 177 } |
| 178 return make_scoped_ptr(new RecursiveSetFileEnumerator(toplevels)) | 178 return make_scoped_ptr(new RecursiveSetFileEnumerator(toplevels)) |
| 179 .PassAs<FileSystemFileUtil::AbstractFileEnumerator>(); | 179 .PassAs<FileSystemFileUtil::AbstractFileEnumerator>(); |
| 180 } | 180 } |
| 181 | 181 |
| 182 bool DraggedFileUtil::IsDirectoryEmpty( | |
| 183 FileSystemOperationContext* context, | |
| 184 const FileSystemURL& url) { | |
| 185 DCHECK(url.is_valid()); | |
| 186 if (url.path().empty()) { | |
| 187 // The root directory case. | |
| 188 std::vector<FileInfo> toplevels; | |
| 189 bool success = IsolatedContext::GetInstance()->GetDraggedFileInfo( | |
| 190 url.filesystem_id(), &toplevels); | |
| 191 DCHECK(success); | |
| 192 return toplevels.empty(); | |
| 193 } | |
| 194 return NativeFileUtil::IsDirectoryEmpty(url.path()); | |
| 195 } | |
| 196 | |
| 197 } // namespace fileapi | 182 } // namespace fileapi |
| OLD | NEW |