| 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 "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/callback.h" | 9 #include "base/callback.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 614 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 625 mounted_volumes_.begin(); | 625 mounted_volumes_.begin(); |
| 626 !from_current_profile && iter != mounted_volumes_.end(); | 626 !from_current_profile && iter != mounted_volumes_.end(); |
| 627 ++iter) { | 627 ++iter) { |
| 628 if (iter->second.mount_path.IsParent(volume_info.source_path)) | 628 if (iter->second.mount_path.IsParent(volume_info.source_path)) |
| 629 from_current_profile = true; | 629 from_current_profile = true; |
| 630 } | 630 } |
| 631 if (!from_current_profile) | 631 if (!from_current_profile) |
| 632 return; | 632 return; |
| 633 } | 633 } |
| 634 | 634 |
| 635 // Filter out removable disks if forbidden by policy for this profile. |
| 636 if (volume_info.type == VOLUME_TYPE_REMOVABLE_DISK_PARTITION && |
| 637 profile_->GetPrefs()->GetBoolean(prefs::kExternalStorageDisabled)) { |
| 638 return; |
| 639 } |
| 640 |
| 635 if (error_code == chromeos::MOUNT_ERROR_NONE || volume_info.mount_condition) | 641 if (error_code == chromeos::MOUNT_ERROR_NONE || volume_info.mount_condition) |
| 636 mounted_volumes_[volume_info.volume_id] = volume_info; | 642 mounted_volumes_[volume_info.volume_id] = volume_info; |
| 637 | 643 |
| 638 FOR_EACH_OBSERVER(VolumeManagerObserver, | 644 FOR_EACH_OBSERVER(VolumeManagerObserver, |
| 639 observers_, | 645 observers_, |
| 640 OnVolumeMounted(error_code, volume_info, is_remounting)); | 646 OnVolumeMounted(error_code, volume_info, is_remounting)); |
| 641 } | 647 } |
| 642 | 648 |
| 643 void VolumeManager::DoUnmountEvent(chromeos::MountError error_code, | 649 void VolumeManager::DoUnmountEvent(chromeos::MountError error_code, |
| 644 const VolumeInfo& volume_info) { | 650 const VolumeInfo& volume_info) { |
| 645 if (mounted_volumes_.find(volume_info.volume_id) == mounted_volumes_.end()) | 651 if (mounted_volumes_.find(volume_info.volume_id) == mounted_volumes_.end()) |
| 646 return; | 652 return; |
| 647 if (error_code == chromeos::MOUNT_ERROR_NONE) | 653 if (error_code == chromeos::MOUNT_ERROR_NONE) |
| 648 mounted_volumes_.erase(volume_info.volume_id); | 654 mounted_volumes_.erase(volume_info.volume_id); |
| 649 | 655 |
| 650 FOR_EACH_OBSERVER(VolumeManagerObserver, | 656 FOR_EACH_OBSERVER(VolumeManagerObserver, |
| 651 observers_, | 657 observers_, |
| 652 OnVolumeUnmounted(error_code, volume_info)); | 658 OnVolumeUnmounted(error_code, volume_info)); |
| 653 } | 659 } |
| 654 | 660 |
| 655 } // namespace file_manager | 661 } // namespace file_manager |
| OLD | NEW |