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

Side by Side Diff: chrome/common/extensions/image_writer/image_writer_util_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 unified diff | Download patch
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "chrome/common/extensions/image_writer/image_writer_util_mac.h"
6
7 #include <CoreFoundation/CoreFoundation.h>
8
9 #include "base/mac/scoped_cftyperef.h"
10 #include "base/mac/scoped_ioobject.h"
11
12 namespace extensions {
13
14 bool IsUsbDevice(io_object_t disk_obj) {
15 io_object_t current_obj = disk_obj;
16 io_object_t parent_obj = 0;
17 // Keep scoped object outside the loop so the object lives to the next
18 // GetParentEntry.
19 base::mac::ScopedIOObject<io_object_t> parent_obj_ref(parent_obj);
20
21 while ((IORegistryEntryGetParentEntry(
22 current_obj, kIOServicePlane, &parent_obj)) == KERN_SUCCESS) {
23 current_obj = parent_obj;
24 parent_obj_ref.reset(parent_obj);
25
26 base::ScopedCFTypeRef<CFStringRef> class_name(
27 IOObjectCopyClass(current_obj));
28 if (!class_name) {
29 LOG(ERROR) << "Could not get object class of IO Registry Entry.";
30 continue;
31 }
32
33 if (CFStringCompare(class_name.get(), CFSTR("IOUSBMassStorageClass"), 0) ==
34 kCFCompareEqualTo) {
35 return true;
36 }
37 }
38
39 return false;
40 }
41
42 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/common/extensions/image_writer/image_writer_util_mac.h ('k') | chrome/utility/image_writer/image_writer_mac.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698