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

Side by Side Diff: chrome/browser/extensions/api/system_info_storage/storage_info_provider_mac.cc

Issue 16917011: mac: Replace base::mac::ScopedCFTypeRef with base::ScopedCFTypeRef. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: with fixed off-by-1 in git-clang-format Created 7 years, 6 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "chrome/browser/extensions/api/system_info_storage/storage_info_provide r.h" 5 #include "chrome/browser/extensions/api/system_info_storage/storage_info_provide r.h"
6 6
7 #include <CoreFoundation/CoreFoundation.h> 7 #include <CoreFoundation/CoreFoundation.h>
8 #include <IOKit/IOBSD.h> 8 #include <IOKit/IOBSD.h>
9 #include <IOKit/IOKitLib.h> 9 #include <IOKit/IOKitLib.h>
10 #include <IOKit/storage/IOMedia.h> 10 #include <IOKit/storage/IOMedia.h>
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 &media_iterator); 98 &media_iterator);
99 if (retval != KERN_SUCCESS) 99 if (retval != KERN_SUCCESS)
100 return; 100 return;
101 101
102 base::mac::ScopedIOObject<io_iterator_t> iterator(media_iterator); 102 base::mac::ScopedIOObject<io_iterator_t> iterator(media_iterator);
103 media_iterator = IO_OBJECT_NULL; 103 media_iterator = IO_OBJECT_NULL;
104 104
105 for (base::mac::ScopedIOObject<io_service_t> media(IOIteratorNext(iterator)); 105 for (base::mac::ScopedIOObject<io_service_t> media(IOIteratorNext(iterator));
106 media; 106 media;
107 media.reset(IOIteratorNext(iterator))) { 107 media.reset(IOIteratorNext(iterator))) {
108 base::mac::ScopedCFTypeRef<CFTypeRef> dev_path_cf( 108 base::ScopedCFTypeRef<CFTypeRef> dev_path_cf(
109 IORegistryEntryCreateCFProperty(media, 109 IORegistryEntryCreateCFProperty(
110 CFSTR(kIOBSDNameKey), 110 media, CFSTR(kIOBSDNameKey), kCFAllocatorDefault, 0));
111 kCFAllocatorDefault,
112 0));
113 111
114 if (!dev_path_cf) 112 if (!dev_path_cf)
115 continue; 113 continue;
116 114
117 std::string dev_path(_PATH_DEV); 115 std::string dev_path(_PATH_DEV);
118 dev_path.append( 116 dev_path.append(
119 base::SysCFStringRefToUTF8( 117 base::SysCFStringRefToUTF8(
120 base::mac::CFCast<CFStringRef>(dev_path_cf))); 118 base::mac::CFCast<CFStringRef>(dev_path_cf)));
121 119
122 base::mac::ScopedCFTypeRef<CFTypeRef> removable_cf( 120 base::ScopedCFTypeRef<CFTypeRef> removable_cf(
123 IORegistryEntryCreateCFProperty(media, 121 IORegistryEntryCreateCFProperty(
124 CFSTR(kIOMediaEjectableKey), 122 media, CFSTR(kIOMediaEjectableKey), kCFAllocatorDefault, 0));
125 kCFAllocatorDefault,
126 0));
127 if (!removable_cf) 123 if (!removable_cf)
128 dev_path_to_type_map_[dev_path] = systeminfo::kStorageTypeUnknown; 124 dev_path_to_type_map_[dev_path] = systeminfo::kStorageTypeUnknown;
129 else if (CFBooleanGetValue(base::mac::CFCast<CFBooleanRef>(removable_cf))) 125 else if (CFBooleanGetValue(base::mac::CFCast<CFBooleanRef>(removable_cf)))
130 dev_path_to_type_map_[dev_path] = systeminfo::kStorageTypeRemovable; 126 dev_path_to_type_map_[dev_path] = systeminfo::kStorageTypeRemovable;
131 else 127 else
132 dev_path_to_type_map_[dev_path] = systeminfo::kStorageTypeFixed; 128 dev_path_to_type_map_[dev_path] = systeminfo::kStorageTypeFixed;
133 } 129 }
134 } 130 }
135 131
136 } // namespace 132 } // namespace
137 133
138 // static 134 // static
139 StorageInfoProvider* StorageInfoProvider::Get() { 135 StorageInfoProvider* StorageInfoProvider::Get() {
140 return StorageInfoProvider::GetInstance<StorageInfoProviderMac>(); 136 return StorageInfoProvider::GetInstance<StorageInfoProviderMac>();
141 } 137 }
142 138
143 } // namespace extensions 139 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/api/music_manager_private/device_id_mac.cc ('k') | chrome/browser/mac/dock.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698