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

Unified Diff: chrome/browser/system_monitor/media_transfer_protocol_device_observer_chromeos.h

Issue 10918259: [Chrome OS]Implement MediaStorageUtil::GetDeviceInfoForPath function to support media gallery permi… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: '' Created 8 years, 3 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/system_monitor/media_transfer_protocol_device_observer_chromeos.h
diff --git a/chrome/browser/system_monitor/media_transfer_protocol_device_observer_chromeos.h b/chrome/browser/system_monitor/media_transfer_protocol_device_observer_chromeos.h
index ab252eca6f157e08ecc7dd9b0b0c5de5a03a70b9..8fc9978d8eec46346cf3309086f52886aa22c972 100644
--- a/chrome/browser/system_monitor/media_transfer_protocol_device_observer_chromeos.h
+++ b/chrome/browser/system_monitor/media_transfer_protocol_device_observer_chromeos.h
@@ -9,8 +9,11 @@
#include <string>
#include "base/string16.h"
+#include "base/system_monitor/system_monitor.h"
#include "chrome/browser/chromeos/mtp/media_transfer_protocol_manager.h"
+class FilePath;
+
namespace chromeos {
namespace mtp {
@@ -26,9 +29,18 @@ typedef void (*GetStorageInfoFunc)(const std::string& storage_name,
class MediaTransferProtocolDeviceObserverCros
: public MediaTransferProtocolManager::Observer {
public:
+ // Should only be called by browser start up code. Use GetInstance() instead.
MediaTransferProtocolDeviceObserverCros();
+ static MediaTransferProtocolDeviceObserverCros* GetInstance();
Lei Zhang 2012/09/16 00:17:05 nit: don't put this between the ctor and dtor.
kmadhusu 2012/09/16 22:35:42 Done.
+
virtual ~MediaTransferProtocolDeviceObserverCros();
+ // Finds the storage that contains |path| and populates |storage_info|.
+ // Returns false if unable to find the storage.
+ bool GetStorageInfoForPath(
+ const FilePath& path,
+ base::SystemMonitor::RemovableStorageInfo* storage_info) const;
+
protected:
// Only used in unit tests.
explicit MediaTransferProtocolDeviceObserverCros(
@@ -40,14 +52,29 @@ class MediaTransferProtocolDeviceObserverCros
const std::string& storage_name) OVERRIDE;
private:
- // Mapping of storage name and device id.
- typedef std::map<std::string, std::string> StorageNameToIdMap;
+ // Structure to save attached storage information such as id, name and root
+ // path.
+ struct StorageInfo {
Lei Zhang 2012/09/16 00:17:05 hey, this looks familiar.
kmadhusu 2012/09/16 22:35:42 :)
+ StorageInfo();
vandebo (ex-Chrome) 2012/09/16 00:31:44 You can omit the default constructor when you have
kmadhusu 2012/09/16 22:35:42 Done.
+
+ // Unique storage Id (e.g. "VendorModelVolumeStorage:FFFF:0FFF:D:65537")
+ std::string id;
+
+ // Storage Name (e.g. "usb:2,2:65537")
+ string16 name;
+
+ // Storage root path (e.g. "/usb:2,2:65537")
+ std::string location;
+ };
+
+ // Mapping of storage location and StorageInfo object
+ typedef std::map<std::string, StorageInfo> StorageLocationToInfoMap;
// Enumerate existing mtp storage devices.
void EnumerateStorages();
// Map of all attached mtp devices.
- StorageNameToIdMap storage_map_;
+ StorageLocationToInfoMap storage_map_;
// Function handler to get storage information. This is useful to set a mock
// handler for unit testing.

Powered by Google App Engine
This is Rietveld 408576698