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 // StorageMonitorLinux processes mount point change events, notifies listeners | 5 // StorageMonitorLinux processes mount point change events, notifies listeners |
6 // about the addition and deletion of media devices, and answers queries about | 6 // about the addition and deletion of media devices, and answers queries about |
7 // mounted devices. | 7 // mounted devices. |
8 // StorageMonitorLinux lives on the UI thread, and uses a MtabWatcherLinux on | 8 // StorageMonitorLinux lives on the UI thread, and uses a MtabWatcherLinux on |
9 // the FILE thread to get mount point change events. | 9 // the FILE thread to get mount point change events. |
10 | 10 |
(...skipping 29 matching lines...) Expand all Loading... |
40 | 40 |
41 // Must be called for StorageMonitorLinux to work. | 41 // Must be called for StorageMonitorLinux to work. |
42 void Init(); | 42 void Init(); |
43 | 43 |
44 // Finds the device that contains |path| and populates |device_info|. | 44 // Finds the device that contains |path| and populates |device_info|. |
45 // Returns false if unable to find the device. | 45 // Returns false if unable to find the device. |
46 virtual bool GetStorageInfoForPath( | 46 virtual bool GetStorageInfoForPath( |
47 const base::FilePath& path, | 47 const base::FilePath& path, |
48 StorageInfo* device_info) const OVERRIDE; | 48 StorageInfo* device_info) const OVERRIDE; |
49 | 49 |
50 // Returns the storage partition size of the device present at |location|. | |
51 // If the requested information is unavailable, returns 0. | |
52 virtual uint64 GetStorageSize(const std::string& location) const OVERRIDE; | |
53 | |
54 protected: | 50 protected: |
55 // Gets device information given a |device_path| and |mount_point|. | 51 // Gets device information given a |device_path| and |mount_point|. |
56 typedef base::Callback<scoped_ptr<StorageInfo>( | 52 typedef base::Callback<scoped_ptr<StorageInfo>( |
57 const base::FilePath& device_path, | 53 const base::FilePath& device_path, |
58 const base::FilePath& mount_point)> GetDeviceInfoCallback; | 54 const base::FilePath& mount_point)> GetDeviceInfoCallback; |
59 | 55 |
60 void SetGetDeviceInfoCallbackForTest( | 56 void SetGetDeviceInfoCallbackForTest( |
61 const GetDeviceInfoCallback& get_device_info_callback); | 57 const GetDeviceInfoCallback& get_device_info_callback); |
62 | 58 |
63 // MtabWatcherLinux::Delegate implementation. | 59 // MtabWatcherLinux::Delegate implementation. |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 scoped_ptr<MtabWatcherLinux, MtabWatcherLinuxDeleter> mtab_watcher_; | 127 scoped_ptr<MtabWatcherLinux, MtabWatcherLinuxDeleter> mtab_watcher_; |
132 | 128 |
133 base::WeakPtrFactory<StorageMonitorLinux> weak_ptr_factory_; | 129 base::WeakPtrFactory<StorageMonitorLinux> weak_ptr_factory_; |
134 | 130 |
135 DISALLOW_COPY_AND_ASSIGN(StorageMonitorLinux); | 131 DISALLOW_COPY_AND_ASSIGN(StorageMonitorLinux); |
136 }; | 132 }; |
137 | 133 |
138 } // namespace chrome | 134 } // namespace chrome |
139 | 135 |
140 #endif // CHROME_BROWSER_STORAGE_MONITOR_STORAGE_MONITOR_LINUX_H_ | 136 #endif // CHROME_BROWSER_STORAGE_MONITOR_STORAGE_MONITOR_LINUX_H_ |
OLD | NEW |