| Index: chrome/browser/storage_monitor/removable_device_notifications_mac.mm
|
| diff --git a/chrome/browser/storage_monitor/removable_device_notifications_mac.mm b/chrome/browser/storage_monitor/removable_device_notifications_mac.mm
|
| index d1027e45c3707fbccb2ed4130508a4cd5518ff51..0de47c8bd6d8829df4dea84ba22f5e7fc4ad1b85 100644
|
| --- a/chrome/browser/storage_monitor/removable_device_notifications_mac.mm
|
| +++ b/chrome/browser/storage_monitor/removable_device_notifications_mac.mm
|
| @@ -4,6 +4,8 @@
|
|
|
| #include "chrome/browser/storage_monitor/removable_device_notifications_mac.h"
|
|
|
| +#include "base/mac/mac_util.h"
|
| +#include "chrome/browser/storage_monitor/image_capture_device_manager.h"
|
| #include "chrome/browser/storage_monitor/media_device_notifications_utils.h"
|
| #include "content/public/browser/browser_thread.h"
|
|
|
| @@ -13,6 +15,9 @@ namespace {
|
|
|
| const char kDiskImageModelName[] = "Disk Image";
|
|
|
| +// TODO(gbillock): Make these take weak pointers and don't have
|
| +// RemovableDeviceNotificationsMac be ref counted.
|
| +
|
| void GetDiskInfoAndUpdateOnFileThread(
|
| const scoped_refptr<RemovableDeviceNotificationsMac>& notifications,
|
| base::mac::ScopedCFTypeRef<CFDictionaryRef> dict,
|
| @@ -47,10 +52,17 @@ void GetDiskInfoAndUpdate(
|
| } // namespace
|
|
|
| RemovableDeviceNotificationsMac::RemovableDeviceNotificationsMac() {
|
| - session_.reset(DASessionCreate(NULL));
|
| +}
|
|
|
| - DASessionScheduleWithRunLoop(
|
| - session_, CFRunLoopGetCurrent(), kCFRunLoopCommonModes);
|
| +RemovableDeviceNotificationsMac::~RemovableDeviceNotificationsMac() {
|
| + if (session_()) {
|
| + DASessionUnscheduleFromRunLoop(
|
| + session_, CFRunLoopGetCurrent(), kCFRunLoopCommonModes);
|
| + }
|
| +}
|
| +
|
| +void RemovableDeviceNotificationsMac::Init() {
|
| + session_.reset(DASessionCreate(NULL));
|
|
|
| // Register for callbacks for attached, changed, and removed devices.
|
| // This will send notifications for existing devices too.
|
| @@ -70,11 +82,14 @@ RemovableDeviceNotificationsMac::RemovableDeviceNotificationsMac() {
|
| kDADiskDescriptionWatchVolumePath,
|
| DiskDescriptionChangedCallback,
|
| this);
|
| -}
|
|
|
| -RemovableDeviceNotificationsMac::~RemovableDeviceNotificationsMac() {
|
| - DASessionUnscheduleFromRunLoop(
|
| + DASessionScheduleWithRunLoop(
|
| session_, CFRunLoopGetCurrent(), kCFRunLoopCommonModes);
|
| +
|
| + if (base::mac::IsOSLionOrLater()) {
|
| + image_capture_device_manager_.reset(new chrome::ImageCaptureDeviceManager);
|
| + image_capture_device_manager_->SetNotifications(receiver());
|
| + }
|
| }
|
|
|
| void RemovableDeviceNotificationsMac::UpdateDisk(
|
|
|