| Index: chrome/browser/system_monitor/volume_mount_watcher_win.cc
|
| diff --git a/chrome/browser/system_monitor/volume_mount_watcher_win.cc b/chrome/browser/system_monitor/volume_mount_watcher_win.cc
|
| index 8653499038028cdf7ac3c5775298b2df7dfb082c..0a27ac8452ce44d844592eba36d01e9789ee17ea 100644
|
| --- a/chrome/browser/system_monitor/volume_mount_watcher_win.cc
|
| +++ b/chrome/browser/system_monitor/volume_mount_watcher_win.cc
|
| @@ -141,7 +141,8 @@ const char* kWorkerPoolNamePrefix = "DeviceInfoPool";
|
| VolumeMountWatcherWin::VolumeMountWatcherWin()
|
| : device_info_worker_pool_(new base::SequencedWorkerPool(
|
| kWorkerPoolNumThreads, kWorkerPoolNamePrefix)),
|
| - weak_factory_(this) {
|
| + weak_factory_(this),
|
| + notifications_(NULL) {
|
| get_attached_devices_callback_ = base::Bind(&GetAttachedDevices);
|
| get_device_details_callback_ = base::Bind(&GetDeviceDetails);
|
| }
|
| @@ -301,6 +302,11 @@ void VolumeMountWatcherWin::OnWindowMessage(UINT event_type, LPARAM data) {
|
| }
|
| }
|
|
|
| +void VolumeMountWatcherWin::SetNotifications(
|
| + RemovableStorageNotifications::Receiver* notifications) {
|
| + notifications_ = notifications;
|
| +}
|
| +
|
| VolumeMountWatcherWin::~VolumeMountWatcherWin() {
|
| weak_factory_.InvalidateWeakPtrs();
|
| }
|
| @@ -319,12 +325,10 @@ void VolumeMountWatcherWin::HandleDeviceAttachEventOnUIThread(
|
| if (!info.removable)
|
| return;
|
|
|
| - RemovableStorageNotifications* notifications =
|
| - RemovableStorageNotifications::GetInstance();
|
| - if (notifications) {
|
| - string16 display_name = GetDisplayNameForDevice(0, info.name);
|
| - notifications->ProcessAttach(info.device_id, display_name,
|
| - device_path.value());
|
| + if (notifications_) {
|
| + string16 display_name = GetDisplayNameForDevice(0, device_name);
|
| + notifications_->ProcessAttach(info.device_id, display_name,
|
| + device_path.value());
|
| }
|
| }
|
|
|
| @@ -338,10 +342,8 @@ void VolumeMountWatcherWin::HandleDeviceDetachEventOnUIThread(
|
| if (device_info == device_metadata_.end())
|
| return;
|
|
|
| - RemovableStorageNotifications* notifications =
|
| - RemovableStorageNotifications::GetInstance();
|
| - if (notifications)
|
| - notifications->ProcessDetach(device_info->second.device_id);
|
| + if (notifications_)
|
| + notifications_->ProcessDetach(device_info->second.device_id);
|
| device_metadata_.erase(device_info);
|
| }
|
|
|
|
|