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 "chrome/browser/chromeos/file_manager/file_browser_handlers.h" | 5 #include "chrome/browser/chromeos/file_manager/file_browser_handlers.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
9 #include "base/i18n/case_conversion.h" | 9 #include "base/i18n/case_conversion.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
208 scoped_ptr<FileDefinitionList> file_definition_list(new FileDefinitionList); | 208 scoped_ptr<FileDefinitionList> file_definition_list(new FileDefinitionList); |
209 for (size_t i = 0; i < file_urls.size(); ++i) { | 209 for (size_t i = 0; i < file_urls.size(); ++i) { |
210 const FileSystemURL& url = file_urls[i]; | 210 const FileSystemURL& url = file_urls[i]; |
211 | 211 |
212 // Check if this file system entry exists first. | 212 // Check if this file system entry exists first. |
213 base::File::Info file_info; | 213 base::File::Info file_info; |
214 | 214 |
215 base::FilePath local_path = url.path(); | 215 base::FilePath local_path = url.path(); |
216 base::FilePath virtual_path = url.virtual_path(); | 216 base::FilePath virtual_path = url.virtual_path(); |
217 | 217 |
218 bool is_drive_file = url.type() == fileapi::kFileSystemTypeDrive; | 218 const bool is_drive_file = url.type() == fileapi::kFileSystemTypeDrive; |
219 DCHECK(!is_drive_file || drive::util::IsUnderDriveMountPoint(local_path)); | 219 DCHECK(!is_drive_file || drive::util::IsUnderDriveMountPoint(local_path)); |
220 | 220 |
221 // If the file is under drive mount point, there is no actual file to be | 221 const bool is_native_file = |
222 // found on the url.path(). | 222 url.type() == fileapi::kFileSystemTypeNativeLocal || |
223 if (!is_drive_file) { | 223 url.type() == fileapi::kFileSystemTypeRestrictedNativeLocal; |
| 224 |
| 225 // If the file is from a physical volume, actual file must be found. |
| 226 if (is_native_file) { |
224 if (!base::PathExists(local_path) || | 227 if (!base::PathExists(local_path) || |
225 base::IsLink(local_path) || | 228 base::IsLink(local_path) || |
226 !base::GetFileInfo(local_path, &file_info)) { | 229 !base::GetFileInfo(local_path, &file_info)) { |
227 continue; | 230 continue; |
228 } | 231 } |
229 } | 232 } |
230 | 233 |
231 // Grant access to this particular file to target extension. This will | 234 // Grant access to this particular file to target extension. This will |
232 // ensure that the target extension can access only this FS entry and | 235 // ensure that the target extension can access only this FS entry and |
233 // prevent from traversing FS hierarchy upward. | 236 // prevent from traversing FS hierarchy upward. |
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
524 if (common_handlers.empty()) | 527 if (common_handlers.empty()) |
525 return FileBrowserHandlerList(); | 528 return FileBrowserHandlerList(); |
526 } | 529 } |
527 } | 530 } |
528 | 531 |
529 return common_handlers; | 532 return common_handlers; |
530 } | 533 } |
531 | 534 |
532 } // namespace file_browser_handlers | 535 } // namespace file_browser_handlers |
533 } // namespace file_manager | 536 } // namespace file_manager |
OLD | NEW |