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/volume_mount_watcher_win.h" | 5 #include "components/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 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
336 device_info_worker_pool_->GetSequencedTaskRunnerWithShutdownBehavior( | 336 device_info_worker_pool_->GetSequencedTaskRunnerWithShutdownBehavior( |
337 device_info_worker_pool_->GetSequenceToken(), | 337 device_info_worker_pool_->GetSequenceToken(), |
338 base::SequencedWorkerPool::CONTINUE_ON_SHUTDOWN); | 338 base::SequencedWorkerPool::CONTINUE_ON_SHUTDOWN); |
339 } | 339 } |
340 | 340 |
341 // static | 341 // static |
342 base::FilePath VolumeMountWatcherWin::DriveNumberToFilePath(int drive_number) { | 342 base::FilePath VolumeMountWatcherWin::DriveNumberToFilePath(int drive_number) { |
343 if (drive_number < 0 || drive_number > 25) | 343 if (drive_number < 0 || drive_number > 25) |
344 return base::FilePath(); | 344 return base::FilePath(); |
345 base::string16 path(L"_:\\"); | 345 base::string16 path(L"_:\\"); |
346 path[0] = L'A' + drive_number; | 346 path[0] = static_cast<base::char16>('A' + drive_number); |
347 return base::FilePath(path); | 347 return base::FilePath(path); |
348 } | 348 } |
349 | 349 |
350 // In order to get all the weak pointers created on the UI thread, and doing | 350 // In order to get all the weak pointers created on the UI thread, and doing |
351 // synchronous Windows calls in the worker pool, this kicks off a chain of | 351 // synchronous Windows calls in the worker pool, this kicks off a chain of |
352 // events which will | 352 // events which will |
353 // a) Enumerate attached devices | 353 // a) Enumerate attached devices |
354 // b) Create weak pointers for which to send completion signals from | 354 // b) Create weak pointers for which to send completion signals from |
355 // c) Retrieve metadata on the volumes and then | 355 // c) Retrieve metadata on the volumes and then |
356 // d) Notify that metadata to listeners. | 356 // d) Notify that metadata to listeners. |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
547 callback.Run(StorageMonitor::EJECT_FAILURE); | 547 callback.Run(StorageMonitor::EJECT_FAILURE); |
548 return; | 548 return; |
549 } | 549 } |
550 | 550 |
551 task_runner_->PostTask( | 551 task_runner_->PostTask( |
552 FROM_HERE, | 552 FROM_HERE, |
553 base::Bind(&EjectDeviceInThreadPool, device, callback, task_runner_, 0)); | 553 base::Bind(&EjectDeviceInThreadPool, device, callback, task_runner_, 0)); |
554 } | 554 } |
555 | 555 |
556 } // namespace storage_monitor | 556 } // namespace storage_monitor |
OLD | NEW |