| 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 // chromeos::RemovableDeviceNotificationsCros listens for mount point changes | 5 // chromeos::RemovableDeviceNotificationsCros listens for mount point changes |
| 6 // and notifies listeners about the addition and deletion of media | 6 // and notifies listeners about the addition and deletion of media |
| 7 // devices. | 7 // devices. |
| 8 | 8 |
| 9 #ifndef CHROME_BROWSER_SYSTEM_MONITOR_REMOVABLE_DEVICE_NOTIFICATIONS_CHROMEOS_H_ | 9 #ifndef CHROME_BROWSER_SYSTEM_MONITOR_REMOVABLE_DEVICE_NOTIFICATIONS_CHROMEOS_H_ |
| 10 #define CHROME_BROWSER_SYSTEM_MONITOR_REMOVABLE_DEVICE_NOTIFICATIONS_CHROMEOS_H_ | 10 #define CHROME_BROWSER_SYSTEM_MONITOR_REMOVABLE_DEVICE_NOTIFICATIONS_CHROMEOS_H_ |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 // Returns false if unable to find the device. | 48 // Returns false if unable to find the device. |
| 49 virtual bool GetDeviceInfoForPath( | 49 virtual bool GetDeviceInfoForPath( |
| 50 const base::FilePath& path, | 50 const base::FilePath& path, |
| 51 StorageInfo* device_info) const OVERRIDE; | 51 StorageInfo* device_info) const OVERRIDE; |
| 52 | 52 |
| 53 // Returns the storage size of the device present at |location|. If the | 53 // Returns the storage size of the device present at |location|. If the |
| 54 // device information is unavailable, returns zero. | 54 // device information is unavailable, returns zero. |
| 55 virtual uint64 GetStorageSize(const std::string& location) const OVERRIDE; | 55 virtual uint64 GetStorageSize(const std::string& location) const OVERRIDE; |
| 56 | 56 |
| 57 private: | 57 private: |
| 58 struct StorageObjectInfo { | |
| 59 // Basic details {storage device name, location and identifier}. | |
| 60 StorageInfo storage_info; | |
| 61 | |
| 62 // Device storage size. | |
| 63 uint64 storage_size_in_bytes; | |
| 64 }; | |
| 65 | |
| 66 friend class base::RefCountedThreadSafe<RemovableDeviceNotificationsCros>; | 58 friend class base::RefCountedThreadSafe<RemovableDeviceNotificationsCros>; |
| 67 | 59 |
| 68 // Mapping of mount path to removable mass storage info. | 60 // Mapping of mount path to removable mass storage info. |
| 69 typedef std::map<std::string, StorageObjectInfo> MountMap; | 61 typedef std::map<std::string, StorageInfo> MountMap; |
| 70 | 62 |
| 71 // Private to avoid code deleting the object. | 63 // Private to avoid code deleting the object. |
| 72 virtual ~RemovableDeviceNotificationsCros(); | 64 virtual ~RemovableDeviceNotificationsCros(); |
| 73 | 65 |
| 74 // Checks existing mount points map for media devices. For each mount point, | 66 // Checks existing mount points map for media devices. For each mount point, |
| 75 // call CheckMountedPathOnFileThread() below. | 67 // call CheckMountedPathOnFileThread() below. |
| 76 void CheckExistingMountPointsOnUIThread(); | 68 void CheckExistingMountPointsOnUIThread(); |
| 77 | 69 |
| 78 // Checks if the mount point in |mount_info| is a media device. If it is, | 70 // Checks if the mount point in |mount_info| is a media device. If it is, |
| 79 // then continue with AddMountedPathOnUIThread() below. | 71 // then continue with AddMountedPathOnUIThread() below. |
| (...skipping 10 matching lines...) Expand all Loading... |
| 90 // Mapping of relevant mount points and their corresponding mount devices. | 82 // Mapping of relevant mount points and their corresponding mount devices. |
| 91 // Only accessed on the UI thread. | 83 // Only accessed on the UI thread. |
| 92 MountMap mount_map_; | 84 MountMap mount_map_; |
| 93 | 85 |
| 94 DISALLOW_COPY_AND_ASSIGN(RemovableDeviceNotificationsCros); | 86 DISALLOW_COPY_AND_ASSIGN(RemovableDeviceNotificationsCros); |
| 95 }; | 87 }; |
| 96 | 88 |
| 97 } // namespace chromeos | 89 } // namespace chromeos |
| 98 | 90 |
| 99 #endif // CHROME_BROWSER_SYSTEM_MONITOR_REMOVABLE_DEVICE_NOTIFICATIONS_CHROMEOS
_H_ | 91 #endif // CHROME_BROWSER_SYSTEM_MONITOR_REMOVABLE_DEVICE_NOTIFICATIONS_CHROMEOS
_H_ |
| OLD | NEW |