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

Unified Diff: chrome/browser/extensions/api/image_writer_private/removable_storage_provider_mac.cc

Issue 375703004: Changes Mac removable device listing to include all attached USB drives. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixes minor style issues and documentation. 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/chrome_common.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/api/image_writer_private/removable_storage_provider_mac.cc
diff --git a/chrome/browser/extensions/api/image_writer_private/removable_storage_provider_mac.cc b/chrome/browser/extensions/api/image_writer_private/removable_storage_provider_mac.cc
index 67c8ab6a88eda0e900209772676b2f3373401ba7..a47c63cbc66aafc09434b75755702af438e63572 100644
--- a/chrome/browser/extensions/api/image_writer_private/removable_storage_provider_mac.cc
+++ b/chrome/browser/extensions/api/image_writer_private/removable_storage_provider_mac.cc
@@ -16,6 +16,7 @@
#include "base/mac/scoped_ioobject.h"
#include "base/strings/sys_string_conversions.h"
#include "base/threading/thread_restrictions.h"
+#include "chrome/common/extensions/image_writer/image_writer_util_mac.h"
namespace extensions {
@@ -23,11 +24,9 @@ namespace extensions {
bool RemovableStorageProvider::PopulateDeviceList(
scoped_refptr<StorageDeviceList> device_list) {
base::ThreadRestrictions::AssertIOAllowed();
- // Match only removable, ejectable, non-internal, whole disks.
+ // Match only writable whole-disks.
CFMutableDictionaryRef matching = IOServiceMatching(kIOMediaClass);
CFDictionaryAddValue(matching, CFSTR(kIOMediaWholeKey), kCFBooleanTrue);
- CFDictionaryAddValue(matching, CFSTR(kIOMediaEjectableKey), kCFBooleanTrue);
- CFDictionaryAddValue(matching, CFSTR(kIOMediaRemovableKey), kCFBooleanTrue);
CFDictionaryAddValue(matching, CFSTR(kIOMediaWritableKey), kCFBooleanTrue);
io_service_t disk_iterator;
@@ -60,6 +59,16 @@ bool RemovableStorageProvider::PopulateDeviceList(
if (size_number)
CFNumberGetValue(size_number, kCFNumberLongLongType, &size_in_bytes);
+ CFBooleanRef cf_removable = base::mac::GetValueFromDictionary<CFBooleanRef>(
+ dict, CFSTR(kIOMediaRemovableKey));
+ bool removable = CFBooleanGetValue(cf_removable);
+
+ bool is_usb = IsUsbDevice(disk_obj);
+
+ if (!removable && !is_usb) {
+ continue;
+ }
+
base::ScopedCFTypeRef<CFDictionaryRef> characteristics(
static_cast<CFDictionaryRef>(IORegistryEntrySearchCFProperty(
disk_obj,
« no previous file with comments | « no previous file | chrome/chrome_common.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698