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 "chromeos/disks/disk_mount_manager.h" | 5 #include "chromeos/disks/disk_mount_manager.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 #include <set> | 8 #include <set> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 652 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
663 | 663 |
664 bool DiskMountManager::AddDiskForTest(Disk* disk) { | 664 bool DiskMountManager::AddDiskForTest(Disk* disk) { |
665 return false; | 665 return false; |
666 } | 666 } |
667 | 667 |
668 bool DiskMountManager::AddMountPointForTest(const MountPointInfo& mount_point) { | 668 bool DiskMountManager::AddMountPointForTest(const MountPointInfo& mount_point) { |
669 return false; | 669 return false; |
670 } | 670 } |
671 | 671 |
672 // static | 672 // static |
673 std::string DiskMountManager::MountTypeToString(MountType type) { | |
674 switch (type) { | |
675 case MOUNT_TYPE_DEVICE: | |
676 return "device"; | |
677 case MOUNT_TYPE_ARCHIVE: | |
678 return "file"; | |
679 case MOUNT_TYPE_NETWORK_STORAGE: | |
680 return "network"; | |
681 case MOUNT_TYPE_GOOGLE_DRIVE: | |
682 return "drive"; | |
683 case MOUNT_TYPE_INVALID: | |
684 return "invalid"; | |
685 default: | |
686 NOTREACHED(); | |
687 } | |
688 return ""; | |
689 } | |
690 | |
691 // static | |
692 std::string DiskMountManager::MountConditionToString(MountCondition condition) { | 673 std::string DiskMountManager::MountConditionToString(MountCondition condition) { |
693 switch (condition) { | 674 switch (condition) { |
694 case MOUNT_CONDITION_NONE: | 675 case MOUNT_CONDITION_NONE: |
695 return ""; | 676 return ""; |
696 case MOUNT_CONDITION_UNKNOWN_FILESYSTEM: | 677 case MOUNT_CONDITION_UNKNOWN_FILESYSTEM: |
697 return "unknown_filesystem"; | 678 return "unknown_filesystem"; |
698 case MOUNT_CONDITION_UNSUPPORTED_FILESYSTEM: | 679 case MOUNT_CONDITION_UNSUPPORTED_FILESYSTEM: |
699 return "unsupported_filesystem"; | 680 return "unsupported_filesystem"; |
700 default: | 681 default: |
701 NOTREACHED(); | 682 NOTREACHED(); |
702 } | 683 } |
703 return ""; | 684 return ""; |
704 } | 685 } |
705 | 686 |
706 // static | 687 // static |
707 MountType DiskMountManager::MountTypeFromString(const std::string& type_str) { | |
708 if (type_str == "device") | |
709 return MOUNT_TYPE_DEVICE; | |
710 else if (type_str == "network") | |
711 return MOUNT_TYPE_NETWORK_STORAGE; | |
712 else if (type_str == "file") | |
713 return MOUNT_TYPE_ARCHIVE; | |
714 else if (type_str == "drive") | |
715 return MOUNT_TYPE_GOOGLE_DRIVE; | |
716 else | |
717 return MOUNT_TYPE_INVALID; | |
718 } | |
719 | |
720 // static | |
721 std::string DiskMountManager::DeviceTypeToString(DeviceType type) { | 688 std::string DiskMountManager::DeviceTypeToString(DeviceType type) { |
722 switch (type) { | 689 switch (type) { |
723 case DEVICE_TYPE_USB: | 690 case DEVICE_TYPE_USB: |
724 return "usb"; | 691 return "usb"; |
725 case DEVICE_TYPE_SD: | 692 case DEVICE_TYPE_SD: |
726 return "sd"; | 693 return "sd"; |
727 case DEVICE_TYPE_OPTICAL_DISC: | 694 case DEVICE_TYPE_OPTICAL_DISC: |
728 return "optical"; | 695 return "optical"; |
729 case DEVICE_TYPE_MOBILE: | 696 case DEVICE_TYPE_MOBILE: |
730 return "mobile"; | 697 return "mobile"; |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
765 VLOG(1) << "DiskMountManager Shutdown completed"; | 732 VLOG(1) << "DiskMountManager Shutdown completed"; |
766 } | 733 } |
767 | 734 |
768 // static | 735 // static |
769 DiskMountManager* DiskMountManager::GetInstance() { | 736 DiskMountManager* DiskMountManager::GetInstance() { |
770 return g_disk_mount_manager; | 737 return g_disk_mount_manager; |
771 } | 738 } |
772 | 739 |
773 } // namespace disks | 740 } // namespace disks |
774 } // namespace chromeos | 741 } // namespace chromeos |
OLD | NEW |