Chromium Code Reviews| 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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 66 | 66 |
| 67 // Initialize the storage monitor. The provided callback, if non-null, | 67 // Initialize the storage monitor. The provided callback, if non-null, |
| 68 // will be called when initialization is complete. If initialization has | 68 // will be called when initialization is complete. If initialization has |
| 69 // already completed, this callback will be invoked within the calling stack. | 69 // already completed, this callback will be invoked within the calling stack. |
| 70 // Before the callback is run, calls to |GetAttachedStorage| and | 70 // Before the callback is run, calls to |GetAttachedStorage| and |
| 71 // |GetStorageInfoForPath| may not return the correct results. In addition, | 71 // |GetStorageInfoForPath| may not return the correct results. In addition, |
| 72 // registered observers will not be notified on device attachment/detachment. | 72 // registered observers will not be notified on device attachment/detachment. |
| 73 // Should be invoked on the UI thread; callbacks will be run on the UI thread. | 73 // Should be invoked on the UI thread; callbacks will be run on the UI thread. |
| 74 void Initialize(base::Closure callback); | 74 void Initialize(base::Closure callback); |
| 75 | 75 |
| 76 // Register a callback to be called when the initialization is completed. If | |
| 77 // the initialization is already completed, the provided callback will be | |
| 78 // invoked with the calling stack. | |
| 79 void RegisterInitCompletedCallback(base::Closure callback); | |
|
vandebo (ex-Chrome)
2013/05/28 20:00:29
This is the same as Initialize - remove.
Hongbo Min
2013/05/29 01:05:38
No, from the source code of Initialize, it will in
| |
| 80 | |
| 76 // Return true if the storage monitor has already been initialized. | 81 // Return true if the storage monitor has already been initialized. |
| 77 bool IsInitialized(); | 82 bool IsInitialized(); |
| 78 | 83 |
| 79 // Finds the device that contains |path| and populates |device_info|. | 84 // Finds the device that contains |path| and populates |device_info|. |
| 80 // Should be able to handle any path on the local system, not just removable | 85 // Should be able to handle any path on the local system, not just removable |
| 81 // storage. Returns false if unable to find the device. | 86 // storage. Returns false if unable to find the device. |
| 82 virtual bool GetStorageInfoForPath( | 87 virtual bool GetStorageInfoForPath( |
| 83 const base::FilePath& path, | 88 const base::FilePath& path, |
| 84 StorageInfo* device_info) const = 0; | 89 StorageInfo* device_info) const = 0; |
| 85 | 90 |
| 86 // TODO(gbillock): make this either unnecessary (implementation-specific) or | 91 // TODO(gbillock): make this either unnecessary (implementation-specific) or |
| 87 // platform-independent. | 92 // platform-independent. |
| 88 #if defined(OS_WIN) | 93 #if defined(OS_WIN) |
| 89 // Gets the MTP device storage information specified by |storage_device_id|. | 94 // Gets the MTP device storage information specified by |storage_device_id|. |
| 90 // On success, returns true and fills in |device_location| with device | 95 // On success, returns true and fills in |device_location| with device |
| 91 // interface details and |storage_object_id| with the string ID that | 96 // interface details and |storage_object_id| with the string ID that |
| 92 // uniquely identifies the object on the device. This ID need not be | 97 // uniquely identifies the object on the device. This ID need not be |
| 93 // persistent across sessions. | 98 // persistent across sessions. |
| 94 virtual bool GetMTPStorageInfoFromDeviceId( | 99 virtual bool GetMTPStorageInfoFromDeviceId( |
| 95 const std::string& storage_device_id, | 100 const std::string& storage_device_id, |
| 96 string16* device_location, | 101 string16* device_location, |
| 97 string16* storage_object_id) const = 0; | 102 string16* storage_object_id) const = 0; |
| 98 #endif | 103 #endif |
| 99 | 104 |
| 100 #if defined(OS_LINUX) | 105 #if defined(OS_LINUX) |
| 101 virtual device::MediaTransferProtocolManager* | 106 virtual device::MediaTransferProtocolManager* |
| 102 media_transfer_protocol_manager() = 0; | 107 media_transfer_protocol_manager() = 0; |
| 103 #endif | 108 #endif |
| 104 | 109 |
| 110 // Returns the meta information for all available storages on the system, | |
|
vandebo (ex-Chrome)
2013/05/28 20:00:29
This change should be done as a separate CL.
Hongbo Min
2013/05/29 01:05:38
OK. I will do that in a separate CL.
| |
| 111 // including fixed and removable storage. It may return an empty vector | |
| 112 // if the storage metadata retrieval is not completed yet on FILE thread. | |
| 113 virtual std::vector<StorageInfo> GetAllAvailableStorages() const; | |
| 114 | |
| 105 // Returns information for attached removable storage. | 115 // Returns information for attached removable storage. |
| 106 std::vector<StorageInfo> GetAttachedStorage() const; | 116 std::vector<StorageInfo> GetAttachedStorage() const; |
| 107 | 117 |
| 108 void AddObserver(RemovableStorageObserver* obs); | 118 void AddObserver(RemovableStorageObserver* obs); |
| 109 void RemoveObserver(RemovableStorageObserver* obs); | 119 void RemoveObserver(RemovableStorageObserver* obs); |
| 110 | 120 |
| 111 std::string GetTransientIdForDeviceId(const std::string& device_id); | 121 std::string GetTransientIdForDeviceId(const std::string& device_id); |
| 112 std::string GetDeviceIdForTransientId(const std::string& transient_id) const; | 122 std::string GetDeviceIdForTransientId(const std::string& transient_id) const; |
| 113 | 123 |
| 114 virtual void EjectDevice( | 124 virtual void EjectDevice( |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 161 | 171 |
| 162 // Map of all the attached removable storage devices. | 172 // Map of all the attached removable storage devices. |
| 163 RemovableStorageMap storage_map_; | 173 RemovableStorageMap storage_map_; |
| 164 | 174 |
| 165 scoped_ptr<TransientDeviceIds> transient_device_ids_; | 175 scoped_ptr<TransientDeviceIds> transient_device_ids_; |
| 166 }; | 176 }; |
| 167 | 177 |
| 168 } // namespace chrome | 178 } // namespace chrome |
| 169 | 179 |
| 170 #endif // CHROME_BROWSER_STORAGE_MONITOR_STORAGE_MONITOR_H_ | 180 #endif // CHROME_BROWSER_STORAGE_MONITOR_STORAGE_MONITOR_H_ |
| OLD | NEW |