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 #ifndef CHROME_BROWSER_EXTENSIONS_API_IMAGE_WRITER_PRIVATE_REMOVABLE_STORAGE_PRO
VIDER_H_ | 4 #ifndef CHROME_BROWSER_EXTENSIONS_API_IMAGE_WRITER_PRIVATE_REMOVABLE_STORAGE_PRO
VIDER_H_ |
5 #define CHROME_BROWSER_EXTENSIONS_API_IMAGE_WRITER_PRIVATE_REMOVABLE_STORAGE_PRO
VIDER_H_ | 5 #define CHROME_BROWSER_EXTENSIONS_API_IMAGE_WRITER_PRIVATE_REMOVABLE_STORAGE_PRO
VIDER_H_ |
6 | 6 |
7 #include "base/callback.h" | 7 #include "base/callback.h" |
8 #include "chrome/common/extensions/api/image_writer_private.h" | 8 #include "chrome/common/extensions/api/image_writer_private.h" |
9 #include "chrome/common/ref_counted_util.h" | 9 #include "chrome/common/ref_counted_util.h" |
10 | 10 |
11 namespace extensions { | 11 namespace extensions { |
12 | 12 |
| 13 // TODO(haven): Clean up this class to remove refcounting. http://crbug/370590 |
| 14 |
13 typedef RefCountedVector<linked_ptr | 15 typedef RefCountedVector<linked_ptr |
14 <api::image_writer_private::RemovableStorageDevice> > StorageDeviceList; | 16 <api::image_writer_private::RemovableStorageDevice> > StorageDeviceList; |
15 | 17 |
16 // Abstraction for platform specific implementations of listing removable | 18 // Abstraction for platform specific implementations of listing removable |
17 // storage devices | 19 // storage devices |
18 class RemovableStorageProvider { | 20 class RemovableStorageProvider { |
19 public: | 21 public: |
20 typedef base::Callback<void(scoped_refptr<StorageDeviceList>, bool)> | 22 typedef base::Callback<void(scoped_refptr<StorageDeviceList>, bool)> |
21 DeviceListReadyCallback; | 23 DeviceListReadyCallback; |
| 24 |
| 25 // Gets the list of all available devices and returns it via callback. |
22 static void GetAllDevices(DeviceListReadyCallback callback); | 26 static void GetAllDevices(DeviceListReadyCallback callback); |
23 #if defined(OS_LINUX) | 27 |
24 static bool GetDevicesOnFileThread(scoped_refptr<StorageDeviceList>); | 28 // Sets the list of devices that will be returned by GetAllDevices during |
25 #endif | 29 // testing. All calls to |GetAllDevices| will return this list until |
| 30 // |ClearDeviceListForTesting| is called. |
| 31 static void SetDeviceListForTesting( |
| 32 scoped_refptr<StorageDeviceList> device_list); |
| 33 // Clears the list of devices that is used during testing. |
| 34 static void ClearDeviceListForTesting(); |
| 35 |
| 36 private: |
| 37 // Fills the provided empty device list with the available devices. |
| 38 static bool PopulateDeviceList(scoped_refptr<StorageDeviceList> device_list); |
26 }; | 39 }; |
27 | 40 |
28 } // namespace extensions | 41 } // namespace extensions |
29 | 42 |
30 #endif // CHROME_BROWSER_EXTENSIONS_API_IMAGE_WRITER_PRIVATE_REMOVABLE_STORAGE_
PROVIDER_H_ | 43 #endif // CHROME_BROWSER_EXTENSIONS_API_IMAGE_WRITER_PRIVATE_REMOVABLE_STORAGE_
PROVIDER_H_ |
OLD | NEW |