OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 // StorageMonitorCros listens for mount point changes and notifies listeners | 5 // StorageMonitorCros listens for mount point changes and notifies listeners |
6 // about the addition and deletion of media devices. This class lives on the | 6 // about the addition and deletion of media devices. This class lives on the |
7 // UI thread. | 7 // UI thread. |
8 | 8 |
9 #ifndef COMPONENTS_STORAGE_MONITOR_STORAGE_MONITOR_CHROMEOS_H_ | 9 #ifndef COMPONENTS_STORAGE_MONITOR_STORAGE_MONITOR_CHROMEOS_H_ |
10 #define COMPONENTS_STORAGE_MONITOR_STORAGE_MONITOR_CHROMEOS_H_ | 10 #define COMPONENTS_STORAGE_MONITOR_STORAGE_MONITOR_CHROMEOS_H_ |
(...skipping 19 matching lines...) Expand all Loading... |
30 class StorageMonitorCros : public StorageMonitor, | 30 class StorageMonitorCros : public StorageMonitor, |
31 public chromeos::disks::DiskMountManager::Observer { | 31 public chromeos::disks::DiskMountManager::Observer { |
32 public: | 32 public: |
33 // Should only be called by browser start up code. | 33 // Should only be called by browser start up code. |
34 // Use StorageMonitor::GetInstance() instead. | 34 // Use StorageMonitor::GetInstance() instead. |
35 StorageMonitorCros(); | 35 StorageMonitorCros(); |
36 virtual ~StorageMonitorCros(); | 36 virtual ~StorageMonitorCros(); |
37 | 37 |
38 // Sets up disk listeners and issues notifications for any discovered | 38 // Sets up disk listeners and issues notifications for any discovered |
39 // mount points. Sets up MTP manager and listeners. | 39 // mount points. Sets up MTP manager and listeners. |
40 virtual void Init() OVERRIDE; | 40 virtual void Init() override; |
41 | 41 |
42 protected: | 42 protected: |
43 void SetMediaTransferProtocolManagerForTest( | 43 void SetMediaTransferProtocolManagerForTest( |
44 device::MediaTransferProtocolManager* test_manager); | 44 device::MediaTransferProtocolManager* test_manager); |
45 | 45 |
46 // chromeos::disks::DiskMountManager::Observer implementation. | 46 // chromeos::disks::DiskMountManager::Observer implementation. |
47 virtual void OnDiskEvent( | 47 virtual void OnDiskEvent( |
48 chromeos::disks::DiskMountManager::DiskEvent event, | 48 chromeos::disks::DiskMountManager::DiskEvent event, |
49 const chromeos::disks::DiskMountManager::Disk* disk) OVERRIDE; | 49 const chromeos::disks::DiskMountManager::Disk* disk) override; |
50 virtual void OnDeviceEvent( | 50 virtual void OnDeviceEvent( |
51 chromeos::disks::DiskMountManager::DeviceEvent event, | 51 chromeos::disks::DiskMountManager::DeviceEvent event, |
52 const std::string& device_path) OVERRIDE; | 52 const std::string& device_path) override; |
53 virtual void OnMountEvent( | 53 virtual void OnMountEvent( |
54 chromeos::disks::DiskMountManager::MountEvent event, | 54 chromeos::disks::DiskMountManager::MountEvent event, |
55 chromeos::MountError error_code, | 55 chromeos::MountError error_code, |
56 const chromeos::disks::DiskMountManager::MountPointInfo& mount_info) | 56 const chromeos::disks::DiskMountManager::MountPointInfo& mount_info) |
57 OVERRIDE; | 57 override; |
58 virtual void OnFormatEvent( | 58 virtual void OnFormatEvent( |
59 chromeos::disks::DiskMountManager::FormatEvent event, | 59 chromeos::disks::DiskMountManager::FormatEvent event, |
60 chromeos::FormatError error_code, | 60 chromeos::FormatError error_code, |
61 const std::string& device_path) OVERRIDE; | 61 const std::string& device_path) override; |
62 | 62 |
63 // StorageMonitor implementation. | 63 // StorageMonitor implementation. |
64 virtual bool GetStorageInfoForPath(const base::FilePath& path, | 64 virtual bool GetStorageInfoForPath(const base::FilePath& path, |
65 StorageInfo* device_info) const OVERRIDE; | 65 StorageInfo* device_info) const override; |
66 virtual void EjectDevice( | 66 virtual void EjectDevice( |
67 const std::string& device_id, | 67 const std::string& device_id, |
68 base::Callback<void(EjectStatus)> callback) OVERRIDE; | 68 base::Callback<void(EjectStatus)> callback) override; |
69 virtual device::MediaTransferProtocolManager* | 69 virtual device::MediaTransferProtocolManager* |
70 media_transfer_protocol_manager() OVERRIDE; | 70 media_transfer_protocol_manager() override; |
71 | 71 |
72 private: | 72 private: |
73 // Mapping of mount path to removable mass storage info. | 73 // Mapping of mount path to removable mass storage info. |
74 typedef std::map<std::string, StorageInfo> MountMap; | 74 typedef std::map<std::string, StorageInfo> MountMap; |
75 | 75 |
76 // Helper method that checks existing mount points to see if they are media | 76 // Helper method that checks existing mount points to see if they are media |
77 // devices. Eventually calls AddMountedPath for all mount points. | 77 // devices. Eventually calls AddMountedPath for all mount points. |
78 void CheckExistingMountPoints(); | 78 void CheckExistingMountPoints(); |
79 | 79 |
80 // Adds the mount point in |mount_info| to |mount_map_| and send a media | 80 // Adds the mount point in |mount_info| to |mount_map_| and send a media |
(...skipping 12 matching lines...) Expand all Loading... |
93 media_transfer_protocol_device_observer_; | 93 media_transfer_protocol_device_observer_; |
94 | 94 |
95 base::WeakPtrFactory<StorageMonitorCros> weak_ptr_factory_; | 95 base::WeakPtrFactory<StorageMonitorCros> weak_ptr_factory_; |
96 | 96 |
97 DISALLOW_COPY_AND_ASSIGN(StorageMonitorCros); | 97 DISALLOW_COPY_AND_ASSIGN(StorageMonitorCros); |
98 }; | 98 }; |
99 | 99 |
100 } // namespace storage_monitor | 100 } // namespace storage_monitor |
101 | 101 |
102 #endif // COMPONENTS_STORAGE_MONITOR_STORAGE_MONITOR_CHROMEOS_H_ | 102 #endif // COMPONENTS_STORAGE_MONITOR_STORAGE_MONITOR_CHROMEOS_H_ |
OLD | NEW |