Chromium Code Reviews| Index: chrome/browser/system_monitor/image_capture_device_manager.mm |
| diff --git a/chrome/browser/system_monitor/image_capture_device_manager.mm b/chrome/browser/system_monitor/image_capture_device_manager.mm |
| index dda843ef851f9d52e4cca5acbf4678bf678986ee..fb2fd6570c3efdbcecc20e67343bc5fcb6829ed2 100644 |
| --- a/chrome/browser/system_monitor/image_capture_device_manager.mm |
| +++ b/chrome/browser/system_monitor/image_capture_device_manager.mm |
| @@ -7,8 +7,6 @@ |
| #import <ImageCaptureCore/ImageCaptureCore.h> |
| #include "base/file_util.h" |
| -#include "base/system_monitor/system_monitor.h" |
| -#include "chrome/browser/system_monitor/disk_info_mac.h" |
| #import "chrome/browser/system_monitor/image_capture_device.h" |
| #include "chrome/browser/system_monitor/media_storage_util.h" |
| #include "content/public/browser/browser_thread.h" |
| @@ -22,21 +20,25 @@ chrome::ImageCaptureDeviceManager* g_image_capture_device_manager = NULL; |
| // This class is the surface for the Mac ICDeviceBrowser ImageCaptureCore API. |
| // Owned by the ChromeBrowserParts and has browser process lifetime. Upon |
| // creation, it gets a list of attached media volumes (asynchronously) which |
| -// it will eventually forward to the SystemMonitor as removable storage |
| -// notifications. It will also set up an ImageCaptureCore listener to be |
| -// told when new devices/volumes are discovered and existing ones are removed. |
| +// it will eventually forward to RemovableStorageNotifications. It will also |
| +// set up an ImageCaptureCore listener to be told when new devices/volumes |
| +// are discovered and existing ones are removed. |
| @interface ImageCaptureDeviceManagerImpl |
| : NSObject<ICDeviceBrowserDelegate> { |
| @private |
| scoped_nsobject<ICDeviceBrowser> deviceBrowser_; |
| scoped_nsobject<NSMutableArray> cameras_; |
| + |
| + // Weak pointer |
|
vandebo (ex-Chrome)
2013/01/31 23:51:29
Not a weak pointer, instead say that it is guarant
Greg Billock
2013/02/01 18:28:42
Done.
|
| + chrome::RemovableStorageNotifications::Receiver* notifications_; |
| } |
| +- (void)setNotifications:(chrome::RemovableStorageNotifications::Receiver* |
| + notifications); |
| - (void)close; |
| -// The UUIDs passed here are available in the device attach notifications |
| -// given through SystemMonitor. They're gotten by cracking the device ID |
| -// and taking the unique ID output. |
| +// The UUIDs passed here are available in the device attach notifications. |
| +// They're gotten by cracking the device ID and taking the unique ID output. |
| - (ImageCaptureDevice*)deviceForUUID:(const std::string&)uuid; |
| @end |
| @@ -57,6 +59,11 @@ chrome::ImageCaptureDeviceManager* g_image_capture_device_manager = NULL; |
| return self; |
| } |
| +- (void)setNotifications:(chrome::RemovableStorageNotifications::Receiver* |
| + notifications) { |
| + notifications_ = notifications; |
| +} |
| + |
| - (void)close { |
| [deviceBrowser_ setDelegate:nil]; |
| [deviceBrowser_ stop]; |
| @@ -87,11 +94,11 @@ chrome::ImageCaptureDeviceManager* g_image_capture_device_manager = NULL; |
| [cameras_ addObject:addedDevice]; |
| // TODO(gbillock): use [cameraDevice mountPoint] here when possible. |
| - base::SystemMonitor::Get()->ProcessRemovableStorageAttached( |
| + notifications_->ProcessAttach(RemovableStorageNotifications::StorageInfo( |
| chrome::MediaStorageUtil::MakeDeviceId( |
| chrome::MediaStorageUtil::MAC_IMAGE_CAPTURE, |
| base::SysNSStringToUTF8([cameraDevice UUIDString])), |
| - base::SysNSStringToUTF16([cameraDevice name]), ""); |
| + base::SysNSStringToUTF16([cameraDevice name]), "")); |
| } |
| - (void)deviceBrowser:(ICDeviceBrowser*)browser |
| @@ -105,7 +112,7 @@ chrome::ImageCaptureDeviceManager* g_image_capture_device_manager = NULL; |
| // May delete |device|. |
| [cameras_ removeObject:device]; |
| - base::SystemMonitor::Get()->ProcessRemovableStorageDetached( |
| + notifications_->ProcessDetach( |
| chrome::MediaStorageUtil::MakeDeviceId( |
| chrome::MediaStorageUtil::MAC_IMAGE_CAPTURE, uuid)); |
| } |
| @@ -124,6 +131,11 @@ ImageCaptureDeviceManager::~ImageCaptureDeviceManager() { |
| [device_browser_ close]; |
| } |
| +void ImageCaptureDeviceManager::SetNotifications( |
| + RemovableStorageNotifications::Receiver* notifications) { |
| + [device_browser_ setNotifications:notifications]; |
| +} |
| + |
| // static |
| ImageCaptureDevice* ImageCaptureDeviceManager::deviceForUUID( |
| const std::string& uuid) { |