| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/volume_manager.h" | 5 #include "chrome/browser/chromeos/file_manager/volume_manager.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 658 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 669 const chromeos::MountError mount_error = error == base::File::FILE_OK | 669 const chromeos::MountError mount_error = error == base::File::FILE_OK |
| 670 ? chromeos::MOUNT_ERROR_NONE | 670 ? chromeos::MOUNT_ERROR_NONE |
| 671 : chromeos::MOUNT_ERROR_UNKNOWN; | 671 : chromeos::MOUNT_ERROR_UNKNOWN; |
| 672 linked_ptr<Volume> volume(Volume::CreateForProvidedFileSystem( | 672 linked_ptr<Volume> volume(Volume::CreateForProvidedFileSystem( |
| 673 file_system_info, MOUNT_CONTEXT_UNKNOWN)); | 673 file_system_info, MOUNT_CONTEXT_UNKNOWN)); |
| 674 DoUnmountEvent(mount_error, volume); | 674 DoUnmountEvent(mount_error, volume); |
| 675 } | 675 } |
| 676 | 676 |
| 677 void VolumeManager::OnExternalStorageDisabledChanged() { | 677 void VolumeManager::OnExternalStorageDisabledChanged() { |
| 678 // If the policy just got disabled we have to unmount every device currently | 678 // If the policy just got disabled we have to unmount every device currently |
| 679 // mounted. The opposite is fine - we can let the user re-plug her device to | 679 // mounted. The opposite is fine - we can let the user re-plug their device to |
| 680 // make it available. | 680 // make it available. |
| 681 if (profile_->GetPrefs()->GetBoolean(prefs::kExternalStorageDisabled)) { | 681 if (profile_->GetPrefs()->GetBoolean(prefs::kExternalStorageDisabled)) { |
| 682 // We do not iterate on mount_points directly, because mount_points can | 682 // We do not iterate on mount_points directly, because mount_points can |
| 683 // be changed by UnmountPath(). | 683 // be changed by UnmountPath(). |
| 684 // TODO(hidehiko): Is it necessary to unmount mounted archives, too, here? | 684 // TODO(hidehiko): Is it necessary to unmount mounted archives, too, here? |
| 685 while (!disk_mount_manager_->mount_points().empty()) { | 685 while (!disk_mount_manager_->mount_points().empty()) { |
| 686 std::string mount_path = | 686 std::string mount_path = |
| 687 disk_mount_manager_->mount_points().begin()->second.mount_path; | 687 disk_mount_manager_->mount_points().begin()->second.mount_path; |
| 688 disk_mount_manager_->UnmountPath( | 688 disk_mount_manager_->UnmountPath( |
| 689 mount_path, | 689 mount_path, |
| (...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 875 if (mounted_volumes_.find(volume->volume_id()) == mounted_volumes_.end()) | 875 if (mounted_volumes_.find(volume->volume_id()) == mounted_volumes_.end()) |
| 876 return; | 876 return; |
| 877 if (error_code == chromeos::MOUNT_ERROR_NONE) | 877 if (error_code == chromeos::MOUNT_ERROR_NONE) |
| 878 mounted_volumes_.erase(volume->volume_id()); | 878 mounted_volumes_.erase(volume->volume_id()); |
| 879 | 879 |
| 880 FOR_EACH_OBSERVER(VolumeManagerObserver, observers_, | 880 FOR_EACH_OBSERVER(VolumeManagerObserver, observers_, |
| 881 OnVolumeUnmounted(error_code, *volume.get())); | 881 OnVolumeUnmounted(error_code, *volume.get())); |
| 882 } | 882 } |
| 883 | 883 |
| 884 } // namespace file_manager | 884 } // namespace file_manager |
| OLD | NEW |