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

Side by Side Diff: chrome/utility/image_writer/image_writer_win.cc

Issue 382023002: Changes Windows removable drive listing to include all USB drives. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Cleans up some more unnecessary changes, no really, and uses an enum instead of int for the USB Bus… Created 6 years, 5 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
« no previous file with comments | « chrome/browser/extensions/api/image_writer_private/removable_storage_provider_win.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <windows.h> 5 #include <windows.h>
6 #include <setupapi.h> 6 #include <setupapi.h>
7 #include <winioctl.h> 7 #include <winioctl.h>
8 8
9 #include "chrome/utility/image_writer/error_messages.h" 9 #include "chrome/utility/image_writer/error_messages.h"
10 #include "chrome/utility/image_writer/image_writer.h" 10 #include "chrome/utility/image_writer/image_writer.h"
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 NULL); // Optional unused overlapped perameter. 45 NULL); // Optional unused overlapped perameter.
46 46
47 if (!status) { 47 if (!status) {
48 PLOG(ERROR) << "Storage property query failed"; 48 PLOG(ERROR) << "Storage property query failed";
49 return false; 49 return false;
50 } 50 }
51 51
52 STORAGE_DEVICE_DESCRIPTOR* device_descriptor = 52 STORAGE_DEVICE_DESCRIPTOR* device_descriptor =
53 reinterpret_cast<STORAGE_DEVICE_DESCRIPTOR*>(output_buf.get()); 53 reinterpret_cast<STORAGE_DEVICE_DESCRIPTOR*>(output_buf.get());
54 54
55 return device_descriptor->RemovableMedia == TRUE; 55 return device_descriptor->RemovableMedia == TRUE ||
56 device_descriptor->BusType == BusTypeUsb;
56 } 57 }
57 58
58 bool ImageWriter::OpenDevice() { 59 bool ImageWriter::OpenDevice() {
59 // Windows requires that device files be opened with FILE_FLAG_NO_BUFFERING 60 // Windows requires that device files be opened with FILE_FLAG_NO_BUFFERING
60 // and FILE_FLAG_WRITE_THROUGH. These two flags are not part of base::File. 61 // and FILE_FLAG_WRITE_THROUGH. These two flags are not part of base::File.
61 device_file_ = 62 device_file_ =
62 base::File(CreateFile(device_path_.value().c_str(), 63 base::File(CreateFile(device_path_.value().c_str(),
63 GENERIC_READ | GENERIC_WRITE, 64 GENERIC_READ | GENERIC_WRITE,
64 FILE_SHARE_READ | FILE_SHARE_WRITE, 65 FILE_SHARE_READ | FILE_SHARE_WRITE,
65 NULL, 66 NULL,
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 190
190 if (volume_finder != INVALID_HANDLE_VALUE) { 191 if (volume_finder != INVALID_HANDLE_VALUE) {
191 FindVolumeClose(volume_finder); 192 FindVolumeClose(volume_finder);
192 } 193 }
193 194
194 if (success) 195 if (success)
195 continuation.Run(); 196 continuation.Run();
196 } 197 }
197 198
198 } // namespace image_writer 199 } // namespace image_writer
OLDNEW
« no previous file with comments | « chrome/browser/extensions/api/image_writer_private/removable_storage_provider_win.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698