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_handler_util.h" | 5 #include "chrome/browser/chromeos/extensions/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/json/json_writer.h" | 10 #include "base/json/json_writer.h" |
(...skipping 632 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
643 return false; | 643 return false; |
644 } | 644 } |
645 | 645 |
646 // Check if this file system entry exists first. | 646 // Check if this file system entry exists first. |
647 base::PlatformFileInfo file_info; | 647 base::PlatformFileInfo file_info; |
648 | 648 |
649 FilePath local_path = url.path(); | 649 FilePath local_path = url.path(); |
650 FilePath virtual_path = url.virtual_path(); | 650 FilePath virtual_path = url.virtual_path(); |
651 | 651 |
652 bool is_drive_file = url.type() == fileapi::kFileSystemTypeDrive; | 652 bool is_drive_file = url.type() == fileapi::kFileSystemTypeDrive; |
653 DCHECK(!is_drive_file || gdata::util::IsUnderGDataMountPoint(local_path)); | 653 DCHECK(!is_drive_file || gdata::util::IsUnderDriveMountPoint(local_path)); |
654 | 654 |
655 // If the file is under gdata mount point, there is no actual file to be | 655 // If the file is under gdata mount point, there is no actual file to be |
656 // found on the url.path(). | 656 // found on the url.path(). |
657 if (!is_drive_file) { | 657 if (!is_drive_file) { |
658 if (!file_util::PathExists(local_path) || | 658 if (!file_util::PathExists(local_path) || |
659 file_util::IsLink(local_path) || | 659 file_util::IsLink(local_path) || |
660 !file_util::GetFileInfo(local_path, &file_info)) { | 660 !file_util::GetFileInfo(local_path, &file_info)) { |
661 return false; | 661 return false; |
662 } | 662 } |
663 } | 663 } |
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
901 | 901 |
902 scoped_ptr<std::vector<FilePath> > gdata_paths(new std::vector<FilePath>); | 902 scoped_ptr<std::vector<FilePath> > gdata_paths(new std::vector<FilePath>); |
903 for (FileDefinitionList::const_iterator iter = file_list.begin(); | 903 for (FileDefinitionList::const_iterator iter = file_list.begin(); |
904 iter != file_list.end(); | 904 iter != file_list.end(); |
905 ++iter) { | 905 ++iter) { |
906 // Setup permission for file's absolute file. | 906 // Setup permission for file's absolute file. |
907 handler_host_permissions_.push_back(std::make_pair( | 907 handler_host_permissions_.push_back(std::make_pair( |
908 iter->absolute_path, | 908 iter->absolute_path, |
909 GetAccessPermissionsForHandler(handler_extension, action_id))); | 909 GetAccessPermissionsForHandler(handler_extension, action_id))); |
910 | 910 |
911 if (gdata::util::IsUnderGDataMountPoint(iter->absolute_path)) | 911 if (gdata::util::IsUnderDriveMountPoint(iter->absolute_path)) |
912 gdata_paths->push_back(iter->virtual_path); | 912 gdata_paths->push_back(iter->virtual_path); |
913 } | 913 } |
914 | 914 |
915 if (gdata_paths->empty()) { | 915 if (gdata_paths->empty()) { |
916 // Invoke callback if none of the files are on gdata mount point. | 916 // Invoke callback if none of the files are on gdata mount point. |
917 callback.Run(); | 917 callback.Run(); |
918 return; | 918 return; |
919 } | 919 } |
920 | 920 |
921 // For files on gdata mount point, we'll have to give handler host permissions | 921 // For files on gdata mount point, we'll have to give handler host permissions |
(...skipping 11 matching lines...) Expand all Loading... |
933 handler_pid, | 933 handler_pid, |
934 handler_host_permissions_[i].first, | 934 handler_host_permissions_[i].first, |
935 handler_host_permissions_[i].second); | 935 handler_host_permissions_[i].second); |
936 } | 936 } |
937 | 937 |
938 // We don't need this anymore. | 938 // We don't need this anymore. |
939 handler_host_permissions_.clear(); | 939 handler_host_permissions_.clear(); |
940 } | 940 } |
941 | 941 |
942 } // namespace file_handler_util | 942 } // namespace file_handler_util |
OLD | NEW |