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_PORTABLE_DEVICE_WATCHER_WIN_H_ | 5 #ifndef CHROME_BROWSER_STORAGE_MONITOR_PORTABLE_DEVICE_WATCHER_WIN_H_ |
6 #define CHROME_BROWSER_STORAGE_MONITOR_PORTABLE_DEVICE_WATCHER_WIN_H_ | 6 #define CHROME_BROWSER_STORAGE_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 10 matching lines...) Expand all Loading... |
21 } | 21 } |
22 | 22 |
23 namespace chrome { | 23 namespace chrome { |
24 | 24 |
25 namespace test { | 25 namespace test { |
26 class TestPortableDeviceWatcherWin; | 26 class TestPortableDeviceWatcherWin; |
27 } | 27 } |
28 | 28 |
29 // This class watches the portable device mount points and sends notifications | 29 // This class watches the portable device mount points and sends notifications |
30 // about the attached/detached media transfer protocol (MTP) devices. | 30 // about the attached/detached media transfer protocol (MTP) devices. |
31 // This is a singleton class instantiated by | 31 // This is a singleton class instantiated by StorageMonitorWin. This class is |
32 // RemovableDeviceNotificationsWindowWin. This class is created, destroyed and | 32 // created, destroyed and operates on the UI thread, except for long running |
33 // operates on the UI thread, except for long running tasks it spins off to a | 33 // tasks it spins off to a SequencedTaskRunner. |
34 // SequencedTaskRunner. | |
35 class PortableDeviceWatcherWin { | 34 class PortableDeviceWatcherWin { |
36 public: | 35 public: |
37 typedef std::vector<string16> StorageObjectIDs; | 36 typedef std::vector<string16> StorageObjectIDs; |
38 | 37 |
39 struct DeviceStorageObject { | 38 struct DeviceStorageObject { |
40 DeviceStorageObject(const string16& temporary_id, | 39 DeviceStorageObject(const string16& temporary_id, |
41 const std::string& persistent_id); | 40 const std::string& persistent_id); |
42 | 41 |
43 // Storage object temporary identifier, e.g. "s10001". This string ID | 42 // Storage object temporary identifier, e.g. "s10001". This string ID |
44 // uniquely identifies the object on the device. This ID need not be | 43 // uniquely identifies the object on the device. This ID need not be |
(...skipping 19 matching lines...) Expand all Loading... |
64 StorageObjects storage_objects; | 63 StorageObjects storage_objects; |
65 }; | 64 }; |
66 typedef std::vector<DeviceDetails> Devices; | 65 typedef std::vector<DeviceDetails> Devices; |
67 | 66 |
68 // TODO(gbillock): Change to take the device notifications object as | 67 // TODO(gbillock): Change to take the device notifications object as |
69 // an argument. | 68 // an argument. |
70 PortableDeviceWatcherWin(); | 69 PortableDeviceWatcherWin(); |
71 virtual ~PortableDeviceWatcherWin(); | 70 virtual ~PortableDeviceWatcherWin(); |
72 | 71 |
73 // Must be called after the browser blocking pool is ready for use. | 72 // Must be called after the browser blocking pool is ready for use. |
74 // RemovableDeviceNotificationsWindowsWin::Init() will call this function. | 73 // StorageMonitorWin::Init() will call this function. |
75 void Init(HWND hwnd); | 74 void Init(HWND hwnd); |
76 | 75 |
77 // Processes DEV_BROADCAST_DEVICEINTERFACE messages and triggers a | 76 // Processes DEV_BROADCAST_DEVICEINTERFACE messages and triggers a |
78 // notification if appropriate. | 77 // notification if appropriate. |
79 void OnWindowMessage(UINT event_type, LPARAM data); | 78 void OnWindowMessage(UINT event_type, LPARAM data); |
80 | 79 |
81 // Gets the information of the MTP storage specified by |storage_device_id|. | 80 // Gets the information of the MTP storage specified by |storage_device_id|. |
82 // On success, returns true and fills in |device_location| with device | 81 // On success, returns true and fills in |device_location| with device |
83 // interface details and |storage_object_id| with storage object temporary | 82 // interface details and |storage_object_id| with storage object temporary |
84 // identifier. | 83 // identifier. |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 | 137 |
139 // The notifications object to use to signal newly attached devices. | 138 // The notifications object to use to signal newly attached devices. |
140 StorageMonitor::Receiver* storage_notifications_; | 139 StorageMonitor::Receiver* storage_notifications_; |
141 | 140 |
142 DISALLOW_COPY_AND_ASSIGN(PortableDeviceWatcherWin); | 141 DISALLOW_COPY_AND_ASSIGN(PortableDeviceWatcherWin); |
143 }; | 142 }; |
144 | 143 |
145 } // namespace chrome | 144 } // namespace chrome |
146 | 145 |
147 #endif // CHROME_BROWSER_STORAGE_MONITOR_PORTABLE_DEVICE_WATCHER_WIN_H_ | 146 #endif // CHROME_BROWSER_STORAGE_MONITOR_PORTABLE_DEVICE_WATCHER_WIN_H_ |
OLD | NEW |