1 // Copyright 2014 The Chromium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #ifndef COMPONENTS_STORAGE_MONITOR_IMAGE_CAPTURE_DEVICE_MANAGER_H_ 6 #define COMPONENTS_STORAGE_MONITOR_IMAGE_CAPTURE_DEVICE_MANAGER_H_ 7 8 #import <Foundation/Foundation.h> 9 #include <string> 10 11 #include "base/mac/scoped_nsobject.h" 12 #include "components/storage_monitor/storage_monitor.h" 13 14 @protocol ICDeviceBrowserDelegate; 15 @class ImageCaptureDevice; 16 @class ImageCaptureDeviceManagerImpl; 17 18 namespace storage_monitor { 19 20 // Upon creation, begins monitoring for any attached devices using the 21 // ImageCapture API. Notifies clients of the presence of such devices 22 // (i.e. cameras, USB cards) using the SystemMonitor and makes them 23 // available using |deviceForUUID|. 24 class ImageCaptureDeviceManager { 25 public: 26 ImageCaptureDeviceManager(); 27 ~ImageCaptureDeviceManager(); 28 29 // The UUIDs passed here are available in the device attach notifications 30 // given through SystemMonitor. They're gotten by cracking the device ID 31 // and taking the unique ID output. 32 static ImageCaptureDevice* deviceForUUID(const std::string& uuid); 33 34 // Returns a weak pointer to the internal ImageCapture interface protocol. 35 id<ICDeviceBrowserDelegate> device_browser(); 36 37 // Sets the receiver for device attach/detach notifications. 38 // TODO(gbillock): Move this to be a constructor argument. 39 void SetNotifications(StorageMonitor::Receiver* notifications); 40 41 // Eject the given device. The ID passed is not the device ID, but the 42 // ImageCapture UUID. 43 void EjectDevice(const std::string& uuid, 44 base::Callback<void(StorageMonitor::EjectStatus)> callback); 45 46 private: 47 base::scoped_nsobject<ImageCaptureDeviceManagerImpl> device_browser_; 48 }; 49 50 } // namespace storage_monitor 51 52 #endif // COMPONENTS_STORAGE_MONITOR_IMAGE_CAPTURE_DEVICE_MANAGER_H_ 53