Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/storage_monitor/volume_mount_watcher_win.h" | 5 #include "chrome/browser/storage_monitor/volume_mount_watcher_win.h" |
| 6 | 6 |
| 7 #include <windows.h> | 7 #include <windows.h> |
| 8 | 8 |
| 9 #include <dbt.h> | 9 #include <dbt.h> |
| 10 #include <fileapi.h> | 10 #include <fileapi.h> |
| (...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 483 | 483 |
| 484 void VolumeMountWatcherWin::HandleDeviceAttachEventOnUIThread( | 484 void VolumeMountWatcherWin::HandleDeviceAttachEventOnUIThread( |
| 485 const base::FilePath& device_path, | 485 const base::FilePath& device_path, |
| 486 const StorageInfo& info) { | 486 const StorageInfo& info) { |
| 487 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 487 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 488 | 488 |
| 489 device_metadata_[device_path.value()] = info; | 489 device_metadata_[device_path.value()] = info; |
| 490 | 490 |
| 491 DeviceCheckComplete(device_path); | 491 DeviceCheckComplete(device_path); |
| 492 | 492 |
| 493 // Don't call removable storage observers for fixed volumes. | |
| 494 if (!StorageInfo::IsRemovableDevice(info.device_id())) | |
|
Hongbo Min
2013/06/04 02:52:29
Don't try to remove this if clause, otherwise, the
| |
| 495 return; | |
| 496 | |
| 497 if (notifications_) | 493 if (notifications_) |
| 498 notifications_->ProcessAttach(info); | 494 notifications_->ProcessAttach(info); |
| 499 } | 495 } |
| 500 | 496 |
| 501 void VolumeMountWatcherWin::HandleDeviceDetachEventOnUIThread( | 497 void VolumeMountWatcherWin::HandleDeviceDetachEventOnUIThread( |
| 502 const base::string16& device_location) { | 498 const base::string16& device_location) { |
| 503 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 499 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 504 | 500 |
| 505 MountPointDeviceMetadataMap::const_iterator device_info = | 501 MountPointDeviceMetadataMap::const_iterator device_info = |
| 506 device_metadata_.find(device_location); | 502 device_metadata_.find(device_location); |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 526 callback.Run(StorageMonitor::EJECT_FAILURE); | 522 callback.Run(StorageMonitor::EJECT_FAILURE); |
| 527 return; | 523 return; |
| 528 } | 524 } |
| 529 | 525 |
| 530 task_runner_->PostTask( | 526 task_runner_->PostTask( |
| 531 FROM_HERE, | 527 FROM_HERE, |
| 532 base::Bind(&EjectDeviceInThreadPool, device, callback, task_runner_, 0)); | 528 base::Bind(&EjectDeviceInThreadPool, device, callback, task_runner_, 0)); |
| 533 } | 529 } |
| 534 | 530 |
| 535 } // namespace chrome | 531 } // namespace chrome |
| OLD | NEW |