1 // Copyright 2014 The Chromium Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef COMPONENTS_STORAGE_MONITOR_IMAGE_CAPTURE_DEVICE_MANAGER_H_
6 #define COMPONENTS_STORAGE_MONITOR_IMAGE_CAPTURE_DEVICE_MANAGER_H_
8 #import <Foundation/Foundation.h>
12 #include "components/storage_monitor/storage_monitor.h"
14 class MTPDeviceDelegateImplMacTest;
16 @protocol ICDeviceBrowserDelegate;
17 @class ICDeviceBrowser;
18 @class ImageCaptureDevice;
19 @class ImageCaptureDeviceManagerImpl;
21 namespace storage_monitor {
23 // Upon creation, begins monitoring for any attached devices using the
24 // ImageCapture API. Notifies clients of the presence of such devices
25 // (i.e. cameras, USB cards) using the SystemMonitor and makes them
26 // available using |deviceForUUID|.
27 class ImageCaptureDeviceManager {
29 ImageCaptureDeviceManager();
30 ~ImageCaptureDeviceManager();
32 // The UUIDs passed here are available in the device attach notifications
33 // given through SystemMonitor. They're gotten by cracking the device ID
34 // and taking the unique ID output.
35 static ImageCaptureDevice* deviceForUUID(const std::string& uuid);
37 // Returns a weak pointer to the internal ImageCapture interface protocol.
38 id<ICDeviceBrowserDelegate> device_browser_delegate();
40 // Sets the receiver for device attach/detach notifications.
41 // TODO(gbillock): Move this to be a constructor argument.
42 void SetNotifications(StorageMonitor::Receiver* notifications);
44 // Eject the given device. The ID passed is not the device ID, but the
47 const std::string& uuid,
48 base::OnceCallback<void(StorageMonitor::EjectStatus)> callback);
51 ImageCaptureDeviceManagerImpl* __strong device_browser_;
53 // Returns a weak pointer to the internal device browser.
54 ICDeviceBrowser* device_browser_for_test();
55 friend class ImageCaptureDeviceManagerTest;
56 friend class ::MTPDeviceDelegateImplMacTest;
59 } // namespace storage_monitor
61 #endif // COMPONENTS_STORAGE_MONITOR_IMAGE_CAPTURE_DEVICE_MANAGER_H_