Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(21)

Side by Side Diff: components/storage_monitor/volume_mount_watcher_win.cc

Issue 1410333006: Enough hacks to make wstring printfs unneeded (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 // Don't try to eject if the path isn't a simple one -- we're not 230 // Don't try to eject if the path isn't a simple one -- we're not
231 // sure how to do that yet. Need to figure out how to eject volumes mounted 231 // sure how to do that yet. Need to figure out how to eject volumes mounted
232 // at not-just-drive-letter paths. 232 // at not-just-drive-letter paths.
233 if (drive_letter < L'A' || drive_letter > L'Z' || 233 if (drive_letter < L'A' || drive_letter > L'Z' ||
234 device != device.DirName()) { 234 device != device.DirName()) {
235 BrowserThread::PostTask( 235 BrowserThread::PostTask(
236 BrowserThread::UI, FROM_HERE, 236 BrowserThread::UI, FROM_HERE,
237 base::Bind(callback, StorageMonitor::EJECT_FAILURE)); 237 base::Bind(callback, StorageMonitor::EJECT_FAILURE));
238 return; 238 return;
239 } 239 }
240 base::SStringPrintf(&volume_name, L"\\\\.\\%lc:", drive_letter); 240 // safe
241 //base::SStringPrintf(&volume_name, L"\\\\.\\%lc:", drive_letter);
241 242
242 base::win::ScopedHandle volume_handle(CreateFile( 243 base::win::ScopedHandle volume_handle(CreateFile(
243 volume_name.c_str(), 244 volume_name.c_str(),
244 GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, 245 GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE,
245 NULL, OPEN_EXISTING, 0, NULL)); 246 NULL, OPEN_EXISTING, 0, NULL));
246 247
247 if (!volume_handle.IsValid()) { 248 if (!volume_handle.IsValid()) {
248 BrowserThread::PostTask( 249 BrowserThread::PostTask(
249 BrowserThread::UI, FROM_HERE, 250 BrowserThread::UI, FROM_HERE,
250 base::Bind(callback, StorageMonitor::EJECT_FAILURE)); 251 base::Bind(callback, StorageMonitor::EJECT_FAILURE));
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after
544 callback.Run(StorageMonitor::EJECT_FAILURE); 545 callback.Run(StorageMonitor::EJECT_FAILURE);
545 return; 546 return;
546 } 547 }
547 548
548 device_info_task_runner_->PostTask( 549 device_info_task_runner_->PostTask(
549 FROM_HERE, base::Bind(&EjectDeviceInThreadPool, device, callback, 550 FROM_HERE, base::Bind(&EjectDeviceInThreadPool, device, callback,
550 device_info_task_runner_, 0)); 551 device_info_task_runner_, 0));
551 } 552 }
552 553
553 } // namespace storage_monitor 554 } // namespace storage_monitor
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698