| 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 590 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 601 } | 601 } |
| 602 default: { | 602 default: { |
| 603 LOG(ERROR) << "Unknown event: " << event; | 603 LOG(ERROR) << "Unknown event: " << event; |
| 604 } | 604 } |
| 605 } | 605 } |
| 606 } | 606 } |
| 607 | 607 |
| 608 // Notifies all observers about disk status update. | 608 // Notifies all observers about disk status update. |
| 609 void NotifyDiskStatusUpdate(DiskEvent event, | 609 void NotifyDiskStatusUpdate(DiskEvent event, |
| 610 const Disk* disk) { | 610 const Disk* disk) { |
| 611 FOR_EACH_OBSERVER(Observer, observers_, OnDiskEvent(event, disk)); | 611 for (auto& observer : observers_) |
| 612 observer.OnDiskEvent(event, disk); |
| 612 } | 613 } |
| 613 | 614 |
| 614 // Notifies all observers about device status update. | 615 // Notifies all observers about device status update. |
| 615 void NotifyDeviceStatusUpdate(DeviceEvent event, | 616 void NotifyDeviceStatusUpdate(DeviceEvent event, |
| 616 const std::string& device_path) { | 617 const std::string& device_path) { |
| 617 FOR_EACH_OBSERVER(Observer, observers_, OnDeviceEvent(event, device_path)); | 618 for (auto& observer : observers_) |
| 619 observer.OnDeviceEvent(event, device_path); |
| 618 } | 620 } |
| 619 | 621 |
| 620 // Notifies all observers about mount completion. | 622 // Notifies all observers about mount completion. |
| 621 void NotifyMountStatusUpdate(MountEvent event, | 623 void NotifyMountStatusUpdate(MountEvent event, |
| 622 MountError error_code, | 624 MountError error_code, |
| 623 const MountPointInfo& mount_info) { | 625 const MountPointInfo& mount_info) { |
| 624 FOR_EACH_OBSERVER(Observer, observers_, | 626 for (auto& observer : observers_) |
| 625 OnMountEvent(event, error_code, mount_info)); | 627 observer.OnMountEvent(event, error_code, mount_info); |
| 626 } | 628 } |
| 627 | 629 |
| 628 void NotifyFormatStatusUpdate(FormatEvent event, | 630 void NotifyFormatStatusUpdate(FormatEvent event, |
| 629 FormatError error_code, | 631 FormatError error_code, |
| 630 const std::string& device_path) { | 632 const std::string& device_path) { |
| 631 FOR_EACH_OBSERVER(Observer, observers_, | 633 for (auto& observer : observers_) |
| 632 OnFormatEvent(event, error_code, device_path)); | 634 observer.OnFormatEvent(event, error_code, device_path); |
| 633 } | 635 } |
| 634 | 636 |
| 635 // Finds system path prefix from |system_path|. | 637 // Finds system path prefix from |system_path|. |
| 636 const std::string& FindSystemPathPrefix(const std::string& system_path) { | 638 const std::string& FindSystemPathPrefix(const std::string& system_path) { |
| 637 if (system_path.empty()) | 639 if (system_path.empty()) |
| 638 return base::EmptyString(); | 640 return base::EmptyString(); |
| 639 for (SystemPathPrefixSet::const_iterator it = system_path_prefixes_.begin(); | 641 for (SystemPathPrefixSet::const_iterator it = system_path_prefixes_.begin(); |
| 640 it != system_path_prefixes_.end(); | 642 it != system_path_prefixes_.end(); |
| 641 ++it) { | 643 ++it) { |
| 642 const std::string& prefix = *it; | 644 const std::string& prefix = *it; |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 792 VLOG(1) << "DiskMountManager Shutdown completed"; | 794 VLOG(1) << "DiskMountManager Shutdown completed"; |
| 793 } | 795 } |
| 794 | 796 |
| 795 // static | 797 // static |
| 796 DiskMountManager* DiskMountManager::GetInstance() { | 798 DiskMountManager* DiskMountManager::GetInstance() { |
| 797 return g_disk_mount_manager; | 799 return g_disk_mount_manager; |
| 798 } | 800 } |
| 799 | 801 |
| 800 } // namespace disks | 802 } // namespace disks |
| 801 } // namespace chromeos | 803 } // namespace chromeos |
| OLD | NEW |