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 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
243 base::FilePath local_path = url.path(); | 243 base::FilePath local_path = url.path(); |
244 base::FilePath virtual_path = url.virtual_path(); | 244 base::FilePath virtual_path = url.virtual_path(); |
245 | 245 |
246 bool is_drive_file = url.type() == fileapi::kFileSystemTypeDrive; | 246 bool is_drive_file = url.type() == fileapi::kFileSystemTypeDrive; |
247 DCHECK(!is_drive_file || drive::util::IsUnderDriveMountPoint(local_path)); | 247 DCHECK(!is_drive_file || drive::util::IsUnderDriveMountPoint(local_path)); |
248 | 248 |
249 // If the file is under drive mount point, there is no actual file to be | 249 // If the file is under drive mount point, there is no actual file to be |
250 // found on the url.path(). | 250 // found on the url.path(). |
251 if (!is_drive_file) { | 251 if (!is_drive_file) { |
252 if (!base::PathExists(local_path) || | 252 if (!base::PathExists(local_path) || |
253 file_util::IsLink(local_path) || | 253 base::IsLink(local_path) || |
254 !file_util::GetFileInfo(local_path, &file_info)) { | 254 !base::GetFileInfo(local_path, &file_info)) { |
255 continue; | 255 continue; |
256 } | 256 } |
257 } | 257 } |
258 | 258 |
259 // Grant access to this particular file to target extension. This will | 259 // Grant access to this particular file to target extension. This will |
260 // ensure that the target extension can access only this FS entry and | 260 // ensure that the target extension can access only this FS entry and |
261 // prevent from traversing FS hierarchy upward. | 261 // prevent from traversing FS hierarchy upward. |
262 backend->GrantFileAccessToExtension( | 262 backend->GrantFileAccessToExtension( |
263 handler_extension->id(), virtual_path); | 263 handler_extension->id(), virtual_path); |
264 | 264 |
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
539 common_handlers.erase(gallery_iter); | 539 common_handlers.erase(gallery_iter); |
540 else | 540 else |
541 common_handlers.erase(watch_iter); | 541 common_handlers.erase(watch_iter); |
542 } | 542 } |
543 | 543 |
544 return common_handlers; | 544 return common_handlers; |
545 } | 545 } |
546 | 546 |
547 } // namespace file_browser_handlers | 547 } // namespace file_browser_handlers |
548 } // namespace file_manager | 548 } // namespace file_manager |
OLD | NEW |