Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(192)

Side by Side Diff: chrome/browser/storage_monitor/storage_monitor.h

Issue 16186002: Refine StorageMonitor storage device getter (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 EJECT_FAILURE 60 EJECT_FAILURE
61 }; 61 };
62 62
63 // Returns a pointer to an object owned by the BrowserMainParts, with lifetime 63 // Returns a pointer to an object owned by the BrowserMainParts, with lifetime
64 // somewhat shorter than a process Singleton. 64 // somewhat shorter than a process Singleton.
65 static StorageMonitor* GetInstance(); 65 static StorageMonitor* GetInstance();
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 |GetAttachedRemovableStorages| 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 // Return true if the storage monitor has already been initialized. 76 // Return true if the storage monitor has already been initialized.
77 bool IsInitialized(); 77 bool IsInitialized();
78 78
79 // Finds the device that contains |path| and populates |device_info|. 79 // 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 80 // Should be able to handle any path on the local system, not just removable
(...skipping 14 matching lines...) Expand all
95 const std::string& storage_device_id, 95 const std::string& storage_device_id,
96 string16* device_location, 96 string16* device_location,
97 string16* storage_object_id) const = 0; 97 string16* storage_object_id) const = 0;
98 #endif 98 #endif
99 99
100 #if defined(OS_LINUX) 100 #if defined(OS_LINUX)
101 virtual device::MediaTransferProtocolManager* 101 virtual device::MediaTransferProtocolManager*
102 media_transfer_protocol_manager() = 0; 102 media_transfer_protocol_manager() = 0;
103 #endif 103 #endif
104 104
105 // Returns the meta information for all available storages on the system,
wrong vandebo 2013/05/29 15:16:16 We probably don't want to introduce a second metho
Greg Billock 2013/05/29 17:58:19 We've discussed making the method return all known
106 // including fixed and removable storage. It may return an empty vector
107 // if the storage metadata retrieval is not completed yet.
108 virtual std::vector<StorageInfo> GetAllAvailableStorages() const;
109
105 // Returns information for attached removable storage. 110 // Returns information for attached removable storage.
106 std::vector<StorageInfo> GetAttachedStorage() const; 111 std::vector<StorageInfo> GetAttachedRemovableStorages() const;
107 112
108 void AddObserver(RemovableStorageObserver* obs); 113 void AddObserver(RemovableStorageObserver* obs);
109 void RemoveObserver(RemovableStorageObserver* obs); 114 void RemoveObserver(RemovableStorageObserver* obs);
110 115
111 std::string GetTransientIdForDeviceId(const std::string& device_id); 116 std::string GetTransientIdForDeviceId(const std::string& device_id);
112 std::string GetDeviceIdForTransientId(const std::string& transient_id) const; 117 std::string GetDeviceIdForTransientId(const std::string& transient_id) const;
113 118
114 virtual void EjectDevice( 119 virtual void EjectDevice(
115 const std::string& device_id, 120 const std::string& device_id,
116 base::Callback<void(EjectStatus)> callback); 121 base::Callback<void(EjectStatus)> callback);
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 166
162 // Map of all the attached removable storage devices. 167 // Map of all the attached removable storage devices.
163 RemovableStorageMap storage_map_; 168 RemovableStorageMap storage_map_;
164 169
165 scoped_ptr<TransientDeviceIds> transient_device_ids_; 170 scoped_ptr<TransientDeviceIds> transient_device_ids_;
166 }; 171 };
167 172
168 } // namespace chrome 173 } // namespace chrome
169 174
170 #endif // CHROME_BROWSER_STORAGE_MONITOR_STORAGE_MONITOR_H_ 175 #endif // CHROME_BROWSER_STORAGE_MONITOR_STORAGE_MONITOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698