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/extensions/file_manager/file_handler_util.h" | 5 #include "chrome/browser/chromeos/extensions/file_manager/file_handler_util.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/string_util.h" | 10 #include "base/strings/string_util.h" |
(...skipping 630 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
641 | 641 |
642 base::FilePath local_path = url.path(); | 642 base::FilePath local_path = url.path(); |
643 base::FilePath virtual_path = url.virtual_path(); | 643 base::FilePath virtual_path = url.virtual_path(); |
644 | 644 |
645 bool is_drive_file = url.type() == fileapi::kFileSystemTypeDrive; | 645 bool is_drive_file = url.type() == fileapi::kFileSystemTypeDrive; |
646 DCHECK(!is_drive_file || drive::util::IsUnderDriveMountPoint(local_path)); | 646 DCHECK(!is_drive_file || drive::util::IsUnderDriveMountPoint(local_path)); |
647 | 647 |
648 // If the file is under drive mount point, there is no actual file to be | 648 // If the file is under drive mount point, there is no actual file to be |
649 // found on the url.path(). | 649 // found on the url.path(). |
650 if (!is_drive_file) { | 650 if (!is_drive_file) { |
651 if (!file_util::PathExists(local_path) || | 651 if (!base::PathExists(local_path) || |
652 file_util::IsLink(local_path) || | 652 file_util::IsLink(local_path) || |
653 !file_util::GetFileInfo(local_path, &file_info)) { | 653 !file_util::GetFileInfo(local_path, &file_info)) { |
654 continue; | 654 continue; |
655 } | 655 } |
656 } | 656 } |
657 | 657 |
658 // Grant access to this particular file to target extension. This will | 658 // Grant access to this particular file to target extension. This will |
659 // ensure that the target extension can access only this FS entry and | 659 // ensure that the target extension can access only this FS entry and |
660 // prevent from traversing FS hierarchy upward. | 660 // prevent from traversing FS hierarchy upward. |
661 backend->GrantFileAccessToExtension( | 661 backend->GrantFileAccessToExtension( |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
838 ++iter) { | 838 ++iter) { |
839 content::ChildProcessSecurityPolicy::GetInstance()->GrantPermissionsForFile( | 839 content::ChildProcessSecurityPolicy::GetInstance()->GrantPermissionsForFile( |
840 handler_pid, | 840 handler_pid, |
841 iter->absolute_path, | 841 iter->absolute_path, |
842 GetAccessPermissionsForFileBrowserHandler(extension_.get(), | 842 GetAccessPermissionsForFileBrowserHandler(extension_.get(), |
843 action_id_)); | 843 action_id_)); |
844 } | 844 } |
845 } | 845 } |
846 | 846 |
847 } // namespace file_handler_util | 847 } // namespace file_handler_util |
OLD | NEW |