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

Side by Side Diff: chrome/browser/system_monitor/portable_device_watcher_win.h

Issue 11297002: [Media Gallery] Added code to support mtp device media file system on Windows. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase + IWYU Created 7 years, 11 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 | Annotate | Revision Log
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_SYSTEM_MONITOR_PORTABLE_DEVICE_WATCHER_WIN_H_ 5 #ifndef CHROME_BROWSER_SYSTEM_MONITOR_PORTABLE_DEVICE_WATCHER_WIN_H_
6 #define CHROME_BROWSER_SYSTEM_MONITOR_PORTABLE_DEVICE_WATCHER_WIN_H_ 6 #define CHROME_BROWSER_SYSTEM_MONITOR_PORTABLE_DEVICE_WATCHER_WIN_H_
7 7
8 #include <portabledeviceapi.h> 8 #include <portabledeviceapi.h>
9 9
10 #include <map> 10 #include <map>
(...skipping 20 matching lines...) Expand all
31 // operates on the UI thread, except for long running tasks it spins off to a 31 // operates on the UI thread, except for long running tasks it spins off to a
32 // SequencedTaskRunner. 32 // SequencedTaskRunner.
33 class PortableDeviceWatcherWin { 33 class PortableDeviceWatcherWin {
34 public: 34 public:
35 typedef std::vector<string16> StorageObjectIDs; 35 typedef std::vector<string16> StorageObjectIDs;
36 36
37 struct DeviceStorageObject { 37 struct DeviceStorageObject {
38 DeviceStorageObject(const string16& temporary_id, 38 DeviceStorageObject(const string16& temporary_id,
39 const std::string& persistent_id); 39 const std::string& persistent_id);
40 40
41 // Storage object temporary identifier, e.g. "s10001". 41 // Storage object temporary identifier, e.g. "s10001". This string ID
42 // uniquely identifies the object on the device. This ID need not be
43 // persistent across sessions. This ID is obtained from WPD_OBJECT_ID
44 // property.
42 string16 object_temporary_id; 45 string16 object_temporary_id;
43 46
44 // Storage object persistent identifier, 47 // Storage object persistent identifier,
45 // e.g. "StorageSerial:<SID-{10001,D,31080448}>:<123456789>". 48 // e.g. "StorageSerial:<SID-{10001,D,31080448}>:<123456789>".
46 std::string object_persistent_id; 49 std::string object_persistent_id;
47 }; 50 };
48 typedef std::vector<DeviceStorageObject> StorageObjects; 51 typedef std::vector<DeviceStorageObject> StorageObjects;
49 52
50 // Struct to store attached MTP device details. 53 // Struct to store attached MTP device details.
51 struct DeviceDetails { 54 struct DeviceDetails {
(...skipping 12 matching lines...) Expand all
64 virtual ~PortableDeviceWatcherWin(); 67 virtual ~PortableDeviceWatcherWin();
65 68
66 // Must be called after the browser blocking pool is ready for use. 69 // Must be called after the browser blocking pool is ready for use.
67 // RemovableDeviceNotificationsWindowsWin::Init() will call this function. 70 // RemovableDeviceNotificationsWindowsWin::Init() will call this function.
68 void Init(HWND hwnd); 71 void Init(HWND hwnd);
69 72
70 // Processes DEV_BROADCAST_DEVICEINTERFACE messages and triggers a 73 // Processes DEV_BROADCAST_DEVICEINTERFACE messages and triggers a
71 // SystemMonitor notification if appropriate. 74 // SystemMonitor notification if appropriate.
72 void OnWindowMessage(UINT event_type, LPARAM data); 75 void OnWindowMessage(UINT event_type, LPARAM data);
73 76
77 // Gets the information of the MTP storage specified by |storage_device_id|.
78 // On success, returns true and fills in |device_location| with device
79 // interface details and |storage_object_id| with storage object temporary
80 // identifier.
81 bool GetMTPStorageInfoFromDeviceId(const std::string& storage_device_id,
82 string16* device_location,
83 string16* storage_object_id);
84
74 private: 85 private:
75 friend class TestPortableDeviceWatcherWin; 86 friend class TestPortableDeviceWatcherWin;
76 87
77 // Key: MTP device storage unique id. 88 // Key: MTP device storage unique id.
78 // Value: Metadata for the given storage. 89 // Value: Metadata for the given storage.
79 typedef std::map<std::string, base::SystemMonitor::RemovableStorageInfo> 90 typedef std::map<std::string, base::SystemMonitor::RemovableStorageInfo>
80 MTPStorageMap; 91 MTPStorageMap;
81 92
82 // Key: MTP device plug and play ID string. 93 // Key: MTP device plug and play ID string.
83 // Value: Vector of device storage objects. 94 // Value: Vector of device storage objects.
(...skipping 27 matching lines...) Expand all
111 122
112 // Used by |media_task_runner_| to create cancelable callbacks. 123 // Used by |media_task_runner_| to create cancelable callbacks.
113 base::WeakPtrFactory<PortableDeviceWatcherWin> weak_ptr_factory_; 124 base::WeakPtrFactory<PortableDeviceWatcherWin> weak_ptr_factory_;
114 125
115 DISALLOW_COPY_AND_ASSIGN(PortableDeviceWatcherWin); 126 DISALLOW_COPY_AND_ASSIGN(PortableDeviceWatcherWin);
116 }; 127 };
117 128
118 } // namespace chrome 129 } // namespace chrome
119 130
120 #endif // CHROME_BROWSER_SYSTEM_MONITOR_PORTABLE_DEVICE_WATCHER_WIN_H_ 131 #endif // CHROME_BROWSER_SYSTEM_MONITOR_PORTABLE_DEVICE_WATCHER_WIN_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698