| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_MEDIA_GALLERIES_WIN_PORTABLE_DEVICE_MAP_SERVICE_H_ | 5 #ifndef CHROME_BROWSER_MEDIA_GALLERIES_WIN_PORTABLE_DEVICE_MAP_SERVICE_H_ |
| 6 #define CHROME_BROWSER_MEDIA_GALLERIES_WIN_PORTABLE_DEVICE_MAP_SERVICE_H_ | 6 #define CHROME_BROWSER_MEDIA_GALLERIES_WIN_PORTABLE_DEVICE_MAP_SERVICE_H_ |
| 7 | 7 |
| 8 #include <portabledeviceapi.h> | 8 #include <portabledeviceapi.h> |
| 9 #include <map> | 9 #include <map> |
| 10 | 10 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 // Called on a blocking pool thread. | 41 // Called on a blocking pool thread. |
| 42 void RemovePortableDevice(const base::string16& device_location); | 42 void RemovePortableDevice(const base::string16& device_location); |
| 43 | 43 |
| 44 // Gets the IPortableDevice interface associated with the device specified | 44 // Gets the IPortableDevice interface associated with the device specified |
| 45 // by the |device_location|. Returns NULL if the |device_location| is no | 45 // by the |device_location|. Returns NULL if the |device_location| is no |
| 46 // longer valid (e.g. the corresponding device is detached etc). | 46 // longer valid (e.g. the corresponding device is detached etc). |
| 47 // Called on a blocking pool thread. | 47 // Called on a blocking pool thread. |
| 48 IPortableDevice* GetPortableDevice(const base::string16& device_location); | 48 IPortableDevice* GetPortableDevice(const base::string16& device_location); |
| 49 | 49 |
| 50 private: | 50 private: |
| 51 friend struct base::DefaultLazyInstanceTraits<PortableDeviceMapService>; | 51 friend struct base::LazyInstanceTraitsBase<PortableDeviceMapService>; |
| 52 | 52 |
| 53 struct PortableDeviceInfo { | 53 struct PortableDeviceInfo { |
| 54 PortableDeviceInfo(); // Necessary for STL. | 54 PortableDeviceInfo(); // Necessary for STL. |
| 55 explicit PortableDeviceInfo(IPortableDevice* device); | 55 explicit PortableDeviceInfo(IPortableDevice* device); |
| 56 ~PortableDeviceInfo(); | 56 ~PortableDeviceInfo(); |
| 57 | 57 |
| 58 // The portable device interface. | 58 // The portable device interface. |
| 59 base::win::ScopedComPtr<IPortableDevice> portable_device; | 59 base::win::ScopedComPtr<IPortableDevice> portable_device; |
| 60 | 60 |
| 61 // Set to true if the |portable_device| is marked for deletion. | 61 // Set to true if the |portable_device| is marked for deletion. |
| 62 bool scheduled_to_delete; | 62 bool scheduled_to_delete; |
| 63 }; | 63 }; |
| 64 | 64 |
| 65 typedef std::map<const base::string16, PortableDeviceInfo> PortableDeviceMap; | 65 typedef std::map<const base::string16, PortableDeviceInfo> PortableDeviceMap; |
| 66 | 66 |
| 67 // Get access to this class using GetInstance() method. | 67 // Get access to this class using GetInstance() method. |
| 68 PortableDeviceMapService(); | 68 PortableDeviceMapService(); |
| 69 ~PortableDeviceMapService(); | 69 ~PortableDeviceMapService(); |
| 70 | 70 |
| 71 // Mapping of |device_location| and IPortableDevice* object. | 71 // Mapping of |device_location| and IPortableDevice* object. |
| 72 PortableDeviceMap device_map_; | 72 PortableDeviceMap device_map_; |
| 73 base::Lock lock_; | 73 base::Lock lock_; |
| 74 | 74 |
| 75 DISALLOW_COPY_AND_ASSIGN(PortableDeviceMapService); | 75 DISALLOW_COPY_AND_ASSIGN(PortableDeviceMapService); |
| 76 }; | 76 }; |
| 77 | 77 |
| 78 #endif // CHROME_BROWSER_MEDIA_GALLERIES_WIN_PORTABLE_DEVICE_MAP_SERVICE_H_ | 78 #endif // CHROME_BROWSER_MEDIA_GALLERIES_WIN_PORTABLE_DEVICE_MAP_SERVICE_H_ |
| OLD | NEW |