| 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 #ifndef CHROME_BROWSER_STORAGE_MONITOR_STORAGE_MONITOR_H_ | 5 #ifndef CHROME_BROWSER_STORAGE_MONITOR_STORAGE_MONITOR_H_ |
| 6 #define CHROME_BROWSER_STORAGE_MONITOR_STORAGE_MONITOR_H_ | 6 #define CHROME_BROWSER_STORAGE_MONITOR_STORAGE_MONITOR_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 EJECT_OK, | 65 EJECT_OK, |
| 66 EJECT_IN_USE, | 66 EJECT_IN_USE, |
| 67 EJECT_NO_SUCH_DEVICE, | 67 EJECT_NO_SUCH_DEVICE, |
| 68 EJECT_FAILURE | 68 EJECT_FAILURE |
| 69 }; | 69 }; |
| 70 | 70 |
| 71 // Returns a pointer to an object owned by the BrowserMainParts, with lifetime | 71 // Returns a pointer to an object owned by the BrowserMainParts, with lifetime |
| 72 // somewhat shorter than a process Singleton. | 72 // somewhat shorter than a process Singleton. |
| 73 static StorageMonitor* GetInstance(); | 73 static StorageMonitor* GetInstance(); |
| 74 | 74 |
| 75 // Initialize the storage monitor. The provided callback, if non-null, | 75 // Ensures that the storage monitor is initialized. The provided callback, If |
| 76 // will be called when initialization is complete. If initialization has | 76 // non-null, will be called when initialization is complete. If initialization |
| 77 // already completed, this callback will be invoked within the calling stack. | 77 // has already completed, this callback will be invoked within the calling |
| 78 // Before the callback is run, calls to |GetAllAvailableStorages| and | 78 // stack. Before the callback is run, calls to |GetAllAvailableStorages| and |
| 79 // |GetStorageInfoForPath| may not return the correct results. In addition, | 79 // |GetStorageInfoForPath| may not return the correct results. In addition, |
| 80 // registered observers will not be notified on device attachment/detachment. | 80 // registered observers will not be notified on device attachment/detachment. |
| 81 // Should be invoked on the UI thread; callbacks will be run on the UI thread. | 81 // Should be invoked on the UI thread; callbacks will be run on the UI thread. |
| 82 void Initialize(base::Closure callback); | 82 void EnsureInitialized(base::Closure callback); |
| 83 | 83 |
| 84 // Return true if the storage monitor has already been initialized. | 84 // Return true if the storage monitor has already been initialized. |
| 85 bool IsInitialized(); | 85 bool IsInitialized(); |
| 86 | 86 |
| 87 // Finds the device that contains |path| and populates |device_info|. | 87 // Finds the device that contains |path| and populates |device_info|. |
| 88 // Should be able to handle any path on the local system, not just removable | 88 // Should be able to handle any path on the local system, not just removable |
| 89 // storage. Returns false if unable to find the device. | 89 // storage. Returns false if unable to find the device. |
| 90 virtual bool GetStorageInfoForPath( | 90 virtual bool GetStorageInfoForPath( |
| 91 const base::FilePath& path, | 91 const base::FilePath& path, |
| 92 StorageInfo* device_info) const = 0; | 92 StorageInfo* device_info) const = 0; |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 | 174 |
| 175 // Map of all known storage devices,including fixed and removable storages. | 175 // Map of all known storage devices,including fixed and removable storages. |
| 176 StorageMap storage_map_; | 176 StorageMap storage_map_; |
| 177 | 177 |
| 178 scoped_ptr<TransientDeviceIds> transient_device_ids_; | 178 scoped_ptr<TransientDeviceIds> transient_device_ids_; |
| 179 }; | 179 }; |
| 180 | 180 |
| 181 } // namespace chrome | 181 } // namespace chrome |
| 182 | 182 |
| 183 #endif // CHROME_BROWSER_STORAGE_MONITOR_STORAGE_MONITOR_H_ | 183 #endif // CHROME_BROWSER_STORAGE_MONITOR_STORAGE_MONITOR_H_ |
| OLD | NEW |