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