| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <set> | 10 #include <set> |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 | 61 |
| 62 // DiskMountManager override. | 62 // DiskMountManager override. |
| 63 void RemoveObserver(Observer* observer) override { | 63 void RemoveObserver(Observer* observer) override { |
| 64 observers_.RemoveObserver(observer); | 64 observers_.RemoveObserver(observer); |
| 65 } | 65 } |
| 66 | 66 |
| 67 // DiskMountManager override. | 67 // DiskMountManager override. |
| 68 void MountPath(const std::string& source_path, | 68 void MountPath(const std::string& source_path, |
| 69 const std::string& source_format, | 69 const std::string& source_format, |
| 70 const std::string& mount_label, | 70 const std::string& mount_label, |
| 71 MountType type) override { | 71 MountType type, |
| 72 MountAccessMode access_mode) override { |
| 72 // Hidden and non-existent devices should not be mounted. | 73 // Hidden and non-existent devices should not be mounted. |
| 73 if (type == MOUNT_TYPE_DEVICE) { | 74 if (type == MOUNT_TYPE_DEVICE) { |
| 74 DiskMap::const_iterator it = disks_.find(source_path); | 75 DiskMap::const_iterator it = disks_.find(source_path); |
| 75 if (it == disks_.end() || it->second->is_hidden()) { | 76 if (it == disks_.end() || it->second->is_hidden()) { |
| 76 OnMountCompleted(MountEntry(MOUNT_ERROR_INTERNAL, source_path, type, | 77 OnMountCompleted(MountEntry(MOUNT_ERROR_INTERNAL, source_path, type, |
| 77 "")); | 78 "")); |
| 78 return; | 79 return; |
| 79 } | 80 } |
| 80 } | 81 } |
| 81 cros_disks_client_->Mount( | 82 cros_disks_client_->Mount( |
| 82 source_path, source_format, mount_label, MOUNT_ACCESS_MODE_READ_WRITE, | 83 source_path, source_format, mount_label, access_mode, |
| 83 // When succeeds, OnMountCompleted will be called by | 84 // When succeeds, OnMountCompleted will be called by |
| 84 // "MountCompleted" signal instead. | 85 // "MountCompleted" signal instead. |
| 85 base::Bind(&base::DoNothing), | 86 base::Bind(&base::DoNothing), |
| 86 base::Bind(&DiskMountManagerImpl::OnMountCompleted, | 87 base::Bind(&DiskMountManagerImpl::OnMountCompleted, |
| 87 weak_ptr_factory_.GetWeakPtr(), | 88 weak_ptr_factory_.GetWeakPtr(), |
| 88 MountEntry(MOUNT_ERROR_INTERNAL, source_path, type, ""))); | 89 MountEntry(MOUNT_ERROR_INTERNAL, source_path, type, ""))); |
| 89 } | 90 } |
| 90 | 91 |
| 91 // DiskMountManager override. | 92 // DiskMountManager override. |
| 92 void UnmountPath(const std::string& mount_path, | 93 void UnmountPath(const std::string& mount_path, |
| (...skipping 663 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 756 VLOG(1) << "DiskMountManager Shutdown completed"; | 757 VLOG(1) << "DiskMountManager Shutdown completed"; |
| 757 } | 758 } |
| 758 | 759 |
| 759 // static | 760 // static |
| 760 DiskMountManager* DiskMountManager::GetInstance() { | 761 DiskMountManager* DiskMountManager::GetInstance() { |
| 761 return g_disk_mount_manager; | 762 return g_disk_mount_manager; |
| 762 } | 763 } |
| 763 | 764 |
| 764 } // namespace disks | 765 } // namespace disks |
| 765 } // namespace chromeos | 766 } // namespace chromeos |
| OLD | NEW |