| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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 "components/storage_monitor/storage_monitor_mac.h" | 5 #include "components/storage_monitor/storage_monitor_mac.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include "base/mac/foundation_util.h" | 9 #include "base/mac/foundation_util.h" |
| 10 #include "base/mac/mac_util.h" | 10 #include "base/mac/mac_util.h" |
| (...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 313 // Get the reference to the full disk for ejecting. | 313 // Get the reference to the full disk for ejecting. |
| 314 disk.reset(DADiskCopyWholeDisk(disk)); | 314 disk.reset(DADiskCopyWholeDisk(disk)); |
| 315 if (!disk.get()) { | 315 if (!disk.get()) { |
| 316 callback.Run(StorageMonitor::EJECT_FAILURE); | 316 callback.Run(StorageMonitor::EJECT_FAILURE); |
| 317 return; | 317 return; |
| 318 } | 318 } |
| 319 | 319 |
| 320 EjectDiskOptions* options = new EjectDiskOptions; | 320 EjectDiskOptions* options = new EjectDiskOptions; |
| 321 options->bsd_name = bsd_name; | 321 options->bsd_name = bsd_name; |
| 322 options->callback = callback; | 322 options->callback = callback; |
| 323 options->disk.reset(disk.release()); | 323 options->disk = std::move(disk); |
| 324 content::BrowserThread::PostTask(content::BrowserThread::UI, FROM_HERE, | 324 content::BrowserThread::PostTask(content::BrowserThread::UI, FROM_HERE, |
| 325 base::Bind(EjectDisk, options)); | 325 base::Bind(EjectDisk, options)); |
| 326 } | 326 } |
| 327 | 327 |
| 328 // static | 328 // static |
| 329 void StorageMonitorMac::DiskAppearedCallback(DADiskRef disk, void* context) { | 329 void StorageMonitorMac::DiskAppearedCallback(DADiskRef disk, void* context) { |
| 330 StorageMonitorMac* monitor = static_cast<StorageMonitorMac*>(context); | 330 StorageMonitorMac* monitor = static_cast<StorageMonitorMac*>(context); |
| 331 monitor->GetDiskInfoAndUpdate(disk, UPDATE_DEVICE_ADDED); | 331 monitor->GetDiskInfoAndUpdate(disk, UPDATE_DEVICE_ADDED); |
| 332 } | 332 } |
| 333 | 333 |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 382 } | 382 } |
| 383 } | 383 } |
| 384 return false; | 384 return false; |
| 385 } | 385 } |
| 386 | 386 |
| 387 StorageMonitor* StorageMonitor::CreateInternal() { | 387 StorageMonitor* StorageMonitor::CreateInternal() { |
| 388 return new StorageMonitorMac(); | 388 return new StorageMonitorMac(); |
| 389 } | 389 } |
| 390 | 390 |
| 391 } // namespace storage_monitor | 391 } // namespace storage_monitor |
| OLD | NEW |