diff options
116 files changed, 463 insertions, 491 deletions
diff --git a/base/ios/device_util.mm b/base/ios/device_util.mm index 96968df..9600833 100644 --- a/base/ios/device_util.mm +++ b/base/ios/device_util.mm @@ -119,9 +119,9 @@ std::string GetMacAddress(const std::string& interface_name) { } std::string GetRandomId() { - base::mac::ScopedCFTypeRef<CFUUIDRef> - uuid_object(CFUUIDCreate(kCFAllocatorDefault)); - base::mac::ScopedCFTypeRef<CFStringRef> uuid_string( + base::ScopedCFTypeRef<CFUUIDRef> uuid_object( + CFUUIDCreate(kCFAllocatorDefault)); + base::ScopedCFTypeRef<CFStringRef> uuid_string( CFUUIDCreateString(kCFAllocatorDefault, uuid_object)); return base::SysCFStringRefToUTF8(uuid_string); } @@ -154,9 +154,9 @@ std::string GetDeviceIdentifier(const char* salt) { CC_SHA256([hash_data bytes], [hash_data length], hash); CFUUIDBytes* uuid_bytes = reinterpret_cast<CFUUIDBytes*>(hash); - base::mac::ScopedCFTypeRef<CFUUIDRef> - uuid_object(CFUUIDCreateFromUUIDBytes(kCFAllocatorDefault, *uuid_bytes)); - base::mac::ScopedCFTypeRef<CFStringRef> device_id( + base::ScopedCFTypeRef<CFUUIDRef> uuid_object( + CFUUIDCreateFromUUIDBytes(kCFAllocatorDefault, *uuid_bytes)); + base::ScopedCFTypeRef<CFStringRef> device_id( CFUUIDCreateString(kCFAllocatorDefault, uuid_object)); return base::SysCFStringRefToUTF8(device_id); } diff --git a/base/mac/foundation_util.mm b/base/mac/foundation_util.mm index 71e8942..1897b6f 100644 --- a/base/mac/foundation_util.mm +++ b/base/mac/foundation_util.mm @@ -383,9 +383,8 @@ std::ostream& operator<<(std::ostream& o, const CFStringRef string) { } std::ostream& operator<<(std::ostream& o, const CFErrorRef err) { - base::mac::ScopedCFTypeRef<CFStringRef> desc(CFErrorCopyDescription(err)); - base::mac::ScopedCFTypeRef<CFDictionaryRef> user_info( - CFErrorCopyUserInfo(err)); + base::ScopedCFTypeRef<CFStringRef> desc(CFErrorCopyDescription(err)); + base::ScopedCFTypeRef<CFDictionaryRef> user_info(CFErrorCopyUserInfo(err)); CFStringRef errorDesc = NULL; if (user_info.get()) { errorDesc = reinterpret_cast<CFStringRef>( diff --git a/base/mac/launch_services_util.cc b/base/mac/launch_services_util.cc index c24d864..0081500 100644 --- a/base/mac/launch_services_util.cc +++ b/base/mac/launch_services_util.cc @@ -25,7 +25,7 @@ bool OpenApplicationWithPath(const base::FilePath& bundle_path, std::vector<std::string> argv = command_line.argv(); int argc = argv.size(); - base::mac::ScopedCFTypeRef<CFMutableArrayRef> launch_args( + base::ScopedCFTypeRef<CFMutableArrayRef> launch_args( CFArrayCreateMutable(NULL, argc - 1, &kCFTypeArrayCallBacks)); if (!launch_args) { LOG(ERROR) << "CFArrayCreateMutable failed, size was " << argc; @@ -35,8 +35,7 @@ bool OpenApplicationWithPath(const base::FilePath& bundle_path, for (int i = 1; i < argc; ++i) { const std::string& arg(argv[i]); - base::mac::ScopedCFTypeRef<CFStringRef> arg_cf( - base::SysUTF8ToCFStringRef(arg)); + base::ScopedCFTypeRef<CFStringRef> arg_cf(base::SysUTF8ToCFStringRef(arg)); if (!arg_cf) { LOG(ERROR) << "base::SysUTF8ToCFStringRef failed for " << arg; return false; diff --git a/base/message_loop/message_pump_io_ios.cc b/base/message_loop/message_pump_io_ios.cc index 5868195..7b1e0f4 100644 --- a/base/message_loop/message_pump_io_ios.cc +++ b/base/message_loop/message_pump_io_ios.cc @@ -99,9 +99,9 @@ bool MessagePumpIOSForIO::WatchFileDescriptor( CFFileDescriptorRef fdref = controller->fdref_; if (fdref == NULL) { - base::mac::ScopedCFTypeRef<CFFileDescriptorRef> scoped_fdref( - CFFileDescriptorCreate(kCFAllocatorDefault, fd, false, HandleFdIOEvent, - &source_context)); + base::ScopedCFTypeRef<CFFileDescriptorRef> scoped_fdref( + CFFileDescriptorCreate( + kCFAllocatorDefault, fd, false, HandleFdIOEvent, &source_context)); if (scoped_fdref == NULL) { NOTREACHED() << "CFFileDescriptorCreate failed"; return false; @@ -110,10 +110,9 @@ bool MessagePumpIOSForIO::WatchFileDescriptor( CFFileDescriptorEnableCallBacks(scoped_fdref, callback_types); // TODO(wtc): what should the 'order' argument be? - base::mac::ScopedCFTypeRef<CFRunLoopSourceRef> scoped_fd_source( - CFFileDescriptorCreateRunLoopSource(kCFAllocatorDefault, - scoped_fdref, - 0)); + base::ScopedCFTypeRef<CFRunLoopSourceRef> scoped_fd_source( + CFFileDescriptorCreateRunLoopSource( + kCFAllocatorDefault, scoped_fdref, 0)); if (scoped_fd_source == NULL) { NOTREACHED() << "CFFileDescriptorCreateRunLoopSource failed"; return false; diff --git a/base/message_loop/message_pump_io_ios.h b/base/message_loop/message_pump_io_ios.h index 3aaf037..6596862b 100644 --- a/base/message_loop/message_pump_io_ios.h +++ b/base/message_loop/message_pump_io_ios.h @@ -81,7 +81,7 @@ class BASE_EXPORT MessagePumpIOSForIO : public MessagePumpNSRunLoop { bool is_persistent_; // false if this event is one-shot. base::mac::ScopedCFFileDescriptorRef fdref_; CFOptionFlags callback_types_; - base::mac::ScopedCFTypeRef<CFRunLoopSourceRef> fd_source_; + base::ScopedCFTypeRef<CFRunLoopSourceRef> fd_source_; scoped_refptr<MessagePumpIOSForIO> pump_; Watcher* watcher_; diff --git a/base/native_library_mac.mm b/base/native_library_mac.mm index 1134744..15f9e88 100644 --- a/base/native_library_mac.mm +++ b/base/native_library_mac.mm @@ -56,12 +56,11 @@ NativeLibrary LoadNativeLibrary(const base::FilePath& library_path, native_lib->objc_status = OBJC_UNKNOWN; return native_lib; } - base::mac::ScopedCFTypeRef<CFURLRef> url( - CFURLCreateFromFileSystemRepresentation( - kCFAllocatorDefault, - (const UInt8*)library_path.value().c_str(), - library_path.value().length(), - true)); + base::ScopedCFTypeRef<CFURLRef> url(CFURLCreateFromFileSystemRepresentation( + kCFAllocatorDefault, + (const UInt8*)library_path.value().c_str(), + library_path.value().length(), + true)); if (!url) return NULL; CFBundleRef bundle = CFBundleCreate(kCFAllocatorDefault, url.get()); @@ -103,9 +102,8 @@ void* GetFunctionPointerFromNativeLibrary(NativeLibrary library, // Get the function pointer using the right API for the type. if (library->type == BUNDLE) { - base::mac::ScopedCFTypeRef<CFStringRef> symbol_name( - CFStringCreateWithCString(kCFAllocatorDefault, name, - kCFStringEncodingUTF8)); + base::ScopedCFTypeRef<CFStringRef> symbol_name(CFStringCreateWithCString( + kCFAllocatorDefault, name, kCFStringEncodingUTF8)); function_pointer = CFBundleGetFunctionPointerForName(library->bundle, symbol_name); } else { diff --git a/base/strings/sys_string_conversions_mac.mm b/base/strings/sys_string_conversions_mac.mm index 3650e4ef..9479e78 100644 --- a/base/strings/sys_string_conversions_mac.mm +++ b/base/strings/sys_string_conversions_mac.mm @@ -78,14 +78,13 @@ static OutStringType STLStringToSTLStringWithEncodingsT( if (in_length == 0) return OutStringType(); - base::mac::ScopedCFTypeRef<CFStringRef> cfstring( - CFStringCreateWithBytesNoCopy(NULL, - reinterpret_cast<const UInt8*>(in.data()), - in_length * - sizeof(typename InStringType::value_type), - in_encoding, - false, - kCFAllocatorNull)); + base::ScopedCFTypeRef<CFStringRef> cfstring(CFStringCreateWithBytesNoCopy( + NULL, + reinterpret_cast<const UInt8*>(in.data()), + in_length * sizeof(typename InStringType::value_type), + in_encoding, + false, + kCFAllocatorNull)); if (!cfstring) return OutStringType(); diff --git a/base/time_mac.cc b/base/time_mac.cc index 883a35b..91e9864 100644 --- a/base/time_mac.cc +++ b/base/time_mac.cc @@ -139,8 +139,8 @@ Time Time::FromExploded(bool is_local, const Exploded& exploded) { date.month = exploded.month; date.year = exploded.year; - base::mac::ScopedCFTypeRef<CFTimeZoneRef> - time_zone(is_local ? CFTimeZoneCopySystem() : NULL); + base::ScopedCFTypeRef<CFTimeZoneRef> time_zone( + is_local ? CFTimeZoneCopySystem() : NULL); CFAbsoluteTime seconds = CFGregorianDateGetAbsoluteTime(date, time_zone) + kCFAbsoluteTimeIntervalSince1970; return Time(static_cast<int64>(seconds * kMicrosecondsPerSecond) + @@ -157,8 +157,8 @@ void Time::Explode(bool is_local, Exploded* exploded) const { kWindowsEpochDeltaSeconds - kCFAbsoluteTimeIntervalSince1970; - base::mac::ScopedCFTypeRef<CFTimeZoneRef> - time_zone(is_local ? CFTimeZoneCopySystem() : NULL); + base::ScopedCFTypeRef<CFTimeZoneRef> time_zone( + is_local ? CFTimeZoneCopySystem() : NULL); CFGregorianDate date = CFAbsoluteTimeGetGregorianDate(seconds, time_zone); // 1 = Monday, ..., 7 = Sunday. int cf_day_of_week = CFAbsoluteTimeGetDayOfWeek(seconds, time_zone); diff --git a/chrome/app/breakpad_mac.mm b/chrome/app/breakpad_mac.mm index 1a39ad5..2dcb50c 100644 --- a/chrome/app/breakpad_mac.mm +++ b/chrome/app/breakpad_mac.mm @@ -182,7 +182,7 @@ void InitCrashReporter() { if (is_browser) { // Since the configuration management infrastructure is possibly not // initialized when this code runs, read the policy preference directly. - base::mac::ScopedCFTypeRef<CFStringRef> key( + base::ScopedCFTypeRef<CFStringRef> key( base::SysUTF8ToCFStringRef(policy::key::kMetricsReportingEnabled)); Boolean key_valid; Boolean metrics_reporting_enabled = CFPreferencesGetAppBooleanValue(key, diff --git a/chrome/browser/extensions/api/file_system/file_system_api.cc b/chrome/browser/extensions/api/file_system/file_system_api.cc index 60bedd3..c0241cf 100644 --- a/chrome/browser/extensions/api/file_system/file_system_api.cc +++ b/chrome/browser/extensions/api/file_system/file_system_api.cc @@ -85,12 +85,8 @@ const int kWhitelistedPaths[] = { // Retrieves the localized display name for the base name of the given path. // If the path is not localized, this will just return the base name. std::string GetDisplayBaseName(const base::FilePath& path) { - base::mac::ScopedCFTypeRef<CFURLRef> url( - CFURLCreateFromFileSystemRepresentation( - NULL, - (const UInt8*)path.value().c_str(), - path.value().length(), - true)); + base::ScopedCFTypeRef<CFURLRef> url(CFURLCreateFromFileSystemRepresentation( + NULL, (const UInt8*)path.value().c_str(), path.value().length(), true)); if (!url) return path.BaseName().value(); diff --git a/chrome/browser/extensions/api/music_manager_private/device_id_mac.cc b/chrome/browser/extensions/api/music_manager_private/device_id_mac.cc index d768167..e66c0e2 100644 --- a/chrome/browser/extensions/api/music_manager_private/device_id_mac.cc +++ b/chrome/browser/extensions/api/music_manager_private/device_id_mac.cc @@ -46,20 +46,20 @@ std::string FindBSDNameOfSystemDisk() { std::string GetVolumeUUIDFromBSDName(const std::string& bsd_name) { const CFAllocatorRef allocator = NULL; - base::mac::ScopedCFTypeRef<DASessionRef> session(DASessionCreate(allocator)); + base::ScopedCFTypeRef<DASessionRef> session(DASessionCreate(allocator)); if (session.get() == NULL) { VLOG(1) << "Error creating DA Session."; return std::string(); } - base::mac::ScopedCFTypeRef<DADiskRef> disk( + base::ScopedCFTypeRef<DADiskRef> disk( DADiskCreateFromBSDName(allocator, session, bsd_name.c_str())); if (disk.get() == NULL) { VLOG(1) << "Error creating DA disk from BSD disk name."; return std::string(); } - base::mac::ScopedCFTypeRef<CFDictionaryRef> disk_description( + base::ScopedCFTypeRef<CFDictionaryRef> disk_description( DADiskCopyDescription(disk)); if (disk_description.get() == NULL) { VLOG(1) << "Error getting disk description."; @@ -74,7 +74,7 @@ std::string GetVolumeUUIDFromBSDName(const std::string& bsd_name) { return std::string(); } - base::mac::ScopedCFTypeRef<CFStringRef> volume_uuid_string( + base::ScopedCFTypeRef<CFStringRef> volume_uuid_string( CFUUIDCreateString(allocator, volume_uuid)); if (volume_uuid_string.get() == NULL) { VLOG(1) << "Error creating string from CSStringRef."; diff --git a/chrome/browser/extensions/api/system_info_storage/storage_info_provider_mac.cc b/chrome/browser/extensions/api/system_info_storage/storage_info_provider_mac.cc index 125152b..0041224 100644 --- a/chrome/browser/extensions/api/system_info_storage/storage_info_provider_mac.cc +++ b/chrome/browser/extensions/api/system_info_storage/storage_info_provider_mac.cc @@ -105,11 +105,9 @@ void StorageInfoProviderMac::BuildStorageTypeMap() { for (base::mac::ScopedIOObject<io_service_t> media(IOIteratorNext(iterator)); media; media.reset(IOIteratorNext(iterator))) { - base::mac::ScopedCFTypeRef<CFTypeRef> dev_path_cf( - IORegistryEntryCreateCFProperty(media, - CFSTR(kIOBSDNameKey), - kCFAllocatorDefault, - 0)); + base::ScopedCFTypeRef<CFTypeRef> dev_path_cf( + IORegistryEntryCreateCFProperty( + media, CFSTR(kIOBSDNameKey), kCFAllocatorDefault, 0)); if (!dev_path_cf) continue; @@ -119,11 +117,9 @@ void StorageInfoProviderMac::BuildStorageTypeMap() { base::SysCFStringRefToUTF8( base::mac::CFCast<CFStringRef>(dev_path_cf))); - base::mac::ScopedCFTypeRef<CFTypeRef> removable_cf( - IORegistryEntryCreateCFProperty(media, - CFSTR(kIOMediaEjectableKey), - kCFAllocatorDefault, - 0)); + base::ScopedCFTypeRef<CFTypeRef> removable_cf( + IORegistryEntryCreateCFProperty( + media, CFSTR(kIOMediaEjectableKey), kCFAllocatorDefault, 0)); if (!removable_cf) dev_path_to_type_map_[dev_path] = systeminfo::kStorageTypeUnknown; else if (CFBooleanGetValue(base::mac::CFCast<CFBooleanRef>(removable_cf))) diff --git a/chrome/browser/mac/dock.mm b/chrome/browser/mac/dock.mm index 51ac395..e55f4c8 100644 --- a/chrome/browser/mac/dock.mm +++ b/chrome/browser/mac/dock.mm @@ -47,7 +47,7 @@ NSString* const kDockFileDataKey = @"file-data"; // Foundation data types and returns an autoreleased NSDictionary. NSDictionary* NSURLCopyDictionary(NSURL* url) { CFURLRef url_cf = base::mac::NSToCFCast(url); - base::mac::ScopedCFTypeRef<CFPropertyListRef> property_list( + base::ScopedCFTypeRef<CFPropertyListRef> property_list( _CFURLCopyPropertyListRepresentation(url_cf)); CFDictionaryRef dictionary_cf = base::mac::CFCast<CFDictionaryRef>(property_list); @@ -65,7 +65,7 @@ NSDictionary* NSURLCopyDictionary(NSURL* url) { // on Foundation data types and returns an autoreleased NSURL. NSURL* NSURLCreateFromDictionary(NSDictionary* dictionary) { CFDictionaryRef dictionary_cf = base::mac::NSToCFCast(dictionary); - base::mac::ScopedCFTypeRef<CFURLRef> url_cf( + base::ScopedCFTypeRef<CFURLRef> url_cf( _CFURLCreateFromPropertyListRepresentation(NULL, dictionary_cf)); NSURL* url = base::mac::CFToNSCast(url_cf); diff --git a/chrome/browser/mac/install_from_dmg.mm b/chrome/browser/mac/install_from_dmg.mm index 56912db..ed64829 100644 --- a/chrome/browser/mac/install_from_dmg.mm +++ b/chrome/browser/mac/install_from_dmg.mm @@ -121,17 +121,15 @@ bool MediaResidesOnDiskImage(io_service_t media, std::string* image_path) { } if (image_path) { - base::mac::ScopedCFTypeRef<CFTypeRef> image_path_cftyperef( - IORegistryEntryCreateCFProperty(hdix_drive, - CFSTR("image-path"), - NULL, - 0)); + base::ScopedCFTypeRef<CFTypeRef> image_path_cftyperef( + IORegistryEntryCreateCFProperty( + hdix_drive, CFSTR("image-path"), NULL, 0)); if (!image_path_cftyperef) { LOG(ERROR) << "IORegistryEntryCreateCFProperty"; return true; } if (CFGetTypeID(image_path_cftyperef) != CFDataGetTypeID()) { - base::mac::ScopedCFTypeRef<CFStringRef> observed_type_cf( + base::ScopedCFTypeRef<CFStringRef> observed_type_cf( CFCopyTypeIDDescription(CFGetTypeID(image_path_cftyperef))); std::string observed_type; if (observed_type_cf) { @@ -516,7 +514,7 @@ struct SynchronousDACallbackData { run_loop_running(false) { } - base::mac::ScopedCFTypeRef<DADissenterRef> dissenter; + base::ScopedCFTypeRef<DADissenterRef> dissenter; bool callback_called; bool run_loop_running; @@ -605,13 +603,13 @@ bool SynchronousDADiskEject(DADiskRef disk, DADiskEjectOptions options) { } // namespace void EjectAndTrashDiskImage(const std::string& dmg_bsd_device_name) { - base::mac::ScopedCFTypeRef<DASessionRef> session(DASessionCreate(NULL)); + base::ScopedCFTypeRef<DASessionRef> session(DASessionCreate(NULL)); if (!session.get()) { LOG(ERROR) << "DASessionCreate"; return; } - base::mac::ScopedCFTypeRef<DADiskRef> disk( + base::ScopedCFTypeRef<DADiskRef> disk( DADiskCreateFromBSDName(NULL, session, dmg_bsd_device_name.c_str())); if (!disk.get()) { LOG(ERROR) << "DADiskCreateFromBSDName"; diff --git a/chrome/browser/mac/keychain_reauthorize.mm b/chrome/browser/mac/keychain_reauthorize.mm index 3e91511..24d046d 100644 --- a/chrome/browser/mac/keychain_reauthorize.mm +++ b/chrome/browser/mac/keychain_reauthorize.mm @@ -118,12 +118,10 @@ void KeychainReauthorize() { // use CSSM_DL_DB_RECORD_ALL_KEYS, but that doesn't work. // CSSM_DL_DB_RECORD_ANY (as used by SecurityTool's keychain-dump) does // work. - base::mac::ScopedCFTypeRef<SecKeychainSearchRef> search( - CrSKeychainSearchCreateFromAttributes(NULL, - CSSM_DL_DB_RECORD_ANY, - NULL)); + base::ScopedCFTypeRef<SecKeychainSearchRef> search( + CrSKeychainSearchCreateFromAttributes(NULL, CSSM_DL_DB_RECORD_ANY, NULL)); - base::mac::ScopedCFTypeRef<SecTrustedApplicationRef> this_application( + base::ScopedCFTypeRef<SecTrustedApplicationRef> this_application( CrSTrustedApplicationCreateFromPath(NULL)); std::vector<std::string> requirement_matches = @@ -178,9 +176,9 @@ namespace { std::string RequirementStringForApplication( SecTrustedApplicationRef application) { - base::mac::ScopedCFTypeRef<SecRequirementRef> requirement( + base::ScopedCFTypeRef<SecRequirementRef> requirement( CrSTrustedApplicationCopyRequirement(application)); - base::mac::ScopedCFTypeRef<CFStringRef> requirement_string_cf( + base::ScopedCFTypeRef<CFStringRef> requirement_string_cf( CrSRequirementCopyString(requirement, kSecCSDefaultFlags)); if (!requirement_string_cf) { return std::string(); @@ -298,7 +296,7 @@ std::vector<CrSKeychainItemAndAccess> KCSearchToKCItemsAndReauthorizedAccesses( SecTrustedApplicationRef this_application) { std::vector<CrSKeychainItemAndAccess> items_and_accesses; - base::mac::ScopedCFTypeRef<SecKeychainItemRef> item; + base::ScopedCFTypeRef<SecKeychainItemRef> item; while (item.reset(CrSKeychainSearchCopyNext(search)), item) { scoped_ptr<CrSKeychainItemAndAccess> item_and_access( KCItemToKCItemAndReauthorizedAccess(item, @@ -321,10 +319,8 @@ CrSKeychainItemAndAccess* KCItemToKCItemAndReauthorizedAccess( return NULL; } - base::mac::ScopedCFTypeRef<SecAccessRef> access( - CrSKeychainItemCopyAccess(item)); - base::mac::ScopedCFTypeRef<CFArrayRef> acl_list( - CrSAccessCopyACLList(access)); + base::ScopedCFTypeRef<SecAccessRef> access(CrSKeychainItemCopyAccess(item)); + base::ScopedCFTypeRef<CFArrayRef> acl_list(CrSAccessCopyACLList(access)); if (!acl_list) { return NULL; } @@ -444,7 +440,7 @@ void WriteKCItemsAndReauthorizedAccesses( void WriteKCItemAndReauthorizedAccess( const CrSKeychainItemAndAccess& item_and_reauthorized_access) { SecKeychainItemRef old_item = item_and_reauthorized_access.item(); - base::mac::ScopedCFTypeRef<SecKeychainRef> keychain( + base::ScopedCFTypeRef<SecKeychainRef> keychain( CrSKeychainItemCopyKeychain(old_item)); ScopedCrSKeychainItemAttributesAndData old_attributes_and_data( @@ -501,7 +497,7 @@ void WriteKCItemAndReauthorizedAccess( return; } - base::mac::ScopedCFTypeRef<SecKeychainItemRef> new_item( + base::ScopedCFTypeRef<SecKeychainItemRef> new_item( CrSKeychainItemCreateFromContent(new_attributes_and_data, keychain, item_and_reauthorized_access.access())); diff --git a/chrome/browser/mac/relauncher.cc b/chrome/browser/mac/relauncher.cc index 1f3db81..e69ad2f 100644 --- a/chrome/browser/mac/relauncher.cc +++ b/chrome/browser/mac/relauncher.cc @@ -294,7 +294,7 @@ int RelauncherMain(const content::MainFunctionParams& main_parameters) { // won't contain the argv[0] of the relauncher process, the // RelauncherTypeArg() at argv[1], kRelauncherArgSeparator, or the // executable path of the process to be launched. - base::mac::ScopedCFTypeRef<CFMutableArrayRef> relaunch_args( + base::ScopedCFTypeRef<CFMutableArrayRef> relaunch_args( CFArrayCreateMutable(NULL, argc - 4, &kCFTypeArrayCallBacks)); if (!relaunch_args) { LOG(ERROR) << "CFArrayCreateMutable"; @@ -335,7 +335,7 @@ int RelauncherMain(const content::MainFunctionParams& main_parameters) { relaunch_executable.assign(arg); seen_relaunch_executable = true; } else { - base::mac::ScopedCFTypeRef<CFStringRef> arg_cf( + base::ScopedCFTypeRef<CFStringRef> arg_cf( base::SysUTF8ToCFStringRef(arg)); if (!arg_cf) { LOG(ERROR) << "base::SysUTF8ToCFStringRef failed for " << arg; diff --git a/chrome/browser/mac/security_wrappers.h b/chrome/browser/mac/security_wrappers.h index 42a7801..173c130 100644 --- a/chrome/browser/mac/security_wrappers.h +++ b/chrome/browser/mac/security_wrappers.h @@ -45,8 +45,8 @@ class CrSKeychainItemAndAccess { SecAccessRef access() const { return access_; } private: - base::mac::ScopedCFTypeRef<SecKeychainItemRef> item_; - base::mac::ScopedCFTypeRef<SecAccessRef> access_; + base::ScopedCFTypeRef<SecKeychainItemRef> item_; + base::ScopedCFTypeRef<SecAccessRef> access_; }; // Holds the return value from CrSACLCopySimpleContents and an argument to @@ -56,8 +56,8 @@ struct CrSACLSimpleContents { CrSACLSimpleContents(); ~CrSACLSimpleContents(); - base::mac::ScopedCFTypeRef<CFArrayRef> application_list; - base::mac::ScopedCFTypeRef<CFStringRef> description; + base::ScopedCFTypeRef<CFArrayRef> application_list; + base::ScopedCFTypeRef<CFStringRef> description; CSSM_ACL_KEYCHAIN_PROMPT_SELECTOR prompt_selector; }; diff --git a/chrome/browser/policy/policy_loader_mac.cc b/chrome/browser/policy/policy_loader_mac.cc index 761a7a6..0cbb519 100644 --- a/chrome/browser/policy/policy_loader_mac.cc +++ b/chrome/browser/policy/policy_loader_mac.cc @@ -23,7 +23,7 @@ #include "policy/policy_constants.h" using base::mac::CFCast; -using base::mac::ScopedCFTypeRef; +using base::ScopedCFTypeRef; namespace policy { @@ -108,9 +108,9 @@ scoped_ptr<PolicyBundle> PolicyLoaderMac::Load() { bool policy_present = false; const PolicyDefinitionList::Entry* current; for (current = policy_list_->begin; current != policy_list_->end; ++current) { - base::mac::ScopedCFTypeRef<CFStringRef> name( + base::ScopedCFTypeRef<CFStringRef> name( base::SysUTF8ToCFStringRef(current->name)); - base::mac::ScopedCFTypeRef<CFPropertyListRef> value( + base::ScopedCFTypeRef<CFPropertyListRef> value( preferences_->CopyAppValue(name, kCFPreferencesCurrentApplication)); if (!value.get()) continue; @@ -234,7 +234,7 @@ void PolicyLoaderMac::LoadPolicyForComponent( if (!schema) return; - base::mac::ScopedCFTypeRef<CFStringRef> bundle_id( + base::ScopedCFTypeRef<CFStringRef> bundle_id( base::SysUTF8ToCFStringRef(bundle_id_string)); preferences_->AppSynchronize(bundle_id); @@ -246,9 +246,9 @@ void PolicyLoaderMac::LoadPolicyForComponent( for (PolicySchemaMap::const_iterator it = map->begin(); it != map->end(); ++it) { - base::mac::ScopedCFTypeRef<CFStringRef> pref_name( + base::ScopedCFTypeRef<CFStringRef> pref_name( base::SysUTF8ToCFStringRef(it->first)); - base::mac::ScopedCFTypeRef<CFPropertyListRef> value( + base::ScopedCFTypeRef<CFPropertyListRef> value( preferences_->CopyAppValue(pref_name, bundle_id)); if (!value.get()) continue; diff --git a/chrome/browser/policy/policy_loader_mac_unittest.cc b/chrome/browser/policy/policy_loader_mac_unittest.cc index a5b1f6a06..12c21bd 100644 --- a/chrome/browser/policy/policy_loader_mac_unittest.cc +++ b/chrome/browser/policy/policy_loader_mac_unittest.cc @@ -17,7 +17,7 @@ #include "policy/policy_constants.h" #include "testing/gtest/include/gtest/gtest.h" -using base::mac::ScopedCFTypeRef; +using base::ScopedCFTypeRef; namespace policy { diff --git a/chrome/browser/policy/preferences_mock_mac.h b/chrome/browser/policy/preferences_mock_mac.h index 02a4d92..0f6fef1 100644 --- a/chrome/browser/policy/preferences_mock_mac.h +++ b/chrome/browser/policy/preferences_mock_mac.h @@ -26,8 +26,8 @@ class MockPreferences : public MacPreferences { void AddTestItem(CFStringRef key, CFPropertyListRef value, bool is_forced); private: - base::mac::ScopedCFTypeRef<CFMutableDictionaryRef> values_; - base::mac::ScopedCFTypeRef<CFMutableSetRef> forced_; + base::ScopedCFTypeRef<CFMutableDictionaryRef> values_; + base::ScopedCFTypeRef<CFMutableSetRef> forced_; }; #endif // CHROME_BROWSER_POLICY_PREFERENCES_MOCK_MAC_H_ diff --git a/chrome/browser/search_engines/template_url_prepopulate_data.cc b/chrome/browser/search_engines/template_url_prepopulate_data.cc index 07438a9..c11718f 100644 --- a/chrome/browser/search_engines/template_url_prepopulate_data.cc +++ b/chrome/browser/search_engines/template_url_prepopulate_data.cc @@ -618,7 +618,7 @@ int GetCurrentCountryID() { #elif defined(OS_MACOSX) int GetCurrentCountryID() { - base::mac::ScopedCFTypeRef<CFLocaleRef> locale(CFLocaleCopyCurrent()); + base::ScopedCFTypeRef<CFLocaleRef> locale(CFLocaleCopyCurrent()); CFStringRef country = (CFStringRef)CFLocaleGetValue(locale.get(), kCFLocaleCountryCode); if (!country) diff --git a/chrome/browser/service/service_process_control_mac.mm b/chrome/browser/service/service_process_control_mac.mm index 5cd05d6..96c0e8b 100644 --- a/chrome/browser/service/service_process_control_mac.mm +++ b/chrome/browser/service/service_process_control_mac.mm @@ -14,7 +14,7 @@ using content::BrowserThread; void ServiceProcessControl::Launcher::DoRun() { - base::mac::ScopedCFTypeRef<CFDictionaryRef> launchd_plist( + base::ScopedCFTypeRef<CFDictionaryRef> launchd_plist( CreateServiceProcessLaunchdPlist(cmd_line_.get(), false)); CFErrorRef error = NULL; if (!GTMSMJobSubmit(launchd_plist, &error)) { diff --git a/chrome/browser/storage_monitor/storage_monitor_mac.h b/chrome/browser/storage_monitor/storage_monitor_mac.h index 383f089..e313119 100644 --- a/chrome/browser/storage_monitor/storage_monitor_mac.h +++ b/chrome/browser/storage_monitor/storage_monitor_mac.h @@ -58,7 +58,7 @@ class StorageMonitorMac : public StorageMonitor, bool FindDiskWithMountPoint(const base::FilePath& mount_point, StorageInfo* info) const; - base::mac::ScopedCFTypeRef<DASessionRef> session_; + base::ScopedCFTypeRef<DASessionRef> session_; // Maps disk bsd names to disk info objects. This map tracks all mountable // devices on the system, though only notifications for removable devices are // posted. diff --git a/chrome/browser/storage_monitor/storage_monitor_mac.mm b/chrome/browser/storage_monitor/storage_monitor_mac.mm index 9c5ca63..346f958 100644 --- a/chrome/browser/storage_monitor/storage_monitor_mac.mm +++ b/chrome/browser/storage_monitor/storage_monitor_mac.mm @@ -74,7 +74,7 @@ StorageInfo BuildStorageInfo( dict, kDADiskDescriptionVolumeUUIDKey); std::string unique_id; if (uuid) { - base::mac::ScopedCFTypeRef<CFStringRef> uuid_string( + base::ScopedCFTypeRef<CFStringRef> uuid_string( CFUUIDCreateString(NULL, uuid)); if (uuid_string.get()) unique_id = base::SysCFStringRefToUTF8(uuid_string); @@ -105,7 +105,7 @@ StorageInfo BuildStorageInfo( void GetDiskInfoAndUpdateOnFileThread( const base::WeakPtr<StorageMonitorMac>& monitor, - base::mac::ScopedCFTypeRef<CFDictionaryRef> dict, + base::ScopedCFTypeRef<CFDictionaryRef> dict, StorageMonitorMac::UpdateType update_type) { DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::FILE)); @@ -125,7 +125,7 @@ void GetDiskInfoAndUpdateOnFileThread( struct EjectDiskOptions { std::string bsd_name; base::Callback<void(StorageMonitor::EjectStatus)> callback; - base::mac::ScopedCFTypeRef<DADiskRef> disk; + base::ScopedCFTypeRef<DADiskRef> disk; }; void PostEjectCallback(DADiskRef disk, @@ -289,7 +289,7 @@ void StorageMonitorMac::EjectDevice( receiver()->ProcessDetach(device_id); - base::mac::ScopedCFTypeRef<DADiskRef> disk( + base::ScopedCFTypeRef<DADiskRef> disk( DADiskCreateFromBSDName(NULL, session_, bsd_name.c_str())); if (!disk.get()) { callback.Run(StorageMonitor::EJECT_FAILURE); @@ -337,7 +337,7 @@ void StorageMonitorMac::GetDiskInfoAndUpdate( pending_disk_updates_++; - base::mac::ScopedCFTypeRef<CFDictionaryRef> dict(DADiskCopyDescription(disk)); + base::ScopedCFTypeRef<CFDictionaryRef> dict(DADiskCopyDescription(disk)); content::BrowserThread::PostTask( content::BrowserThread::FILE, FROM_HERE, diff --git a/chrome/browser/ui/cocoa/animatable_image.mm b/chrome/browser/ui/cocoa/animatable_image.mm index 2d09bf0..d2fd2da 100644 --- a/chrome/browser/ui/cocoa/animatable_image.mm +++ b/chrome/browser/ui/cocoa/animatable_image.mm @@ -130,7 +130,7 @@ // Sets the layer contents by converting the NSImage to a CGImageRef. This will // rasterize PDF resources. - (void)setLayerContents:(CALayer*)layer { - base::mac::ScopedCFTypeRef<CGImageRef> image( + base::ScopedCFTypeRef<CGImageRef> image( base::mac::CopyNSImageToCGImage(image_.get())); // Create the layer that will be animated. [layer setContents:(id)image.get()]; diff --git a/chrome/browser/ui/cocoa/certificate_viewer_mac.mm b/chrome/browser/ui/cocoa/certificate_viewer_mac.mm index 5fc37c5..0e66381 100644 --- a/chrome/browser/ui/cocoa/certificate_viewer_mac.mm +++ b/chrome/browser/ui/cocoa/certificate_viewer_mac.mm @@ -80,7 +80,7 @@ void ShowCertificateViewer(content::WebContents* web_contents, - (id)initWithCertificate:(net::X509Certificate*)certificate { if ((self = [super init])) { - base::mac::ScopedCFTypeRef<CFArrayRef> cert_chain( + base::ScopedCFTypeRef<CFArrayRef> cert_chain( certificate->CreateOSCertChainForCert()); NSArray* certificates = base::mac::CFToNSCast(cert_chain.get()); certificates_.reset([certificates retain]); @@ -110,7 +110,7 @@ void ShowCertificateViewer(content::WebContents* web_contents, // the certificate viewer UI from displaying which certificate is revoked. // This is acceptable, as certificate revocation will still be shown in // the page info bubble if a certificate in the chain is actually revoked. - base::mac::ScopedCFTypeRef<CFMutableArrayRef> policies( + base::ScopedCFTypeRef<CFMutableArrayRef> policies( CFArrayCreateMutable(kCFAllocatorDefault, 0, &kCFTypeArrayCallBacks)); if (!policies.get()) { NOTREACHED(); diff --git a/chrome/browser/ui/cocoa/ssl_client_certificate_selector_cocoa.h b/chrome/browser/ui/cocoa/ssl_client_certificate_selector_cocoa.h index 88d9b79..49b080c 100644 --- a/chrome/browser/ui/cocoa/ssl_client_certificate_selector_cocoa.h +++ b/chrome/browser/ui/cocoa/ssl_client_certificate_selector_cocoa.h @@ -24,7 +24,7 @@ class SSLClientAuthObserverCocoaBridge; : NSObject<ConstrainedWindowSheet> { @private // The list of identities offered to the user. - base::mac::ScopedCFTypeRef<CFMutableArrayRef> identities_; + base::ScopedCFTypeRef<CFMutableArrayRef> identities_; // The corresponding list of certificates. std::vector<scoped_refptr<net::X509Certificate> > certificates_; // A C++ object to bridge SSLClientAuthObserver notifications to us. diff --git a/chrome/browser/ui/cocoa/tabpose_window.h b/chrome/browser/ui/cocoa/tabpose_window.h index b2e0f28..0e5a007 100644 --- a/chrome/browser/ui/cocoa/tabpose_window.h +++ b/chrome/browser/ui/cocoa/tabpose_window.h @@ -54,8 +54,8 @@ class TabStripModelObserverBridge; CALayer* selectionHighlight_; // weak // Colors used by the layers. - base::mac::ScopedCFTypeRef<CGColorRef> gray_; - base::mac::ScopedCFTypeRef<CGColorRef> darkBlue_; + base::ScopedCFTypeRef<CGColorRef> gray_; + base::ScopedCFTypeRef<CGColorRef> darkBlue_; TabStripModel* tabStripModel_; // weak @@ -77,7 +77,7 @@ class TabStripModelObserverBridge; scoped_ptr<TabStripModelObserverBridge> tabStripModelObserverBridge_; // The icon used for the closebutton layers. - base::mac::ScopedCFTypeRef<CGImageRef> closeIcon_; + base::ScopedCFTypeRef<CGImageRef> closeIcon_; // True if all close layers should be shown (as opposed to just the close // layer of the currently selected thumbnail). diff --git a/chrome/browser/ui/cocoa/tabpose_window.mm b/chrome/browser/ui/cocoa/tabpose_window.mm index 339abd7..3eb6cf2 100644 --- a/chrome/browser/ui/cocoa/tabpose_window.mm +++ b/chrome/browser/ui/cocoa/tabpose_window.mm @@ -89,11 +89,11 @@ const CGFloat kSelectionInset = 5; } - (void)drawInContext:(CGContextRef)context { - base::mac::ScopedCFTypeRef<CGColorSpaceRef> grayColorSpace( + base::ScopedCFTypeRef<CGColorSpaceRef> grayColorSpace( CGColorSpaceCreateWithName(kCGColorSpaceGenericGray)); CGFloat grays[] = { startGray_, 1.0, endGray_, 1.0 }; CGFloat locations[] = { 0, 1 }; - base::mac::ScopedCFTypeRef<CGGradientRef> gradient( + base::ScopedCFTypeRef<CGGradientRef> gradient( CGGradientCreateWithColorComponents( grayColorSpace.get(), grays, locations, arraysize(locations))); CGPoint topLeft = CGPointMake(0.0, self.bounds.size.height); @@ -120,7 +120,7 @@ class ThumbnailLoader; // If the backing store couldn't be used and a thumbnail was returned from a // renderer process, it's stored in |thumbnail_|. - base::mac::ScopedCFTypeRef<CGImageRef> thumbnail_; + base::ScopedCFTypeRef<CGImageRef> thumbnail_; // True if the layer already sent a thumbnail request to a renderer. BOOL didSendLoad_; @@ -1031,7 +1031,7 @@ void AnimateCALayerOpacityFromTo( NSFont* font = [NSFont systemFontOfSize:tile.title_font_size()]; tile.set_font_metrics([font ascender], -[font descender]); - base::mac::ScopedCFTypeRef<CGImageRef> favicon( + base::ScopedCFTypeRef<CGImageRef> favicon( base::mac::CopyNSImageToCGImage(tile.favicon())); CALayer* faviconLayer = [CALayer layer]; diff --git a/chrome/browser/ui/cocoa/tabs/tab_view.h b/chrome/browser/ui/cocoa/tabs/tab_view.h index 7f640d0..69d68d9 100644 --- a/chrome/browser/ui/cocoa/tabs/tab_view.h +++ b/chrome/browser/ui/cocoa/tabs/tab_view.h @@ -74,7 +74,7 @@ const CGFloat kImageNoFocusAlpha = 0.65; // A one-element mask image cache. This cache makes drawing roughly 16% // faster. - base::mac::ScopedCFTypeRef<CGImageRef> maskCache_; + base::ScopedCFTypeRef<CGImageRef> maskCache_; CGFloat maskCacheWidth_; CGFloat maskCacheScale_; } diff --git a/chrome/browser/ui/cocoa/tabs/tab_view.mm b/chrome/browser/ui/cocoa/tabs/tab_view.mm index 4312a9e..443f86b 100644 --- a/chrome/browser/ui/cocoa/tabs/tab_view.mm +++ b/chrome/browser/ui/cocoa/tabs/tab_view.mm @@ -667,7 +667,7 @@ const CGFloat kRapidCloseDist = 2.5; // Image masks must be in the DeviceGray colorspace. Create a context and // draw the mask into it. - base::mac::ScopedCFTypeRef<CGColorSpaceRef> colorspace( + base::ScopedCFTypeRef<CGColorSpaceRef> colorspace( CGColorSpaceCreateDeviceGray()); CGContextRef maskContext = CGBitmapContextCreate(NULL, tabWidth * scale, kMaskHeight * scale, diff --git a/chrome/browser/web_applications/web_app_mac.mm b/chrome/browser/web_applications/web_app_mac.mm index fa67351..6f72d47 100644 --- a/chrome/browser/web_applications/web_app_mac.mm +++ b/chrome/browser/web_applications/web_app_mac.mm @@ -533,7 +533,7 @@ bool WebAppShortcutCreator::UpdateInternalBundleIdentifier() const { base::FilePath WebAppShortcutCreator::GetAppBundleById( const std::string& bundle_id) const { - base::mac::ScopedCFTypeRef<CFStringRef> bundle_id_cf( + base::ScopedCFTypeRef<CFStringRef> bundle_id_cf( base::SysUTF8ToCFStringRef(bundle_id)); CFURLRef url_ref = NULL; OSStatus status = LSFindApplicationForInfo( @@ -541,7 +541,7 @@ base::FilePath WebAppShortcutCreator::GetAppBundleById( if (status != noErr) return base::FilePath(); - base::mac::ScopedCFTypeRef<CFURLRef> url(url_ref); + base::ScopedCFTypeRef<CFURLRef> url(url_ref); NSString* path_string = [base::mac::CFToNSCast(url.get()) path]; return base::FilePath([path_string fileSystemRepresentation]); } diff --git a/chrome/common/mac/cfbundle_blocker.mm b/chrome/common/mac/cfbundle_blocker.mm index a6cb6fe..e845283 100644 --- a/chrome/common/mac/cfbundle_blocker.mm +++ b/chrome/common/mac/cfbundle_blocker.mm @@ -156,7 +156,7 @@ Boolean ChromeCFBundleLoadExecutableAndReturnError(CFBundleRef bundle, DCHECK(g_original_underscore_cfbundle_load_executable_and_return_error); - base::mac::ScopedCFTypeRef<CFURLRef> url_cf(CFBundleCopyBundleURL(bundle)); + base::ScopedCFTypeRef<CFURLRef> url_cf(CFBundleCopyBundleURL(bundle)); scoped_nsobject<NSString> path(base::mac::CFToNSCast( CFURLCopyFileSystemPath(url_cf, kCFURLPOSIXPathStyle))); @@ -185,7 +185,7 @@ Boolean ChromeCFBundleLoadExecutableAndReturnError(CFBundleRef bundle, << [path fileSystemRepresentation]; if (error) { - base::mac::ScopedCFTypeRef<CFStringRef> app_bundle_id( + base::ScopedCFTypeRef<CFStringRef> app_bundle_id( base::SysUTF8ToCFStringRef(base::mac::BaseBundleID())); // 0xb10c10ad = "block load" diff --git a/chrome/common/mac/mock_launchd.cc b/chrome/common/mac/mock_launchd.cc index bc08bf8..6a39540 100644 --- a/chrome/common/mac/mock_launchd.cc +++ b/chrome/common/mac/mock_launchd.cc @@ -83,12 +83,12 @@ bool MockLaunchd::MakeABundle(const base::FilePath& dst, } const UInt8* bundle_root_path = reinterpret_cast<const UInt8*>(bundle_root->value().c_str()); - base::mac::ScopedCFTypeRef<CFURLRef> url( + base::ScopedCFTypeRef<CFURLRef> url( CFURLCreateFromFileSystemRepresentation(kCFAllocatorDefault, bundle_root_path, bundle_root->value().length(), true)); - base::mac::ScopedCFTypeRef<CFBundleRef> bundle( + base::ScopedCFTypeRef<CFBundleRef> bundle( CFBundleCreate(kCFAllocatorDefault, url)); return bundle.get(); } @@ -126,9 +126,8 @@ CFDictionaryRef MockLaunchd::CopyExports() { CFStringRef env_var = base::mac::NSToCFCast(GetServiceProcessLaunchDSocketEnvVar()); - base::mac::ScopedCFTypeRef<CFStringRef> socket_path( - CFStringCreateWithCString(kCFAllocatorDefault, pipe_name_.c_str(), - kCFStringEncodingUTF8)); + base::ScopedCFTypeRef<CFStringRef> socket_path(CFStringCreateWithCString( + kCFAllocatorDefault, pipe_name_.c_str(), kCFStringEncodingUTF8)); const void *keys[] = { env_var }; const void *values[] = { socket_path }; COMPILE_ASSERT(arraysize(keys) == arraysize(values), array_sizes_must_match); @@ -151,10 +150,10 @@ CFDictionaryRef MockLaunchd::CopyJobDictionary(CFStringRef label) { CFStringRef program = CFSTR(LAUNCH_JOBKEY_PROGRAM); CFStringRef program_pid = CFSTR(LAUNCH_JOBKEY_PID); const void *keys[] = { program, program_pid }; - base::mac::ScopedCFTypeRef<CFStringRef> path( + base::ScopedCFTypeRef<CFStringRef> path( base::SysUTF8ToCFStringRef(file_.value())); int process_id = base::GetCurrentProcId(); - base::mac::ScopedCFTypeRef<CFNumberRef> pid( + base::ScopedCFTypeRef<CFNumberRef> pid( CFNumberCreate(NULL, kCFNumberIntType, &process_id)); const void *values[] = { path, pid }; COMPILE_ASSERT(arraysize(keys) == arraysize(values), array_sizes_must_match); @@ -170,14 +169,11 @@ CFDictionaryRef MockLaunchd::CopyDictionaryByCheckingIn(CFErrorRef* error) { checkin_called_ = true; CFStringRef program = CFSTR(LAUNCH_JOBKEY_PROGRAM); CFStringRef program_args = CFSTR(LAUNCH_JOBKEY_PROGRAMARGUMENTS); - base::mac::ScopedCFTypeRef<CFStringRef> path( + base::ScopedCFTypeRef<CFStringRef> path( base::SysUTF8ToCFStringRef(file_.value())); const void *array_values[] = { path.get() }; - base::mac::ScopedCFTypeRef<CFArrayRef> args( - CFArrayCreate(kCFAllocatorDefault, - array_values, - 1, - &kCFTypeArrayCallBacks)); + base::ScopedCFTypeRef<CFArrayRef> args(CFArrayCreate( + kCFAllocatorDefault, array_values, 1, &kCFTypeArrayCallBacks)); if (!create_socket_) { const void *keys[] = { program, program_args }; @@ -210,7 +206,7 @@ CFDictionaryRef MockLaunchd::CopyDictionaryByCheckingIn(CFErrorRef* error) { signature.protocol = 0; size_t unix_addr_len = offsetof(struct sockaddr_un, sun_path) + path_len + 1; - base::mac::ScopedCFTypeRef<CFDataRef> address( + base::ScopedCFTypeRef<CFDataRef> address( CFDataCreate(NULL, reinterpret_cast<UInt8*>(&unix_addr), unix_addr_len)); signature.address = address; @@ -227,20 +223,17 @@ CFDictionaryRef MockLaunchd::CopyDictionaryByCheckingIn(CFErrorRef* error) { return NULL; } - base::mac::ScopedCFTypeRef<CFNumberRef> socket_fd( + base::ScopedCFTypeRef<CFNumberRef> socket_fd( CFNumberCreate(NULL, kCFNumberIntType, &local_pipe)); const void *socket_array_values[] = { socket_fd }; - base::mac::ScopedCFTypeRef<CFArrayRef> sockets( - CFArrayCreate(kCFAllocatorDefault, - socket_array_values, - 1, - &kCFTypeArrayCallBacks)); + base::ScopedCFTypeRef<CFArrayRef> sockets(CFArrayCreate( + kCFAllocatorDefault, socket_array_values, 1, &kCFTypeArrayCallBacks)); CFStringRef socket_dict_key = CFSTR("ServiceProcessSocket"); const void *socket_keys[] = { socket_dict_key }; const void *socket_values[] = { sockets }; COMPILE_ASSERT(arraysize(socket_keys) == arraysize(socket_values), socket_array_sizes_must_match); - base::mac::ScopedCFTypeRef<CFDictionaryRef> socket_dict( + base::ScopedCFTypeRef<CFDictionaryRef> socket_dict( CFDictionaryCreate(kCFAllocatorDefault, socket_keys, socket_values, @@ -277,8 +270,7 @@ CFMutableDictionaryRef MockLaunchd::CreatePlistFromFile( Domain domain, Type type, CFStringRef name) { - base::mac::ScopedCFTypeRef<CFDictionaryRef> dict( - CopyDictionaryByCheckingIn(NULL)); + base::ScopedCFTypeRef<CFDictionaryRef> dict(CopyDictionaryByCheckingIn(NULL)); return CFDictionaryCreateMutableCopy(kCFAllocatorDefault, 0, dict); } diff --git a/chrome/common/multi_process_lock_mac.cc b/chrome/common/multi_process_lock_mac.cc index 35fc576..176ae4c 100644 --- a/chrome/common/multi_process_lock_mac.cc +++ b/chrome/common/multi_process_lock_mac.cc @@ -33,7 +33,7 @@ class MultiProcessLockMac : public MultiProcessLock { } CFStringRef cf_name(base::SysUTF8ToCFStringRef(name_)); - base::mac::ScopedCFTypeRef<CFStringRef> scoped_cf_name(cf_name); + base::ScopedCFTypeRef<CFStringRef> scoped_cf_name(cf_name); port_.reset(CFMessagePortCreateLocal(NULL, cf_name, NULL, NULL, NULL)); return port_ != NULL; } @@ -48,7 +48,7 @@ class MultiProcessLockMac : public MultiProcessLock { private: std::string name_; - base::mac::ScopedCFTypeRef<CFMessagePortRef> port_; + base::ScopedCFTypeRef<CFMessagePortRef> port_; DISALLOW_COPY_AND_ASSIGN(MultiProcessLockMac); }; diff --git a/chrome/common/service_process_util_mac.mm b/chrome/common/service_process_util_mac.mm index 4848b80..03a6124 100644 --- a/chrome/common/service_process_util_mac.mm +++ b/chrome/common/service_process_util_mac.mm @@ -67,7 +67,7 @@ bool GetParentFSRef(const FSRef& child, FSRef* parent) { bool RemoveFromLaunchd() { // We're killing a file. base::ThreadRestrictions::AssertIOAllowed(); - base::mac::ScopedCFTypeRef<CFStringRef> name(CopyServiceProcessLaunchDName()); + base::ScopedCFTypeRef<CFStringRef> name(CopyServiceProcessLaunchDName()); return Launchd::GetInstance()->DeletePlist(Launchd::User, Launchd::Agent, name); @@ -295,8 +295,8 @@ bool ServiceProcessState::AddToAutoRun() { // We're creating directories and writing a file. base::ThreadRestrictions::AssertIOAllowed(); DCHECK(autorun_command_line_.get()); - base::mac::ScopedCFTypeRef<CFStringRef> name(CopyServiceProcessLaunchDName()); - base::mac::ScopedCFTypeRef<CFDictionaryRef> plist( + base::ScopedCFTypeRef<CFStringRef> name(CopyServiceProcessLaunchDName()); + base::ScopedCFTypeRef<CFDictionaryRef> plist( CreateServiceProcessLaunchdPlist(autorun_command_line_.get(), true)); return Launchd::GetInstance()->WritePlistToFile(Launchd::User, Launchd::Agent, @@ -358,10 +358,10 @@ void ExecFilePathWatcherCallback::NotifyPathChanged(const base::FilePath& path, if (GetParentFSRef(macos_fsref, &contents_fsref)) { FSRef bundle_fsref; if (GetParentFSRef(contents_fsref, &bundle_fsref)) { - base::mac::ScopedCFTypeRef<CFURLRef> bundle_url( + base::ScopedCFTypeRef<CFURLRef> bundle_url( CFURLCreateFromFSRef(kCFAllocatorDefault, &bundle_fsref)); if (bundle_url.get()) { - base::mac::ScopedCFTypeRef<CFBundleRef> bundle( + base::ScopedCFTypeRef<CFBundleRef> bundle( CFBundleCreate(kCFAllocatorDefault, bundle_url)); // Check to see if the bundle still has a minimal structure. good_bundle = CFBundleGetIdentifier(bundle) != NULL; @@ -394,13 +394,11 @@ void ExecFilePathWatcherCallback::NotifyPathChanged(const base::FilePath& path, } if (needs_shutdown || needs_restart) { // First deal with the plist. - base::mac::ScopedCFTypeRef<CFStringRef> name( - CopyServiceProcessLaunchDName()); + base::ScopedCFTypeRef<CFStringRef> name(CopyServiceProcessLaunchDName()); if (needs_restart) { - base::mac::ScopedCFTypeRef<CFMutableDictionaryRef> plist( - Launchd::GetInstance()->CreatePlistFromFile(Launchd::User, - Launchd::Agent, - name)); + base::ScopedCFTypeRef<CFMutableDictionaryRef> plist( + Launchd::GetInstance()->CreatePlistFromFile( + Launchd::User, Launchd::Agent, name)); if (plist.get()) { NSMutableDictionary* ns_plist = base::mac::CFToNSCast(plist); std::string new_path = base::mac::PathFromFSRef(executable_fsref_); @@ -445,7 +443,7 @@ void ExecFilePathWatcherCallback::NotifyPathChanged(const base::FilePath& path, base::mac::NSToCFCast(GetServiceProcessLaunchDLabel()); CFErrorRef err = NULL; if (!Launchd::GetInstance()->RemoveJob(label, &err)) { - base::mac::ScopedCFTypeRef<CFErrorRef> scoped_err(err); + base::ScopedCFTypeRef<CFErrorRef> scoped_err(err); DLOG(ERROR) << "RemoveJob " << err; // Exiting with zero, so launchd doesn't restart the process. exit(0); diff --git a/chrome/common/service_process_util_posix.h b/chrome/common/service_process_util_posix.h index 3d3533c..2f841bb 100644 --- a/chrome/common/service_process_util_posix.h +++ b/chrome/common/service_process_util_posix.h @@ -68,7 +68,7 @@ struct ServiceProcessState::StateData #if defined(OS_MACOSX) bool WatchExecutable(); - base::mac::ScopedCFTypeRef<CFDictionaryRef> launchd_conf_; + base::ScopedCFTypeRef<CFDictionaryRef> launchd_conf_; base::FilePathWatcher executable_watcher_; #endif // OS_MACOSX #if defined(OS_POSIX) && !defined(OS_MACOSX) diff --git a/chrome/plugin/chrome_content_plugin_client.cc b/chrome/plugin/chrome_content_plugin_client.cc index c6712ab1..f9f8f0c 100644 --- a/chrome/plugin/chrome_content_plugin_client.cc +++ b/chrome/plugin/chrome_content_plugin_client.cc @@ -55,14 +55,16 @@ void ChromeContentPluginClient::PreSandboxInitialization() { void ChromeContentPluginClient::PluginProcessStarted( const string16& plugin_name) { #if defined(OS_MACOSX) - base::mac::ScopedCFTypeRef<CFStringRef> cf_plugin_name( + base::ScopedCFTypeRef<CFStringRef> cf_plugin_name( base::SysUTF16ToCFStringRef(plugin_name)); - base::mac::ScopedCFTypeRef<CFStringRef> app_name( - base::SysUTF16ToCFStringRef( - l10n_util::GetStringUTF16(IDS_SHORT_PLUGIN_APP_NAME))); - base::mac::ScopedCFTypeRef<CFStringRef> process_name( - CFStringCreateWithFormat(kCFAllocatorDefault, NULL, CFSTR("%@ (%@)"), - cf_plugin_name.get(), app_name.get())); + base::ScopedCFTypeRef<CFStringRef> app_name(base::SysUTF16ToCFStringRef( + l10n_util::GetStringUTF16(IDS_SHORT_PLUGIN_APP_NAME))); + base::ScopedCFTypeRef<CFStringRef> process_name( + CFStringCreateWithFormat(kCFAllocatorDefault, + NULL, + CFSTR("%@ (%@)"), + cf_plugin_name.get(), + app_name.get())); base::mac::SetProcessName(process_name); #endif } diff --git a/chrome/service/chrome_service_application_mac.mm b/chrome/service/chrome_service_application_mac.mm index c60fa06..3b78059 100644 --- a/chrome/service/chrome_service_application_mac.mm +++ b/chrome/service/chrome_service_application_mac.mm @@ -21,16 +21,16 @@ + (void)submitPrint:(NSAppleEventDescriptor*)event { std::string silent = std::string("--") + switches::kNoStartupWindow; // Set up flag so that it can be passed along with the Apple Event. - base::mac::ScopedCFTypeRef<CFStringRef> silentLaunchFlag( + base::ScopedCFTypeRef<CFStringRef> silentLaunchFlag( base::SysUTF8ToCFStringRef(silent)); CFStringRef flags[] = { silentLaunchFlag }; // Argv array that will be passed. - base::mac::ScopedCFTypeRef<CFArrayRef> passArgv( - CFArrayCreate(NULL, (const void**) flags, 1, &kCFTypeArrayCallBacks)); + base::ScopedCFTypeRef<CFArrayRef> passArgv( + CFArrayCreate(NULL, (const void**)flags, 1, &kCFTypeArrayCallBacks)); FSRef ref; // Get Chrome's bundle ID. std::string bundleID = base::mac::BaseBundleID(); - base::mac::ScopedCFTypeRef<CFStringRef> bundleIDCF( + base::ScopedCFTypeRef<CFStringRef> bundleIDCF( base::SysUTF8ToCFStringRef(bundleID)); // Use Launch Services to locate Chrome using its bundleID. OSStatus status = LSFindApplicationForInfo(kLSUnknownCreator, bundleIDCF, diff --git a/chrome/test/chromedriver/keycode_text_conversion_mac.mm b/chrome/test/chromedriver/keycode_text_conversion_mac.mm index 4b02ace..d83df65 100644 --- a/chrome/test/chromedriver/keycode_text_conversion_mac.mm +++ b/chrome/test/chromedriver/keycode_text_conversion_mac.mm @@ -44,7 +44,7 @@ bool ConvertKeyCodeToText( // on UCKeyTranslate for more info. UInt32 modifier_key_state = (mac_modifiers >> 8) & 0xFF; - base::mac::ScopedCFTypeRef<TISInputSourceRef> input_source_copy( + base::ScopedCFTypeRef<TISInputSourceRef> input_source_copy( TISCopyCurrentKeyboardLayoutInputSource()); CFDataRef layout_data = static_cast<CFDataRef>(TISGetInputSourceProperty( input_source_copy, kTISPropertyUnicodeKeyLayoutData)); diff --git a/chrome/test/chromedriver/test_util.cc b/chrome/test/chromedriver/test_util.cc index 4d2d3c6..14f1c74 100644 --- a/chrome/test/chromedriver/test_util.cc +++ b/chrome/test/chromedriver/test_util.cc @@ -39,15 +39,15 @@ bool SwitchKeyboardLayout(const std::string& input_locale_identifier) { #if defined(OS_MACOSX) bool SwitchKeyboardLayout(const std::string& input_source_id) { - base::mac::ScopedCFTypeRef<CFMutableDictionaryRef> filter_dict( + base::ScopedCFTypeRef<CFMutableDictionaryRef> filter_dict( CFDictionaryCreateMutable(kCFAllocatorDefault, 1, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks)); - base::mac::ScopedCFTypeRef<CFStringRef> id_ref(CFStringCreateWithCString( + base::ScopedCFTypeRef<CFStringRef> id_ref(CFStringCreateWithCString( kCFAllocatorDefault, input_source_id.c_str(), kCFStringEncodingUTF8)); CFDictionaryAddValue(filter_dict, kTISPropertyInputSourceID, id_ref); - base::mac::ScopedCFTypeRef<CFArrayRef> sources( + base::ScopedCFTypeRef<CFArrayRef> sources( TISCreateInputSourceList(filter_dict, true)); if (CFArrayGetCount(sources) != 1) return false; diff --git a/chrome/test/chromedriver/test_util.h b/chrome/test/chromedriver/test_util.h index 6ef821e..e198842 100644 --- a/chrome/test/chromedriver/test_util.h +++ b/chrome/test/chromedriver/test_util.h @@ -27,7 +27,7 @@ class RestoreKeyboardLayoutOnDestruct { #if defined(OS_WIN) HKL layout_; #elif defined(OS_MACOSX) - base::mac::ScopedCFTypeRef<TISInputSourceRef> layout_; + base::ScopedCFTypeRef<TISInputSourceRef> layout_; #endif DISALLOW_COPY_AND_ASSIGN(RestoreKeyboardLayoutOnDestruct); diff --git a/chrome/test/webdriver/keycode_text_conversion_mac.mm b/chrome/test/webdriver/keycode_text_conversion_mac.mm index 7db3366..aa2e424 100644 --- a/chrome/test/webdriver/keycode_text_conversion_mac.mm +++ b/chrome/test/webdriver/keycode_text_conversion_mac.mm @@ -41,7 +41,7 @@ std::string ConvertKeyCodeToText(ui::KeyboardCode key_code, int modifiers) { // on UCKeyTranslate for more info. UInt32 modifier_key_state = (mac_modifiers >> 8) & 0xFF; - base::mac::ScopedCFTypeRef<TISInputSourceRef> input_source_copy( + base::ScopedCFTypeRef<TISInputSourceRef> input_source_copy( TISCopyCurrentKeyboardLayoutInputSource()); CFDataRef layout_data = static_cast<CFDataRef>(TISGetInputSourceProperty( input_source_copy, kTISPropertyUnicodeKeyLayoutData)); diff --git a/chrome/test/webdriver/webdriver_test_util.cc b/chrome/test/webdriver/webdriver_test_util.cc index 98c8827..0700adc 100644 --- a/chrome/test/webdriver/webdriver_test_util.cc +++ b/chrome/test/webdriver/webdriver_test_util.cc @@ -41,15 +41,15 @@ bool SwitchKeyboardLayout(const std::string& input_locale_identifier) { #if defined(OS_MACOSX) bool SwitchKeyboardLayout(const std::string& input_source_id) { - base::mac::ScopedCFTypeRef<CFMutableDictionaryRef> filter_dict( + base::ScopedCFTypeRef<CFMutableDictionaryRef> filter_dict( CFDictionaryCreateMutable(kCFAllocatorDefault, 1, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks)); - base::mac::ScopedCFTypeRef<CFStringRef> id_ref(CFStringCreateWithCString( + base::ScopedCFTypeRef<CFStringRef> id_ref(CFStringCreateWithCString( kCFAllocatorDefault, input_source_id.c_str(), kCFStringEncodingUTF8)); CFDictionaryAddValue(filter_dict, kTISPropertyInputSourceID, id_ref); - base::mac::ScopedCFTypeRef<CFArrayRef> sources( + base::ScopedCFTypeRef<CFArrayRef> sources( TISCreateInputSourceList(filter_dict, true)); if (CFArrayGetCount(sources) != 1) return false; diff --git a/chrome/test/webdriver/webdriver_test_util.h b/chrome/test/webdriver/webdriver_test_util.h index 526ea14..0531c58 100644 --- a/chrome/test/webdriver/webdriver_test_util.h +++ b/chrome/test/webdriver/webdriver_test_util.h @@ -29,7 +29,7 @@ class RestoreKeyboardLayoutOnDestruct { #if defined(OS_WIN) HKL layout_; #elif defined(OS_MACOSX) - base::mac::ScopedCFTypeRef<TISInputSourceRef> layout_; + base::ScopedCFTypeRef<TISInputSourceRef> layout_; #endif DISALLOW_COPY_AND_ASSIGN(RestoreKeyboardLayoutOnDestruct); diff --git a/content/browser/download/file_metadata_mac.mm b/content/browser/download/file_metadata_mac.mm index 548229c..1bdec1f 100644 --- a/content/browser/download/file_metadata_mac.mm +++ b/content/browser/download/file_metadata_mac.mm @@ -70,7 +70,7 @@ void AddOriginMetadataToFile(const base::FilePath& file, const GURL& source, if (!file_path) return; - base::mac::ScopedCFTypeRef<MDItemRef> md_item( + base::ScopedCFTypeRef<MDItemRef> md_item( MDItemCreate(NULL, base::mac::NSToCFCast(file_path))); if (!md_item) return; diff --git a/content/browser/gamepad/gamepad_platform_data_fetcher_mac.h b/content/browser/gamepad/gamepad_platform_data_fetcher_mac.h index bb95ed4..3b22b693 100644 --- a/content/browser/gamepad/gamepad_platform_data_fetcher_mac.h +++ b/content/browser/gamepad/gamepad_platform_data_fetcher_mac.h @@ -38,7 +38,7 @@ class GamepadPlatformDataFetcherMac : public GamepadDataFetcher, private: bool enabled_; - base::mac::ScopedCFTypeRef<IOHIDManagerRef> hid_manager_ref_; + base::ScopedCFTypeRef<IOHIDManagerRef> hid_manager_ref_; static GamepadPlatformDataFetcherMac* InstanceFromContext(void* context); static void DeviceAddCallback(void* context, diff --git a/content/browser/gamepad/gamepad_platform_data_fetcher_mac.mm b/content/browser/gamepad/gamepad_platform_data_fetcher_mac.mm index 33ef74c..5d1be27 100644 --- a/content/browser/gamepad/gamepad_platform_data_fetcher_mac.mm +++ b/content/browser/gamepad/gamepad_platform_data_fetcher_mac.mm @@ -269,7 +269,7 @@ void GamepadPlatformDataFetcherMac::DeviceAdd(IOHIDDeviceRef device) { [as16 getBytes:data_.items[slot].id length:kOutputLengthBytes - sizeof(WebKit::WebUChar)]; - base::mac::ScopedCFTypeRef<CFArrayRef> elements( + base::ScopedCFTypeRef<CFArrayRef> elements( IOHIDDeviceCopyMatchingElements(device, NULL, kIOHIDOptionsTypeNone)); AddButtonsAndAxes(CFToNSCast(elements), slot); diff --git a/content/browser/gamepad/xbox_data_fetcher_mac.cc b/content/browser/gamepad/xbox_data_fetcher_mac.cc index a3239f7..6619b9b 100644 --- a/content/browser/gamepad/xbox_data_fetcher_mac.cc +++ b/content/browser/gamepad/xbox_data_fetcher_mac.cc @@ -495,12 +495,12 @@ void XboxDataFetcher::DeviceRemoved(void* context, io_iterator_t iterator) { io_service_t ref; while ((ref = IOIteratorNext(iterator))) { base::mac::ScopedIOObject<io_service_t> scoped_ref(ref); - base::mac::ScopedCFTypeRef<CFNumberRef> number( - base::mac::CFCastStrict<CFNumberRef>(IORegistryEntryCreateCFProperty( - ref, - CFSTR(kUSBDevicePropertyLocationID), - kCFAllocatorDefault, - kNilOptions))); + base::ScopedCFTypeRef<CFNumberRef> number( + base::mac::CFCastStrict<CFNumberRef>( + IORegistryEntryCreateCFProperty(ref, + CFSTR(kUSBDevicePropertyLocationID), + kCFAllocatorDefault, + kNilOptions))); UInt32 location_id = 0; CFNumberGetValue(number, kCFNumberSInt32Type, &location_id); fetcher->RemoveControllerByLocationID(location_id); @@ -510,13 +510,11 @@ void XboxDataFetcher::DeviceRemoved(void* context, io_iterator_t iterator) { bool XboxDataFetcher::RegisterForNotifications() { if (listening_) return true; - base::mac::ScopedCFTypeRef<CFNumberRef> vendor_cf( - CFNumberCreate(kCFAllocatorDefault, kCFNumberSInt32Type, - &kVendorMicrosoft)); - base::mac::ScopedCFTypeRef<CFNumberRef> product_cf( - CFNumberCreate(kCFAllocatorDefault, kCFNumberSInt32Type, - &kProduct360Controller)); - base::mac::ScopedCFTypeRef<CFMutableDictionaryRef> matching_dict( + base::ScopedCFTypeRef<CFNumberRef> vendor_cf(CFNumberCreate( + kCFAllocatorDefault, kCFNumberSInt32Type, &kVendorMicrosoft)); + base::ScopedCFTypeRef<CFNumberRef> product_cf(CFNumberCreate( + kCFAllocatorDefault, kCFNumberSInt32Type, &kProduct360Controller)); + base::ScopedCFTypeRef<CFMutableDictionaryRef> matching_dict( IOServiceMatching(kIOUSBDeviceClassName)); if (!matching_dict) return false; diff --git a/content/browser/gamepad/xbox_data_fetcher_mac.h b/content/browser/gamepad/xbox_data_fetcher_mac.h index 74eda1b..ca8f7fc 100644 --- a/content/browser/gamepad/xbox_data_fetcher_mac.h +++ b/content/browser/gamepad/xbox_data_fetcher_mac.h @@ -98,7 +98,7 @@ class XboxController { bool device_is_open_; bool interface_is_open_; - base::mac::ScopedCFTypeRef<CFRunLoopSourceRef> source_; + base::ScopedCFTypeRef<CFRunLoopSourceRef> source_; // This will be set to the max packet size reported by the interface, which // is 32 bytes. I would have expected USB to do message framing itself, but diff --git a/content/browser/power_save_blocker_mac.cc b/content/browser/power_save_blocker_mac.cc index 113c4e9..ec340a1 100644 --- a/content/browser/power_save_blocker_mac.cc +++ b/content/browser/power_save_blocker_mac.cc @@ -73,7 +73,7 @@ void PowerSaveBlockerImpl::Delegate::ApplyBlock() { break; } if (level) { - base::mac::ScopedCFTypeRef<CFStringRef> cf_reason( + base::ScopedCFTypeRef<CFStringRef> cf_reason( base::SysUTF8ToCFStringRef(reason_)); IOReturn result = IOPMAssertionCreateWithName(level, kIOPMAssertionLevelOn, diff --git a/content/browser/renderer_host/backing_store_mac.h b/content/browser/renderer_host/backing_store_mac.h index cc78e76..698ca3d 100644 --- a/content/browser/renderer_host/backing_store_mac.h +++ b/content/browser/renderer_host/backing_store_mac.h @@ -62,8 +62,8 @@ class BackingStoreMac : public BackingStore { // result. CGContextRef CreateCGBitmapContext(); - base::mac::ScopedCFTypeRef<CGContextRef> cg_bitmap_; - base::mac::ScopedCFTypeRef<CGLayerRef> cg_layer_; + base::ScopedCFTypeRef<CGContextRef> cg_bitmap_; + base::ScopedCFTypeRef<CGLayerRef> cg_layer_; // Number of physical pixels per view unit. This is 1 or 2 in practice. float device_scale_factor_; diff --git a/content/browser/renderer_host/backing_store_mac.mm b/content/browser/renderer_host/backing_store_mac.mm index 5c51ba8..90a0e0b 100644 --- a/content/browser/renderer_host/backing_store_mac.mm +++ b/content/browser/renderer_host/backing_store_mac.mm @@ -53,7 +53,7 @@ void BackingStoreMac::ScaleFactorChanged(float device_scale_factor) { device_scale_factor_ = device_scale_factor; - base::mac::ScopedCFTypeRef<CGLayerRef> new_layer(CreateCGLayer()); + base::ScopedCFTypeRef<CGLayerRef> new_layer(CreateCGLayer()); // If we have a layer, copy the old contents. A pixelated flash is better // than a white flash. if (new_layer && cg_layer_) { @@ -98,16 +98,22 @@ void BackingStoreMac::PaintToBackingStore( pixel_bitmap_rect.width() * pixel_bitmap_rect.height() * 4; DCHECK_GE(dib->size(), bitmap_byte_count); - base::mac::ScopedCFTypeRef<CGDataProviderRef> data_provider( - CGDataProviderCreateWithData(NULL, dib->memory(), - bitmap_byte_count, NULL)); - - base::mac::ScopedCFTypeRef<CGImageRef> bitmap_image( - CGImageCreate(pixel_bitmap_rect.width(), pixel_bitmap_rect.height(), - 8, 32, 4 * pixel_bitmap_rect.width(), - base::mac::GetSystemColorSpace(), - kCGImageAlphaPremultipliedFirst | kCGBitmapByteOrder32Host, - data_provider, NULL, false, kCGRenderingIntentDefault)); + base::ScopedCFTypeRef<CGDataProviderRef> data_provider( + CGDataProviderCreateWithData( + NULL, dib->memory(), bitmap_byte_count, NULL)); + + base::ScopedCFTypeRef<CGImageRef> bitmap_image( + CGImageCreate(pixel_bitmap_rect.width(), + pixel_bitmap_rect.height(), + 8, + 32, + 4 * pixel_bitmap_rect.width(), + base::mac::GetSystemColorSpace(), + kCGImageAlphaPremultipliedFirst | kCGBitmapByteOrder32Host, + data_provider, + NULL, + false, + kCGRenderingIntentDefault)); for (size_t i = 0; i < copy_rects.size(); i++) { const gfx::Rect& copy_rect = copy_rects[i]; @@ -115,19 +121,19 @@ void BackingStoreMac::PaintToBackingStore( gfx::ScaleRect(copy_rect, scale_factor)); // Only the subpixels given by copy_rect have pixels to copy. - base::mac::ScopedCFTypeRef<CGImageRef> image( - CGImageCreateWithImageInRect(bitmap_image, CGRectMake( - pixel_copy_rect.x() - pixel_bitmap_rect.x(), - pixel_copy_rect.y() - pixel_bitmap_rect.y(), - pixel_copy_rect.width(), - pixel_copy_rect.height()))); + base::ScopedCFTypeRef<CGImageRef> image(CGImageCreateWithImageInRect( + bitmap_image, + CGRectMake(pixel_copy_rect.x() - pixel_bitmap_rect.x(), + pixel_copy_rect.y() - pixel_bitmap_rect.y(), + pixel_copy_rect.width(), + pixel_copy_rect.height()))); if (!cg_layer()) { // The view may have moved to a window. Try to get a CGLayer. cg_layer_.reset(CreateCGLayer()); if (cg_layer()) { // Now that we have a layer, copy the cached image into it. - base::mac::ScopedCFTypeRef<CGImageRef> bitmap_image( + base::ScopedCFTypeRef<CGImageRef> bitmap_image( CGBitmapContextCreateImage(cg_bitmap_)); CGContextDrawImage(CGLayerGetContext(cg_layer()), CGRectMake(0, 0, size().width(), size().height()), @@ -204,7 +210,7 @@ void BackingStoreMac::ScrollBackingStore(const gfx::Vector2d& delta, CGPointMake(delta.x(), -delta.y()), cg_layer()); } else { // We don't have a layer, so scroll the contents of the CGBitmapContext. - base::mac::ScopedCFTypeRef<CGImageRef> bitmap_image( + base::ScopedCFTypeRef<CGImageRef> bitmap_image( CGBitmapContextCreateImage(cg_bitmap_)); gfx::ScopedCGContextSaveGState save_gstate(cg_bitmap_); CGContextClipToRect(cg_bitmap_, @@ -227,7 +233,7 @@ void BackingStoreMac::CopyFromBackingStoreToCGContext(const CGRect& dest_rect, if (cg_layer_) { CGContextDrawLayerInRect(context, dest_rect, cg_layer_); } else { - base::mac::ScopedCFTypeRef<CGImageRef> image( + base::ScopedCFTypeRef<CGImageRef> image( CGBitmapContextCreateImage(cg_bitmap_)); CGContextDrawImage(context, dest_rect, image); } diff --git a/content/browser/renderer_host/compositing_iosurface_mac.h b/content/browser/renderer_host/compositing_iosurface_mac.h index e8fdad9..c470fa0 100644 --- a/content/browser/renderer_host/compositing_iosurface_mac.h +++ b/content/browser/renderer_host/compositing_iosurface_mac.h @@ -322,7 +322,7 @@ class CompositingIOSurfaceMac { // IOSurface data. uint64 io_surface_handle_; - base::mac::ScopedCFTypeRef<CFTypeRef> io_surface_; + base::ScopedCFTypeRef<CFTypeRef> io_surface_; // The width and height of the io surface. gfx::Size pixel_io_surface_size_; // In pixels. diff --git a/content/browser/renderer_host/render_widget_host_view_mac.mm b/content/browser/renderer_host/render_widget_host_view_mac.mm index 3d6b8bd..21655da 100644 --- a/content/browser/renderer_host/render_widget_host_view_mac.mm +++ b/content/browser/renderer_host/render_widget_host_view_mac.mm @@ -2623,7 +2623,7 @@ void RenderWidgetHostViewMac::FrameSwapped() { // if we haven't created a layer yet, draw the cached bitmap into // the window. The CGLayer will be created the next time the renderer // paints. - base::mac::ScopedCFTypeRef<CGImageRef> image( + base::ScopedCFTypeRef<CGImageRef> image( CGBitmapContextCreateImage(backingStore->cg_bitmap())); CGRect imageRect = bitmapRect.ToCGRect(); imageRect.origin.y = yOffset; diff --git a/content/browser/web_contents/web_drag_source_mac.h b/content/browser/web_contents/web_drag_source_mac.h index ceef25a..e172551 100644 --- a/content/browser/web_contents/web_drag_source_mac.h +++ b/content/browser/web_contents/web_drag_source_mac.h @@ -49,7 +49,7 @@ CONTENT_EXPORT GURL downloadURL_; // The file UTI associated with the file drag, if any. - base::mac::ScopedCFTypeRef<CFStringRef> fileUTI_; + base::ScopedCFTypeRef<CFStringRef> fileUTI_; } // Initialize a WebDragSource object for a drag (originating on the given diff --git a/content/browser/web_contents/web_drag_source_mac.mm b/content/browser/web_contents/web_drag_source_mac.mm index c691876..258af55 100644 --- a/content/browser/web_contents/web_drag_source_mac.mm +++ b/content/browser/web_contents/web_drag_source_mac.mm @@ -104,7 +104,7 @@ NSString* GetDropLocation(NSPasteboard* pboard) { OSSTATUS_DCHECK(false, status) << "Error finding Carbon pasteboard"; return nil; } - base::mac::ScopedCFTypeRef<PasteboardRef> pb_ref_scoper(pb_ref); + base::ScopedCFTypeRef<PasteboardRef> pb_ref_scoper(pb_ref); PasteboardSynchronize(pb_ref); CFURLRef drop_url = NULL; @@ -113,7 +113,7 @@ NSString* GetDropLocation(NSPasteboard* pboard) { OSSTATUS_DCHECK(false, status) << "Error finding drop location"; return nil; } - base::mac::ScopedCFTypeRef<CFURLRef> drop_url_scoper(drop_url); + base::ScopedCFTypeRef<CFURLRef> drop_url_scoper(drop_url); NSString* drop_path = [base::mac::CFToNSCast(drop_url) path]; return drop_path; @@ -443,7 +443,7 @@ NSString* GetDropLocation(NSPasteboard* pboard) { } if (!mimeType.empty()) { - base::mac::ScopedCFTypeRef<CFStringRef> mimeTypeCF( + base::ScopedCFTypeRef<CFStringRef> mimeTypeCF( base::SysUTF8ToCFStringRef(mimeType)); fileUTI_.reset(UTTypeCreatePreferredIdentifierForTag( kUTTagClassMIMEType, mimeTypeCF.get(), NULL)); diff --git a/content/common/gpu/image_transport_surface_mac.cc b/content/common/gpu/image_transport_surface_mac.cc index c6a38c7..6e6c580 100644 --- a/content/common/gpu/image_transport_surface_mac.cc +++ b/content/common/gpu/image_transport_surface_mac.cc @@ -82,7 +82,7 @@ class IOSurfaceImageTransportSurface uint32 fbo_id_; GLuint texture_id_; - base::mac::ScopedCFTypeRef<CFTypeRef> io_surface_; + base::ScopedCFTypeRef<CFTypeRef> io_surface_; // The id of |io_surface_| or 0 if that's NULL. uint64 io_surface_handle_; @@ -120,7 +120,7 @@ void AddBooleanValue(CFMutableDictionaryRef dictionary, void AddIntegerValue(CFMutableDictionaryRef dictionary, const CFStringRef key, int32 value) { - base::mac::ScopedCFTypeRef<CFNumberRef> number( + base::ScopedCFTypeRef<CFNumberRef> number( CFNumberCreate(NULL, kCFNumberSInt32Type, &value)); CFDictionaryAddValue(dictionary, key, number.get()); } @@ -399,7 +399,7 @@ void IOSurfaceImageTransportSurface::CreateIOSurface() { // Allocate a new IOSurface, which is the GPU resource that can be // shared across processes. - base::mac::ScopedCFTypeRef<CFMutableDictionaryRef> properties; + base::ScopedCFTypeRef<CFMutableDictionaryRef> properties; properties.reset(CFDictionaryCreateMutable(kCFAllocatorDefault, 0, &kCFTypeDictionaryKeyCallBacks, diff --git a/content/common/mac/font_loader.mm b/content/common/mac/font_loader.mm index 3ce9bab..bbb9852 100644 --- a/content/common/mac/font_loader.mm +++ b/content/common/mac/font_loader.mm @@ -168,7 +168,7 @@ bool FontLoader::CGFontRefFromBuffer(base::SharedMemoryHandle font_data, NSData* data = [NSData dataWithBytes:shm.memory() length:font_data_size]; - base::mac::ScopedCFTypeRef<CGDataProviderRef> provider( + base::ScopedCFTypeRef<CGDataProviderRef> provider( CGDataProviderCreateWithCFData(base::mac::NSToCFCast(data))); if (!provider) return false; diff --git a/content/common/sandbox_mac.mm b/content/common/sandbox_mac.mm index d44953d6..9fd2657 100644 --- a/content/common/sandbox_mac.mm +++ b/content/common/sandbox_mac.mm @@ -252,23 +252,26 @@ void Sandbox::SandboxWarmup(int sandbox_type) { base::mac::ScopedNSAutoreleasePool scoped_pool; { // CGColorSpaceCreateWithName(), CGBitmapContextCreate() - 10.5.6 - base::mac::ScopedCFTypeRef<CGColorSpaceRef> rgb_colorspace( + base::ScopedCFTypeRef<CGColorSpaceRef> rgb_colorspace( CGColorSpaceCreateWithName(kCGColorSpaceGenericRGB)); // Allocate a 1x1 image. char data[4]; - base::mac::ScopedCFTypeRef<CGContextRef> context( - CGBitmapContextCreate(data, 1, 1, 8, 1 * 4, - rgb_colorspace, - kCGImageAlphaPremultipliedFirst | - kCGBitmapByteOrder32Host)); + base::ScopedCFTypeRef<CGContextRef> context(CGBitmapContextCreate( + data, + 1, + 1, + 8, + 1 * 4, + rgb_colorspace, + kCGImageAlphaPremultipliedFirst | kCGBitmapByteOrder32Host)); // Load in the color profiles we'll need (as a side effect). (void) base::mac::GetSRGBColorSpace(); (void) base::mac::GetSystemColorSpace(); // CGColorSpaceCreateSystemDefaultCMYK - 10.6 - base::mac::ScopedCFTypeRef<CGColorSpaceRef> cmyk_colorspace( + base::ScopedCFTypeRef<CGColorSpaceRef> cmyk_colorspace( CGColorSpaceCreateWithName(kCGColorSpaceGenericCMYK)); } @@ -293,9 +296,8 @@ void Sandbox::SandboxWarmup(int sandbox_type) { char png_header[] = {0x89, 0x50, 0x4E, 0x47, 0x0D, 0x0A, 0x1A, 0x0A}; NSData* data = [NSData dataWithBytes:png_header length:arraysize(png_header)]; - base::mac::ScopedCFTypeRef<CGImageSourceRef> img( - CGImageSourceCreateWithData((CFDataRef)data, - NULL)); + base::ScopedCFTypeRef<CGImageSourceRef> img( + CGImageSourceCreateWithData((CFDataRef)data, NULL)); CGImageSourceGetStatus(img); } diff --git a/content/common/sandbox_mac_fontloading_unittest.mm b/content/common/sandbox_mac_fontloading_unittest.mm index 77b211f..155e3c3 100644 --- a/content/common/sandbox_mac_fontloading_unittest.mm +++ b/content/common/sandbox_mac_fontloading_unittest.mm @@ -80,11 +80,11 @@ bool FontLoadingTestCase::SandboxedTest() { LOG(ERROR) << "Got NULL CGFontRef"; return false; } - base::mac::ScopedCFTypeRef<CGFontRef> cgfont(cg_font_ref); + base::ScopedCFTypeRef<CGFontRef> cgfont(cg_font_ref); CTFontRef ct_font_ref = CTFontCreateWithGraphicsFont(cgfont.get(), 16.0, NULL, NULL); - base::mac::ScopedCFTypeRef<CTFontRef> ctfont(ct_font_ref); + base::ScopedCFTypeRef<CTFontRef> ctfont(ct_font_ref); if (!ct_font_ref) { LOG(ERROR) << "CTFontCreateWithGraphicsFont() failed"; diff --git a/content/plugin/webplugin_proxy.cc b/content/plugin/webplugin_proxy.cc index 8afbfb0..b8926a8 100644 --- a/content/plugin/webplugin_proxy.cc +++ b/content/plugin/webplugin_proxy.cc @@ -503,7 +503,7 @@ void WebPluginProxy::CreateDIBAndCGContextFromHandle( const TransportDIB::Handle& dib_handle, const gfx::Rect& window_rect, scoped_ptr<TransportDIB>* dib_out, - base::mac::ScopedCFTypeRef<CGContextRef>* cg_context_out) { + base::ScopedCFTypeRef<CGContextRef>* cg_context_out) { // Convert the shared memory handle to a handle that works in our process, // and then use that to create a CGContextRef. TransportDIB* dib = TransportDIB::Map(dib_handle); diff --git a/content/plugin/webplugin_proxy.h b/content/plugin/webplugin_proxy.h index f847a64..8419e98 100644 --- a/content/plugin/webplugin_proxy.h +++ b/content/plugin/webplugin_proxy.h @@ -185,7 +185,7 @@ class WebPluginProxy : public webkit::npapi::WebPlugin { const TransportDIB::Handle& dib_handle, const gfx::Rect& window_rect, scoped_ptr<TransportDIB>* dib_out, - base::mac::ScopedCFTypeRef<CGContextRef>* cg_context_out); + base::ScopedCFTypeRef<CGContextRef>* cg_context_out); #elif defined(USE_X11) static void CreateDIBAndCanvasFromHandle( const TransportDIB::Handle& dib_handle, @@ -243,7 +243,7 @@ class WebPluginProxy : public webkit::npapi::WebPlugin { int windowless_buffer_index_; #if defined(OS_MACOSX) scoped_ptr<TransportDIB> windowless_dibs_[2]; - base::mac::ScopedCFTypeRef<CGContextRef> windowless_contexts_[2]; + base::ScopedCFTypeRef<CGContextRef> windowless_contexts_[2]; scoped_ptr<WebPluginAcceleratedSurfaceProxy> accelerated_surface_; #else skia::RefPtr<SkCanvas> windowless_canvases_[2]; diff --git a/content/renderer/pepper/pepper_truetype_font_mac.mm b/content/renderer/pepper/pepper_truetype_font_mac.mm index b37c0fe..cb6339d 100644 --- a/content/renderer/pepper/pepper_truetype_font_mac.mm +++ b/content/renderer/pepper/pepper_truetype_font_mac.mm @@ -114,7 +114,7 @@ class PepperTrueTypeFontMac : public PepperTrueTypeFont { int32_t max_data_length, std::string* data); - base::mac::ScopedCFTypeRef<CTFontRef> font_ref_; + base::ScopedCFTypeRef<CTFontRef> font_ref_; DISALLOW_COPY_AND_ASSIGN(PepperTrueTypeFontMac); }; @@ -122,13 +122,15 @@ class PepperTrueTypeFontMac : public PepperTrueTypeFont { PepperTrueTypeFontMac::PepperTrueTypeFontMac( const ppapi::proxy::SerializedTrueTypeFontDesc& desc) { // Create attributes and traits dictionaries. - base::mac::ScopedCFTypeRef<CFMutableDictionaryRef> attributes_ref( - CFDictionaryCreateMutable(kCFAllocatorDefault, 0, + base::ScopedCFTypeRef<CFMutableDictionaryRef> attributes_ref( + CFDictionaryCreateMutable(kCFAllocatorDefault, + 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks)); - base::mac::ScopedCFTypeRef<CFMutableDictionaryRef> traits_ref( - CFDictionaryCreateMutable(kCFAllocatorDefault, 0, + base::ScopedCFTypeRef<CFMutableDictionaryRef> traits_ref( + CFDictionaryCreateMutable(kCFAllocatorDefault, + 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks)); if (!attributes_ref || !traits_ref) @@ -147,10 +149,8 @@ PepperTrueTypeFontMac::PepperTrueTypeFontMac( else if (desc.width == PP_TRUETYPEFONTWIDTH_EXPANDED) symbolic_traits |= kCTFontExpandedTrait; - base::mac::ScopedCFTypeRef<CFNumberRef> symbolic_traits_ref( - CFNumberCreate(kCFAllocatorDefault, - kCFNumberSInt32Type, - &symbolic_traits)); + base::ScopedCFTypeRef<CFNumberRef> symbolic_traits_ref(CFNumberCreate( + kCFAllocatorDefault, kCFNumberSInt32Type, &symbolic_traits)); if (!symbolic_traits_ref) return; CFDictionaryAddValue(traits_ref, kCTFontSymbolicTrait, symbolic_traits_ref); @@ -178,7 +178,7 @@ PepperTrueTypeFontMac::PepperTrueTypeFontMac( } } - base::mac::ScopedCFTypeRef<CFStringRef> name_ref( + base::ScopedCFTypeRef<CFStringRef> name_ref( base::SysUTF8ToCFStringRef(family)); if (name_ref) CFDictionaryAddValue(attributes_ref, kCTFontFamilyNameAttribute, name_ref); @@ -186,10 +186,8 @@ PepperTrueTypeFontMac::PepperTrueTypeFontMac( if (desc.weight != PP_TRUETYPEFONTWEIGHT_NORMAL && desc.weight != PP_TRUETYPEFONTWEIGHT_BOLD) { float weight = GetMacWeight(desc.weight); - base::mac::ScopedCFTypeRef<CFNumberRef> weight_trait_ref( - CFNumberCreate(kCFAllocatorDefault, - kCFNumberFloat32Type, - &weight)); + base::ScopedCFTypeRef<CFNumberRef> weight_trait_ref( + CFNumberCreate(kCFAllocatorDefault, kCFNumberFloat32Type, &weight)); if (weight_trait_ref) CFDictionaryAddValue(traits_ref, kCTFontWeightTrait, weight_trait_ref); } @@ -198,15 +196,13 @@ PepperTrueTypeFontMac::PepperTrueTypeFontMac( desc.width != PP_TRUETYPEFONTWIDTH_CONDENSED && desc.width != PP_TRUETYPEFONTWIDTH_EXPANDED) { float width = GetMacWidth(desc.width); - base::mac::ScopedCFTypeRef<CFNumberRef> width_trait_ref( - CFNumberCreate(kCFAllocatorDefault, - kCFNumberFloat32Type, - &width)); + base::ScopedCFTypeRef<CFNumberRef> width_trait_ref( + CFNumberCreate(kCFAllocatorDefault, kCFNumberFloat32Type, &width)); if (width_trait_ref) CFDictionaryAddValue(traits_ref, kCTFontWidthTrait, width_trait_ref); } - base::mac::ScopedCFTypeRef<CTFontDescriptorRef> desc_ref( + base::ScopedCFTypeRef<CTFontDescriptorRef> desc_ref( CTFontDescriptorCreateWithAttributes(attributes_ref)); if (desc_ref) @@ -225,15 +221,15 @@ int32_t PepperTrueTypeFontMac::Describe( if (!IsValid()) return PP_ERROR_FAILED; - base::mac::ScopedCFTypeRef<CTFontDescriptorRef> desc_ref( + base::ScopedCFTypeRef<CTFontDescriptorRef> desc_ref( CTFontCopyFontDescriptor(font_ref_)); - base::mac::ScopedCFTypeRef<CFStringRef> family_name_ref( - base::mac::CFCast<CFStringRef>(CTFontDescriptorCopyAttribute( - desc_ref, kCTFontFamilyNameAttribute))); + base::ScopedCFTypeRef<CFStringRef> family_name_ref( + base::mac::CFCast<CFStringRef>( + CTFontDescriptorCopyAttribute(desc_ref, kCTFontFamilyNameAttribute))); desc->family = base::SysCFStringRefToUTF8(family_name_ref); - base::mac::ScopedCFTypeRef<CFDictionaryRef> traits_ref( + base::ScopedCFTypeRef<CFDictionaryRef> traits_ref( base::mac::CFCast<CFDictionaryRef>( CTFontDescriptorCopyAttribute(desc_ref, kCTFontTraitsAttribute))); @@ -265,7 +261,7 @@ int32_t PepperTrueTypeFontMac::Describe( } int32_t PepperTrueTypeFontMac::GetTableTags(std::vector<uint32_t>* tags) { - base::mac::ScopedCFTypeRef<CFArrayRef> tag_array( + base::ScopedCFTypeRef<CFArrayRef> tag_array( CTFontCopyAvailableTables(font_ref_, kCTFontTableOptionNoOptions)); if (!tag_array) return PP_ERROR_FAILED; @@ -288,8 +284,9 @@ int32_t PepperTrueTypeFontMac::GetTable(uint32_t table_tag, if (!table_tag) return GetEntireFont(offset, max_data_length, data); - base::mac::ScopedCFTypeRef<CFDataRef> table_ref( - CTFontCopyTable(font_ref_, static_cast<CTFontTableTag>(table_tag), + base::ScopedCFTypeRef<CFDataRef> table_ref( + CTFontCopyTable(font_ref_, + static_cast<CTFontTableTag>(table_tag), kCTFontTableOptionNoOptions)); if (!table_ref) return PP_ERROR_FAILED; @@ -320,7 +317,7 @@ int32_t PepperTrueTypeFontMac::GetEntireFont(int32_t offset, std::string font(sizeof(FontHeader) + sizeof(FontDirectoryEntry) * table_count, 0); // Map the OS X font type value to a TrueType scalar type. - base::mac::ScopedCFTypeRef<CFNumberRef> font_type_ref( + base::ScopedCFTypeRef<CFNumberRef> font_type_ref( base::mac::CFCast<CFNumberRef>( CTFontCopyAttribute(font_ref_, kCTFontFormatAttribute))); int32_t font_type; diff --git a/content/renderer/renderer_main_platform_delegate_mac.mm b/content/renderer/renderer_main_platform_delegate_mac.mm index c128cf0..e7cf9ff 100644 --- a/content/renderer/renderer_main_platform_delegate_mac.mm +++ b/content/renderer/renderer_main_platform_delegate_mac.mm @@ -163,9 +163,9 @@ bool RendererMainPlatformDelegate::EnableSandbox() { // After the sandbox is initialized, call into TIS. Doing this before // the sandbox is in place will open up renderer access to the // pasteboard and an XPC connection to "com.apple.hiservices-xpcservice". - base::mac::ScopedCFTypeRef<TISInputSourceRef> layout_source( + base::ScopedCFTypeRef<TISInputSourceRef> layout_source( TISCopyCurrentKeyboardLayoutInputSource()); - base::mac::ScopedCFTypeRef<TISInputSourceRef> input_source( + base::ScopedCFTypeRef<TISInputSourceRef> input_source( TISCopyCurrentKeyboardInputSource()); CFTypeRef source_list[] = { layout_source.get(), input_source.get() }; diff --git a/crypto/apple_keychain_ios.mm b/crypto/apple_keychain_ios.mm index 1a4c9d5..c0b1048 100644 --- a/crypto/apple_keychain_ios.mm +++ b/crypto/apple_keychain_ios.mm @@ -126,16 +126,13 @@ OSStatus AppleKeychain::AddGenericPassword(SecKeychainRef keychain, UInt32 passwordLength, const void* passwordData, SecKeychainItemRef* itemRef) const { - base::mac::ScopedCFTypeRef<CFDictionaryRef> query( - CreateGenericPasswordQuery(serviceNameLength, - serviceName, - accountNameLength, - accountName)); + base::ScopedCFTypeRef<CFDictionaryRef> query(CreateGenericPasswordQuery( + serviceNameLength, serviceName, accountNameLength, accountName)); // Check that there is not already a password. OSStatus status = SecItemCopyMatching(query, NULL); if (status == errSecItemNotFound) { // A new entry must be created. - base::mac::ScopedCFTypeRef<CFDictionaryRef> keychain_data( + base::ScopedCFTypeRef<CFDictionaryRef> keychain_data( CreateKeychainData(serviceNameLength, serviceName, accountNameLength, @@ -146,7 +143,7 @@ OSStatus AppleKeychain::AddGenericPassword(SecKeychainRef keychain, status = SecItemAdd(keychain_data, NULL); } else if (status == noErr) { // The entry must be updated. - base::mac::ScopedCFTypeRef<CFDictionaryRef> keychain_data( + base::ScopedCFTypeRef<CFDictionaryRef> keychain_data( CreateKeychainData(serviceNameLength, serviceName, accountNameLength, @@ -170,16 +167,13 @@ OSStatus AppleKeychain::FindGenericPassword(CFTypeRef keychainOrArray, SecKeychainItemRef* itemRef) const { DCHECK((passwordData && passwordLength) || (!passwordData && !passwordLength)); - base::mac::ScopedCFTypeRef<CFDictionaryRef> query( - CreateGenericPasswordQuery(serviceNameLength, - serviceName, - accountNameLength, - accountName)); + base::ScopedCFTypeRef<CFDictionaryRef> query(CreateGenericPasswordQuery( + serviceNameLength, serviceName, accountNameLength, accountName)); // Get the keychain item containing the password. CFTypeRef resultRef = NULL; OSStatus status = SecItemCopyMatching(query, &resultRef); - base::mac::ScopedCFTypeRef<CFTypeRef> result(resultRef); + base::ScopedCFTypeRef<CFTypeRef> result(resultRef); if (status != noErr) { if (passwordData) { diff --git a/crypto/cssm_init.cc b/crypto/cssm_init.cc index 7b7e52d..208309c 100644 --- a/crypto/cssm_init.cc +++ b/crypto/cssm_init.cc @@ -184,7 +184,7 @@ void CSSMFree(void* ptr) { void LogCSSMError(const char* fn_name, CSSM_RETURN err) { if (!err) return; - base::mac::ScopedCFTypeRef<CFStringRef> cfstr( + base::ScopedCFTypeRef<CFStringRef> cfstr( SecCopyErrorMessageString(err, NULL)); LOG(ERROR) << fn_name << " returned " << err << " (" << base::SysCFStringRefToUTF8(cfstr) << ")"; diff --git a/gpu/config/gpu_info_collector_mac.mm b/gpu/config/gpu_info_collector_mac.mm index c47a244..1f7fad1 100644 --- a/gpu/config/gpu_info_collector_mac.mm +++ b/gpu/config/gpu_info_collector_mac.mm @@ -35,13 +35,13 @@ const UInt32 kVendorIDAMD = 0x1002; // Return 0 if we couldn't find the property. // The property values we use should not be 0, so it's OK to use 0 as failure. UInt32 GetEntryProperty(io_registry_entry_t entry, CFStringRef property_name) { - base::mac::ScopedCFTypeRef<CFDataRef> data_ref(static_cast<CFDataRef>( - IORegistryEntrySearchCFProperty(entry, - kIOServicePlane, - property_name, - kCFAllocatorDefault, - kIORegistryIterateRecursively | - kIORegistryIterateParents))); + base::ScopedCFTypeRef<CFDataRef> data_ref( + static_cast<CFDataRef>(IORegistryEntrySearchCFProperty( + entry, + kIOServicePlane, + property_name, + kCFAllocatorDefault, + kIORegistryIterateRecursively | kIORegistryIterateParents))); if (!data_ref) return 0; diff --git a/media/audio/mac/aggregate_device_manager.cc b/media/audio/mac/aggregate_device_manager.cc index 7f319f3..c7f3233 100644 --- a/media/audio/mac/aggregate_device_manager.cc +++ b/media/audio/mac/aggregate_device_manager.cc @@ -12,7 +12,7 @@ #include "media/audio/audio_parameters.h" #include "media/audio/mac/audio_manager_mac.h" -using base::mac::ScopedCFTypeRef; +using base::ScopedCFTypeRef; namespace media { diff --git a/media/audio/mac/audio_manager_mac.cc b/media/audio/mac/audio_manager_mac.cc index 239183e..c0c18ee 100644 --- a/media/audio/mac/audio_manager_mac.cc +++ b/media/audio/mac/audio_manager_mac.cc @@ -203,8 +203,8 @@ static AudioDeviceID GetAudioDeviceIdByUId(bool is_input, &audio_device_id); } else { // Non-default device. - base::mac::ScopedCFTypeRef<CFStringRef> - uid(base::SysUTF8ToCFStringRef(device_id)); + base::ScopedCFTypeRef<CFStringRef> uid( + base::SysUTF8ToCFStringRef(device_id)); AudioValueTranslation value; value.mInputData = &uid; value.mInputDataSize = sizeof(CFStringRef); diff --git a/net/base/keygen_handler_mac.cc b/net/base/keygen_handler_mac.cc index eb31703..63ea847 100644 --- a/net/base/keygen_handler_mac.cc +++ b/net/base/keygen_handler_mac.cc @@ -113,7 +113,7 @@ std::string KeygenHandler::GenKeyAndSignChallenge() { if (url_.has_host()) { // TODO(davidben): Use something like "Key generated for // example.com", but localize it. - base::mac::ScopedCFTypeRef<CFStringRef> label( + base::ScopedCFTypeRef<CFStringRef> label( base::SysUTF8ToCFStringRef(url_.host())); // Create an initial access object to set the SecAccessRef. This // sets a label on the Keychain dialogs. Pass NULL as the second @@ -139,7 +139,7 @@ std::string KeygenHandler::GenKeyAndSignChallenge() { crypto::LogCSSMError("SecKeychainItemExpor", err); goto failure; } - base::mac::ScopedCFTypeRef<CFDataRef> scoped_key_data(key_data); + base::ScopedCFTypeRef<CFDataRef> scoped_key_data(key_data); // Create an ASN.1 encoder. err = SecAsn1CoderCreate(&coder); @@ -234,7 +234,7 @@ static OSStatus CreateRSAKeyPair(int size_in_bits, crypto::LogCSSMError("SecKeychainCopyDefault", err); return err; } - base::mac::ScopedCFTypeRef<SecKeychainRef> scoped_keychain(keychain); + base::ScopedCFTypeRef<SecKeychainRef> scoped_keychain(keychain); { base::AutoLock locked(crypto::GetMacSecurityServicesLock()); err = SecKeyCreatePair( diff --git a/net/base/network_change_notifier_mac.cc b/net/base/network_change_notifier_mac.cc index 4fe0641..d75f0f8 100644 --- a/net/base/network_change_notifier_mac.cc +++ b/net/base/network_change_notifier_mac.cc @@ -196,9 +196,9 @@ void NetworkChangeNotifierMac::SetDynamicStoreNotificationKeys( // SCDynamicStore API does not exist on iOS. NOTREACHED(); #else - base::mac::ScopedCFTypeRef<CFMutableArrayRef> notification_keys( + base::ScopedCFTypeRef<CFMutableArrayRef> notification_keys( CFArrayCreateMutable(kCFAllocatorDefault, 0, &kCFTypeArrayCallBacks)); - base::mac::ScopedCFTypeRef<CFStringRef> key( + base::ScopedCFTypeRef<CFStringRef> key( SCDynamicStoreKeyCreateNetworkGlobalEntity( NULL, kSCDynamicStoreDomainState, kSCEntNetInterface)); CFArrayAppendValue(notification_keys.get(), key.get()); diff --git a/net/base/network_change_notifier_mac.h b/net/base/network_change_notifier_mac.h index ad9429a..168ea14 100644 --- a/net/base/network_change_notifier_mac.h +++ b/net/base/network_change_notifier_mac.h @@ -67,8 +67,8 @@ class NetworkChangeNotifierMac: public NetworkChangeNotifier { bool connection_type_initialized_; mutable base::Lock connection_type_lock_; mutable base::ConditionVariable initial_connection_type_cv_; - base::mac::ScopedCFTypeRef<SCNetworkReachabilityRef> reachability_; - base::mac::ScopedCFTypeRef<CFRunLoopRef> run_loop_; + base::ScopedCFTypeRef<SCNetworkReachabilityRef> reachability_; + base::ScopedCFTypeRef<CFRunLoopRef> run_loop_; Forwarder forwarder_; scoped_ptr<const NetworkConfigWatcherMac> config_watcher_; diff --git a/net/base/network_config_watcher_mac.cc b/net/base/network_config_watcher_mac.cc index 6d044ac..4e0fa29 100644 --- a/net/base/network_config_watcher_mac.cc +++ b/net/base/network_config_watcher_mac.cc @@ -43,7 +43,7 @@ class NetworkConfigWatcherMacThread : public base::Thread { // on, so we invoke this function later on in startup to keep it fast. void InitNotifications(); - base::mac::ScopedCFTypeRef<CFRunLoopSourceRef> run_loop_source_; + base::ScopedCFTypeRef<CFRunLoopSourceRef> run_loop_source_; NetworkConfigWatcherMac::Delegate* const delegate_; base::WeakPtrFactory<NetworkConfigWatcherMacThread> weak_factory_; @@ -101,7 +101,7 @@ void NetworkConfigWatcherMacThread::InitNotifications() { NULL, // This is not reference counted. No release function. NULL, // No description for this. }; - base::mac::ScopedCFTypeRef<SCDynamicStoreRef> store(SCDynamicStoreCreate( + base::ScopedCFTypeRef<SCDynamicStoreRef> store(SCDynamicStoreCreate( NULL, CFSTR("org.chromium"), DynamicStoreCallback, &context)); run_loop_source_.reset(SCDynamicStoreCreateRunLoopSource( NULL, store.get(), 0)); diff --git a/net/base/platform_mime_util_mac.mm b/net/base/platform_mime_util_mac.mm index 99315db..1b61200 100644 --- a/net/base/platform_mime_util_mac.mm +++ b/net/base/platform_mime_util_mac.mm @@ -36,17 +36,15 @@ bool PlatformMimeUtil::GetPlatformMimeTypeFromExtension( std::string ext_nodot = ext; if (ext_nodot.length() >= 1 && ext_nodot[0] == L'.') ext_nodot.erase(ext_nodot.begin()); - base::mac::ScopedCFTypeRef<CFStringRef> ext_ref( + base::ScopedCFTypeRef<CFStringRef> ext_ref( base::SysUTF8ToCFStringRef(ext_nodot)); if (!ext_ref) return false; - base::mac::ScopedCFTypeRef<CFStringRef> uti( - UTTypeCreatePreferredIdentifierForTag(kUTTagClassFilenameExtension, - ext_ref, - NULL)); + base::ScopedCFTypeRef<CFStringRef> uti(UTTypeCreatePreferredIdentifierForTag( + kUTTagClassFilenameExtension, ext_ref, NULL)); if (!uti) return false; - base::mac::ScopedCFTypeRef<CFStringRef> mime_ref( + base::ScopedCFTypeRef<CFStringRef> mime_ref( UTTypeCopyPreferredTagWithClass(uti, kUTTagClassMIMEType)); if (!mime_ref) return false; @@ -57,17 +55,15 @@ bool PlatformMimeUtil::GetPlatformMimeTypeFromExtension( bool PlatformMimeUtil::GetPreferredExtensionForMimeType( const std::string& mime_type, base::FilePath::StringType* ext) const { - base::mac::ScopedCFTypeRef<CFStringRef> mime_ref( + base::ScopedCFTypeRef<CFStringRef> mime_ref( base::SysUTF8ToCFStringRef(mime_type)); if (!mime_ref) return false; - base::mac::ScopedCFTypeRef<CFStringRef> uti( - UTTypeCreatePreferredIdentifierForTag(kUTTagClassMIMEType, - mime_ref, - NULL)); + base::ScopedCFTypeRef<CFStringRef> uti(UTTypeCreatePreferredIdentifierForTag( + kUTTagClassMIMEType, mime_ref, NULL)); if (!uti) return false; - base::mac::ScopedCFTypeRef<CFStringRef> ext_ref( + base::ScopedCFTypeRef<CFStringRef> ext_ref( UTTypeCopyPreferredTagWithClass(uti, kUTTagClassFilenameExtension)); if (!ext_ref) return false; diff --git a/net/cert/cert_verify_proc_mac.cc b/net/cert/cert_verify_proc_mac.cc index b474fad..5acda95 100644 --- a/net/cert/cert_verify_proc_mac.cc +++ b/net/cert/cert_verify_proc_mac.cc @@ -37,7 +37,7 @@ #define kSecEVOrganizationName CFSTR("Organization") #endif -using base::mac::ScopedCFTypeRef; +using base::ScopedCFTypeRef; namespace net { diff --git a/net/cert/test_root_certs.h b/net/cert/test_root_certs.h index 8257717..22c635f 100644 --- a/net/cert/test_root_certs.h +++ b/net/cert/test_root_certs.h @@ -96,7 +96,7 @@ class NET_EXPORT_PRIVATE TestRootCerts { #elif defined(OS_WIN) HCERTSTORE temporary_roots_; #elif defined(OS_MACOSX) - base::mac::ScopedCFTypeRef<CFMutableArrayRef> temporary_roots_; + base::ScopedCFTypeRef<CFMutableArrayRef> temporary_roots_; bool allow_system_trust_; #endif diff --git a/net/cert/test_root_certs_mac.cc b/net/cert/test_root_certs_mac.cc index 50c4b80..87824d4c 100644 --- a/net/cert/test_root_certs_mac.cc +++ b/net/cert/test_root_certs_mac.cc @@ -94,8 +94,8 @@ OSStatus TestRootCerts::FixupSecTrustRef(SecTrustRef trust_ref) const { if (status) return status; - base::mac::ScopedCFTypeRef<CFArrayRef> scoped_system_roots(system_roots); - base::mac::ScopedCFTypeRef<CFMutableArrayRef> scoped_roots( + base::ScopedCFTypeRef<CFArrayRef> scoped_system_roots(system_roots); + base::ScopedCFTypeRef<CFMutableArrayRef> scoped_roots( CFArrayCreateMutableCopy(kCFAllocatorDefault, 0, scoped_system_roots)); CFArrayAppendArray(scoped_roots, temporary_roots_, CFRangeMake(0, CFArrayGetCount(temporary_roots_))); diff --git a/net/cert/x509_certificate_ios.cc b/net/cert/x509_certificate_ios.cc index aac4520..32a4883 100644 --- a/net/cert/x509_certificate_ios.cc +++ b/net/cert/x509_certificate_ios.cc @@ -36,7 +36,7 @@ #include "net/cert/x509_util_ios.h" #include "net/cert/x509_util_nss.h" -using base::mac::ScopedCFTypeRef; +using base::ScopedCFTypeRef; namespace net { namespace { diff --git a/net/cert/x509_certificate_mac.cc b/net/cert/x509_certificate_mac.cc index 6c3df6f..fd9aaca 100644 --- a/net/cert/x509_certificate_mac.cc +++ b/net/cert/x509_certificate_mac.cc @@ -28,7 +28,7 @@ #include "crypto/rsa_private_key.h" #include "net/cert/x509_util_mac.h" -using base::mac::ScopedCFTypeRef; +using base::ScopedCFTypeRef; using base::Time; namespace net { diff --git a/net/cert/x509_util_ios.cc b/net/cert/x509_util_ios.cc index 5de6d19..736c26e 100644 --- a/net/cert/x509_util_ios.cc +++ b/net/cert/x509_util_ios.cc @@ -14,7 +14,7 @@ #include "net/cert/x509_certificate.h" #include "net/cert/x509_util_nss.h" -using base::mac::ScopedCFTypeRef; +using base::ScopedCFTypeRef; namespace net { namespace x509_util_ios { diff --git a/net/proxy/proxy_config_service_ios.cc b/net/proxy/proxy_config_service_ios.cc index 7b91c4f..4d359a6 100644 --- a/net/proxy/proxy_config_service_ios.cc +++ b/net/proxy/proxy_config_service_ios.cc @@ -37,7 +37,7 @@ bool GetBoolFromDictionary(CFDictionaryRef dict, } void GetCurrentProxyConfig(ProxyConfig* config) { - base::mac::ScopedCFTypeRef<CFDictionaryRef> config_dict( + base::ScopedCFTypeRef<CFDictionaryRef> config_dict( CFNetworkCopySystemProxySettings()); DCHECK(config_dict); diff --git a/net/proxy/proxy_config_service_mac.cc b/net/proxy/proxy_config_service_mac.cc index 7b5e797..54d0054 100644 --- a/net/proxy/proxy_config_service_mac.cc +++ b/net/proxy/proxy_config_service_mac.cc @@ -42,7 +42,7 @@ bool GetBoolFromDictionary(CFDictionaryRef dict, } void GetCurrentProxyConfig(ProxyConfig* config) { - base::mac::ScopedCFTypeRef<CFDictionaryRef> config_dict( + base::ScopedCFTypeRef<CFDictionaryRef> config_dict( SCDynamicStoreCopyProxies(NULL)); DCHECK(config_dict); diff --git a/net/proxy/proxy_resolver_mac.cc b/net/proxy/proxy_resolver_mac.cc index bf7b5c5..8ddf81f 100644 --- a/net/proxy/proxy_resolver_mac.cc +++ b/net/proxy/proxy_resolver_mac.cc @@ -77,22 +77,18 @@ int ProxyResolverMac::GetProxyForURL(const GURL& query_url, const CompletionCallback& /*callback*/, RequestHandle* /*request*/, const BoundNetLog& net_log) { - base::mac::ScopedCFTypeRef<CFStringRef> query_ref( + base::ScopedCFTypeRef<CFStringRef> query_ref( base::SysUTF8ToCFStringRef(query_url.spec())); - base::mac::ScopedCFTypeRef<CFURLRef> query_url_ref( - CFURLCreateWithString(kCFAllocatorDefault, - query_ref.get(), - NULL)); + base::ScopedCFTypeRef<CFURLRef> query_url_ref( + CFURLCreateWithString(kCFAllocatorDefault, query_ref.get(), NULL)); if (!query_url_ref.get()) return ERR_FAILED; - base::mac::ScopedCFTypeRef<CFStringRef> pac_ref( - base::SysUTF8ToCFStringRef( - script_data_->type() == ProxyResolverScriptData::TYPE_AUTO_DETECT ? - std::string() : script_data_->url().spec())); - base::mac::ScopedCFTypeRef<CFURLRef> pac_url_ref( - CFURLCreateWithString(kCFAllocatorDefault, - pac_ref.get(), - NULL)); + base::ScopedCFTypeRef<CFStringRef> pac_ref(base::SysUTF8ToCFStringRef( + script_data_->type() == ProxyResolverScriptData::TYPE_AUTO_DETECT + ? std::string() + : script_data_->url().spec())); + base::ScopedCFTypeRef<CFURLRef> pac_url_ref( + CFURLCreateWithString(kCFAllocatorDefault, pac_ref.get(), NULL)); if (!pac_url_ref.get()) return ERR_FAILED; @@ -112,11 +108,9 @@ int ProxyResolverMac::GetProxyForURL(const GURL& query_url, CFTypeRef result = NULL; CFStreamClientContext context = { 0, &result, NULL, NULL, NULL }; - base::mac::ScopedCFTypeRef<CFRunLoopSourceRef> runloop_source( - CFNetworkExecuteProxyAutoConfigurationURL(pac_url_ref.get(), - query_url_ref.get(), - ResultCallback, - &context)); + base::ScopedCFTypeRef<CFRunLoopSourceRef> runloop_source( + CFNetworkExecuteProxyAutoConfigurationURL( + pac_url_ref.get(), query_url_ref.get(), ResultCallback, &context)); if (!runloop_source) return ERR_FAILED; @@ -135,7 +129,7 @@ int ProxyResolverMac::GetProxyForURL(const GURL& query_url, CFRelease(result); return ERR_FAILED; } - base::mac::ScopedCFTypeRef<CFArrayRef> proxy_array_ref( + base::ScopedCFTypeRef<CFArrayRef> proxy_array_ref( base::mac::CFCastStrict<CFArrayRef>(result)); DCHECK(proxy_array_ref != NULL); diff --git a/net/ssl/client_cert_store_impl_mac.cc b/net/ssl/client_cert_store_impl_mac.cc index 5fa42de..3345735 100644 --- a/net/ssl/client_cert_store_impl_mac.cc +++ b/net/ssl/client_cert_store_impl_mac.cc @@ -23,7 +23,7 @@ #include "net/cert/x509_util.h" #include "net/cert/x509_util_mac.h" -using base::mac::ScopedCFTypeRef; +using base::ScopedCFTypeRef; namespace net { diff --git a/printing/image_mac.cc b/printing/image_mac.cc index 7d45178..2ec9ef6 100644 --- a/printing/image_mac.cc +++ b/printing/image_mac.cc @@ -25,11 +25,15 @@ bool Image::LoadMetafile(const Metafile& metafile) { DCHECK(bytes); data_.resize(bytes); - base::mac::ScopedCFTypeRef<CGColorSpaceRef> color_space( + base::ScopedCFTypeRef<CGColorSpaceRef> color_space( CGColorSpaceCreateWithName(kCGColorSpaceGenericRGB)); - base::mac::ScopedCFTypeRef<CGContextRef> bitmap_context( - CGBitmapContextCreate(&*data_.begin(), size_.width(), size_.height(), - 8, row_length_, color_space, + base::ScopedCFTypeRef<CGContextRef> bitmap_context( + CGBitmapContextCreate(&*data_.begin(), + size_.width(), + size_.height(), + 8, + row_length_, + color_space, kCGImageAlphaPremultipliedLast)); DCHECK(bitmap_context.get()); diff --git a/printing/pdf_metafile_cg_mac.cc b/printing/pdf_metafile_cg_mac.cc index e11ad08..cd7c5c7e 100644 --- a/printing/pdf_metafile_cg_mac.cc +++ b/printing/pdf_metafile_cg_mac.cc @@ -16,7 +16,7 @@ #include "ui/gfx/rect.h" #include "ui/gfx/size.h" -using base::mac::ScopedCFTypeRef; +using base::ScopedCFTypeRef; namespace { diff --git a/printing/pdf_metafile_cg_mac.h b/printing/pdf_metafile_cg_mac.h index f4dd81a..77f7031 100644 --- a/printing/pdf_metafile_cg_mac.h +++ b/printing/pdf_metafile_cg_mac.h @@ -71,13 +71,13 @@ class PRINTING_EXPORT PdfMetafileCg : public Metafile { base::ThreadChecker thread_checker_; // Context for rendering to the pdf. - base::mac::ScopedCFTypeRef<CGContextRef> context_; + base::ScopedCFTypeRef<CGContextRef> context_; // PDF backing store. - base::mac::ScopedCFTypeRef<CFMutableDataRef> pdf_data_; + base::ScopedCFTypeRef<CFMutableDataRef> pdf_data_; // Lazily-created CGPDFDocument representation of pdf_data_. - mutable base::mac::ScopedCFTypeRef<CGPDFDocumentRef> pdf_doc_; + mutable base::ScopedCFTypeRef<CGPDFDocumentRef> pdf_doc_; // Whether or not a page is currently open. bool page_is_open_; diff --git a/printing/printing_context_mac.mm b/printing/printing_context_mac.mm index 407406c..4d83c13 100644 --- a/printing/printing_context_mac.mm +++ b/printing/printing_context_mac.mm @@ -214,7 +214,7 @@ bool PrintingContextMac::SetPrinter(const std::string& device_name) { if (!current_printer_id) return false; - base::mac::ScopedCFTypeRef<CFStringRef> new_printer_id( + base::ScopedCFTypeRef<CFStringRef> new_printer_id( base::SysUTF8ToCFStringRef(device_name)); if (!new_printer_id.get()) return false; @@ -385,9 +385,9 @@ bool PrintingContextMac::SetOutputColor(int color_mode) { std::string color_setting_name; std::string color_value; GetColorModelForMode(color_mode, &color_setting_name, &color_value); - base::mac::ScopedCFTypeRef<CFStringRef> color_setting( + base::ScopedCFTypeRef<CFStringRef> color_setting( base::SysUTF8ToCFStringRef(color_setting_name)); - base::mac::ScopedCFTypeRef<CFStringRef> output_color( + base::ScopedCFTypeRef<CFStringRef> output_color( base::SysUTF8ToCFStringRef(color_value)); return PMPrintSettingsSetValue(pmPrintSettings, @@ -432,7 +432,7 @@ PrintingContext::Result PrintingContextMac::NewDocument( PMPageFormat page_format = static_cast<PMPageFormat>([print_info_.get() PMPageFormat]); - base::mac::ScopedCFTypeRef<CFStringRef> job_title( + base::ScopedCFTypeRef<CFStringRef> job_title( base::SysUTF16ToCFStringRef(document_name)); PMPrintSettingsSetJobName(print_settings, job_title.get()); diff --git a/remoting/host/curtain_mode_mac.cc b/remoting/host/curtain_mode_mac.cc index b68ab11..aa85156 100644 --- a/remoting/host/curtain_mode_mac.cc +++ b/remoting/host/curtain_mode_mac.cc @@ -134,7 +134,7 @@ void SessionWatcher::ActivateCurtain() { return; } - base::mac::ScopedCFTypeRef<CFDictionaryRef> session( + base::ScopedCFTypeRef<CFDictionaryRef> session( CGSessionCopyCurrentDictionary()); // CGSessionCopyCurrentDictionary has been observed to return NULL in some diff --git a/remoting/host/desktop_resizer_mac.cc b/remoting/host/desktop_resizer_mac.cc index d1d6c2c..22cc67e 100644 --- a/remoting/host/desktop_resizer_mac.cc +++ b/remoting/host/desktop_resizer_mac.cc @@ -31,7 +31,7 @@ class DesktopResizerMac : public DesktopResizer { bool GetSoleDisplayId(CGDirectDisplayID* display); void GetSupportedModesAndSizes( - base::mac::ScopedCFTypeRef<CFMutableArrayRef>* modes, + base::ScopedCFTypeRef<CFMutableArrayRef>* modes, std::list<SkISize>* sizes); DISALLOW_COPY_AND_ASSIGN(DesktopResizerMac); @@ -50,7 +50,7 @@ SkISize DesktopResizerMac::GetCurrentSize() { std::list<SkISize> DesktopResizerMac::GetSupportedSizes( const SkISize& preferred) { - base::mac::ScopedCFTypeRef<CFMutableArrayRef> modes; + base::ScopedCFTypeRef<CFMutableArrayRef> modes; std::list<SkISize> sizes; GetSupportedModesAndSizes(&modes, &sizes); return sizes; @@ -62,7 +62,7 @@ void DesktopResizerMac::SetSize(const SkISize& size) { return; } - base::mac::ScopedCFTypeRef<CFMutableArrayRef> modes; + base::ScopedCFTypeRef<CFMutableArrayRef> modes; std::list<SkISize> sizes; GetSupportedModesAndSizes(&modes, &sizes); // There may be many modes with the requested size. Pick the one with the @@ -76,7 +76,7 @@ void DesktopResizerMac::SetSize(const SkISize& size) { static_cast<const CGDisplayMode*>( CFArrayGetValueAtIndex(modes, index))); int depth = 0; - base::mac::ScopedCFTypeRef<CFStringRef> encoding( + base::ScopedCFTypeRef<CFStringRef> encoding( CGDisplayModeCopyPixelEncoding(mode)); if (CFStringCompare(encoding, CFSTR(IO32BitDirectPixels), kCFCompareCaseInsensitive) == kCFCompareEqualTo) { @@ -108,12 +108,12 @@ void DesktopResizerMac::RestoreSize(const SkISize& original) { } void DesktopResizerMac::GetSupportedModesAndSizes( - base::mac::ScopedCFTypeRef<CFMutableArrayRef>* modes, + base::ScopedCFTypeRef<CFMutableArrayRef>* modes, std::list<SkISize>* sizes) { CGDirectDisplayID display; if (GetSoleDisplayId(&display)) { - base::mac::ScopedCFTypeRef<CFArrayRef> - all_modes(CGDisplayCopyAllDisplayModes(display, NULL)); + base::ScopedCFTypeRef<CFArrayRef> all_modes( + CGDisplayCopyAllDisplayModes(display, NULL)); modes->reset(CFArrayCreateMutableCopy(NULL, 0, all_modes)); CFIndex count = CFArrayGetCount(*modes); for (CFIndex i = 0; i < count; ++i) { diff --git a/remoting/host/input_injector_mac.cc b/remoting/host/input_injector_mac.cc index 0fc0379..fe7d80a 100644 --- a/remoting/host/input_injector_mac.cc +++ b/remoting/host/input_injector_mac.cc @@ -251,9 +251,8 @@ void InputInjectorMac::Core::InjectMouseEvent(const MouseEvent& event) { if (event.has_wheel_delta_x() && event.has_wheel_delta_y()) { int delta_x = static_cast<int>(event.wheel_delta_x()); int delta_y = static_cast<int>(event.wheel_delta_y()); - base::mac::ScopedCFTypeRef<CGEventRef> event( - CGEventCreateScrollWheelEvent( - NULL, kCGScrollEventUnitPixel, 2, delta_y, delta_x)); + base::ScopedCFTypeRef<CGEventRef> event(CGEventCreateScrollWheelEvent( + NULL, kCGScrollEventUnitPixel, 2, delta_y, delta_x)); if (event) CGEventPost(kCGSessionEventTap, event); } diff --git a/remoting/host/local_input_monitor_mac.mm b/remoting/host/local_input_monitor_mac.mm index f38489a..3144ca8 100644 --- a/remoting/host/local_input_monitor_mac.mm +++ b/remoting/host/local_input_monitor_mac.mm @@ -60,7 +60,7 @@ class LocalInputMonitorMac : public base::NonThreadSafe, @private GTMCarbonHotKey* hotKey_; CFRunLoopSourceRef mouseRunLoopSource_; - base::mac::ScopedCFTypeRef<CFMachPortRef> mouseMachPort_; + base::ScopedCFTypeRef<CFMachPortRef> mouseMachPort_; remoting::LocalInputMonitorMac::EventHandler* monitor_; } diff --git a/remoting/host/policy_hack/policy_watcher_mac.mm b/remoting/host/policy_hack/policy_watcher_mac.mm index 82cc219..64e7ab0 100644 --- a/remoting/host/policy_hack/policy_watcher_mac.mm +++ b/remoting/host/policy_hack/policy_watcher_mac.mm @@ -48,7 +48,7 @@ class PolicyWatcherMac : public PolicyWatcher { for (base::DictionaryValue::Iterator i(Defaults()); !i.IsAtEnd(); i.Advance()) { const std::string& policy_name = i.key(); - base::mac::ScopedCFTypeRef<CFStringRef> policy_key( + base::ScopedCFTypeRef<CFStringRef> policy_key( base::SysUTF8ToCFStringRef(policy_name)); if (i.value().GetType() == base::DictionaryValue::TYPE_BOOLEAN) { @@ -62,7 +62,7 @@ class PolicyWatcherMac : public PolicyWatcher { } if (i.value().GetType() == base::DictionaryValue::TYPE_STRING) { - base::mac::ScopedCFTypeRef<CFPropertyListRef> property_list( + base::ScopedCFTypeRef<CFPropertyListRef> property_list( CFPreferencesCopyAppValue(policy_key, policy_bundle_id)); if (property_list.get() != NULL) { CFStringRef policy_value = base::mac::CFCast<CFStringRef>( diff --git a/remoting/host/setup/daemon_controller_mac.mm b/remoting/host/setup/daemon_controller_mac.mm index 91773be..1c5a8b18 100644 --- a/remoting/host/setup/daemon_controller_mac.mm +++ b/remoting/host/setup/daemon_controller_mac.mm @@ -299,9 +299,8 @@ bool DaemonControllerMac::DoShowPreferencePane(const std::string& config_data) { CFNotificationCenterRef center = CFNotificationCenterGetDistributedCenter(); - base::mac::ScopedCFTypeRef<CFStringRef> service_name( - CFStringCreateWithCString(kCFAllocatorDefault, remoting::kServiceName, - kCFStringEncodingUTF8)); + base::ScopedCFTypeRef<CFStringRef> service_name(CFStringCreateWithCString( + kCFAllocatorDefault, remoting::kServiceName, kCFStringEncodingUTF8)); CFNotificationCenterPostNotification(center, service_name, NULL, NULL, TRUE); return true; diff --git a/rlz/mac/lib/machine_id_mac.cc b/rlz/mac/lib/machine_id_mac.cc index 12b3214..f16175b 100644 --- a/rlz/mac/lib/machine_id_mac.cc +++ b/rlz/mac/lib/machine_id_mac.cc @@ -25,13 +25,14 @@ namespace { // The caller is responsible for freeing |matching_services|. bool FindEthernetInterfaces(io_iterator_t* matching_services) { - base::mac::ScopedCFTypeRef<CFMutableDictionaryRef> matching_dict( + base::ScopedCFTypeRef<CFMutableDictionaryRef> matching_dict( IOServiceMatching(kIOEthernetInterfaceClass)); if (!matching_dict) return false; - base::mac::ScopedCFTypeRef<CFMutableDictionaryRef> primary_interface( - CFDictionaryCreateMutable(kCFAllocatorDefault, 0, + base::ScopedCFTypeRef<CFMutableDictionaryRef> primary_interface( + CFDictionaryCreateMutable(kCFAllocatorDefault, + 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks)); if (!primary_interface) @@ -69,7 +70,7 @@ bool GetMACAddressFromIterator(io_iterator_t primary_interface_iterator, if (!success) continue; - base::mac::ScopedCFTypeRef<CFTypeRef> mac_data( + base::ScopedCFTypeRef<CFTypeRef> mac_data( IORegistryEntryCreateCFProperty(primary_interface_parent, CFSTR(kIOMACAddress), kCFAllocatorDefault, @@ -101,7 +102,7 @@ CFStringRef CopySerialNumber() { if (!expert_device) return NULL; - base::mac::ScopedCFTypeRef<CFTypeRef> serial_number( + base::ScopedCFTypeRef<CFTypeRef> serial_number( IORegistryEntryCreateCFProperty(expert_device, CFSTR(kIOPlatformSerialNumberKey), kCFAllocatorDefault, diff --git a/skia/ext/skia_utils_ios.mm b/skia/ext/skia_utils_ios.mm index 72c69a0..80c50fd 100644 --- a/skia/ext/skia_utils_ios.mm +++ b/skia/ext/skia_utils_ios.mm @@ -31,13 +31,16 @@ SkBitmap CGImageToSkBitmap(CGImageRef image, CGSize size, bool is_opaque) { (SK_A32_SHIFT == (a) && SK_R32_SHIFT == (r) \ && SK_G32_SHIFT == (g) && SK_B32_SHIFT == (b)) #if defined(SK_CPU_LENDIAN) && HAS_ARGB_SHIFTS(24, 16, 8, 0) - base::mac::ScopedCFTypeRef<CGColorSpaceRef> color_space( + base::ScopedCFTypeRef<CGColorSpaceRef> color_space( CGColorSpaceCreateDeviceRGB()); - base::mac::ScopedCFTypeRef<CGContextRef> context( - CGBitmapContextCreate(data, size.width, size.height, 8, size.width*4, - color_space, - kCGImageAlphaPremultipliedFirst | - kCGBitmapByteOrder32Host)); + base::ScopedCFTypeRef<CGContextRef> context(CGBitmapContextCreate( + data, + size.width, + size.height, + 8, + size.width * 4, + color_space, + kCGImageAlphaPremultipliedFirst | kCGBitmapByteOrder32Host)); #else #error We require that Skia's and CoreGraphics's recommended \ image memory layout match. @@ -62,7 +65,7 @@ UIImage* SkBitmapToUIImageWithColorSpace(const SkBitmap& skia_bitmap, return nil; // First convert SkBitmap to CGImageRef. - base::mac::ScopedCFTypeRef<CGImageRef> cg_image( + base::ScopedCFTypeRef<CGImageRef> cg_image( SkCreateCGImageRefWithColorspace(skia_bitmap, color_space)); // Now convert to UIImage. @@ -73,16 +76,16 @@ UIImage* SkBitmapToUIImageWithColorSpace(const SkBitmap& skia_bitmap, std::vector<SkBitmap> ImageDataToSkBitmaps(NSData* image_data) { DCHECK(image_data); - base::mac::ScopedCFTypeRef<CFDictionaryRef> empty_dictionary( + base::ScopedCFTypeRef<CFDictionaryRef> empty_dictionary( CFDictionaryCreate(NULL, NULL, NULL, 0, NULL, NULL)); std::vector<SkBitmap> frames; - base::mac::ScopedCFTypeRef<CGImageSourceRef> source( + base::ScopedCFTypeRef<CGImageSourceRef> source( CGImageSourceCreateWithData((CFDataRef)image_data, empty_dictionary)); size_t count = CGImageSourceGetCount(source); for (size_t index = 0; index < count; ++index) { - base::mac::ScopedCFTypeRef<CGImageRef> cg_image( + base::ScopedCFTypeRef<CGImageRef> cg_image( CGImageSourceCreateImageAtIndex(source, index, empty_dictionary)); CGSize size = CGSizeMake(CGImageGetWidth(cg_image), diff --git a/skia/ext/skia_utils_mac.mm b/skia/ext/skia_utils_mac.mm index f181f0a..5622b5d 100644 --- a/skia/ext/skia_utils_mac.mm +++ b/skia/ext/skia_utils_mac.mm @@ -32,7 +32,7 @@ SkBitmap NSImageOrNSImageRepToSkBitmap( bitmap.setIsOpaque(is_opaque); - base::mac::ScopedCFTypeRef<CGColorSpaceRef> color_space( + base::ScopedCFTypeRef<CGColorSpaceRef> color_space( CGColorSpaceCreateWithName(kCGColorSpaceGenericRGB)); void* data = bitmap.getPixels(); @@ -42,11 +42,14 @@ SkBitmap NSImageOrNSImageRepToSkBitmap( (SK_A32_SHIFT == (a) && SK_R32_SHIFT == (r) \ && SK_G32_SHIFT == (g) && SK_B32_SHIFT == (b)) #if defined(SK_CPU_LENDIAN) && HAS_ARGB_SHIFTS(24, 16, 8, 0) - base::mac::ScopedCFTypeRef<CGContextRef> context( - CGBitmapContextCreate(data, size.width, size.height, 8, size.width*4, - color_space, - kCGImageAlphaPremultipliedFirst | - kCGBitmapByteOrder32Host)); + base::ScopedCFTypeRef<CGContextRef> context(CGBitmapContextCreate( + data, + size.width, + size.height, + 8, + size.width * 4, + color_space, + kCGImageAlphaPremultipliedFirst | kCGBitmapByteOrder32Host)); #else #error We require that Skia's and CoreGraphics's recommended \ image memory layout match. @@ -212,7 +215,7 @@ SkBitmap NSImageRepToSkBitmap( } NSBitmapImageRep* SkBitmapToNSBitmapImageRep(const SkBitmap& skiaBitmap) { - base::mac::ScopedCFTypeRef<CGColorSpaceRef> color_space( + base::ScopedCFTypeRef<CGColorSpaceRef> color_space( CGColorSpaceCreateWithName(kCGColorSpaceGenericRGB)); return SkBitmapToNSBitmapImageRepWithColorSpace(skiaBitmap, color_space); } @@ -221,7 +224,7 @@ NSBitmapImageRep* SkBitmapToNSBitmapImageRepWithColorSpace( const SkBitmap& skiaBitmap, CGColorSpaceRef colorSpace) { // First convert SkBitmap to CGImageRef. - base::mac::ScopedCFTypeRef<CGImageRef> cgimage( + base::ScopedCFTypeRef<CGImageRef> cgimage( SkCreateCGImageRefWithColorspace(skiaBitmap, colorSpace)); // Now convert to NSBitmapImageRep. @@ -243,7 +246,7 @@ NSImage* SkBitmapToNSImageWithColorSpace(const SkBitmap& skiaBitmap, } NSImage* SkBitmapToNSImage(const SkBitmap& skiaBitmap) { - base::mac::ScopedCFTypeRef<CGColorSpaceRef> colorSpace( + base::ScopedCFTypeRef<CGColorSpaceRef> colorSpace( CGColorSpaceCreateWithName(kCGColorSpaceGenericRGB)); return SkBitmapToNSImageWithColorSpace(skiaBitmap, colorSpace.get()); } @@ -363,7 +366,7 @@ CGContextRef SkiaBitLocker::cgContext() { bitmap_.allocPixels(); bitmap_.eraseColor(0); } - base::mac::ScopedCFTypeRef<CGColorSpaceRef> colorSpace( + base::ScopedCFTypeRef<CGColorSpaceRef> colorSpace( CGColorSpaceCreateDeviceRGB()); cgContext_ = CGBitmapContextCreate(bitmap_.getPixels(), bitmap_.width(), bitmap_.height(), 8, bitmap_.rowBytes(), colorSpace, diff --git a/sync/util/get_session_name_mac.mm b/sync/util/get_session_name_mac.mm index f576ea7..aa61e2f 100644 --- a/sync/util/get_session_name_mac.mm +++ b/sync/util/get_session_name_mac.mm @@ -17,16 +17,15 @@ namespace internal { std::string GetHardwareModelName() { // Do not use NSHost currentHost, as it's very slow. http://crbug.com/138570 SCDynamicStoreContext context = { 0, NULL, NULL, NULL }; - base::mac::ScopedCFTypeRef<SCDynamicStoreRef> store( - SCDynamicStoreCreate(kCFAllocatorDefault, CFSTR("chrome_sync"), - NULL, &context)); - base::mac::ScopedCFTypeRef<CFStringRef> machine_name( + base::ScopedCFTypeRef<SCDynamicStoreRef> store(SCDynamicStoreCreate( + kCFAllocatorDefault, CFSTR("chrome_sync"), NULL, &context)); + base::ScopedCFTypeRef<CFStringRef> machine_name( SCDynamicStoreCopyLocalHostName(store.get())); if (machine_name.get()) return base::SysCFStringRefToUTF8(machine_name.get()); // Fall back to get computer name. - base::mac::ScopedCFTypeRef<CFStringRef> computer_name( + base::ScopedCFTypeRef<CFStringRef> computer_name( SCDynamicStoreCopyComputerName(store.get(), NULL)); if (computer_name.get()) return base::SysCFStringRefToUTF8(computer_name.get()); diff --git a/third_party/sudden_motion_sensor/sudden_motion_sensor_mac.cc b/third_party/sudden_motion_sensor/sudden_motion_sensor_mac.cc index 4835ca7..d805443 100644 --- a/third_party/sudden_motion_sensor/sudden_motion_sensor_mac.cc +++ b/third_party/sudden_motion_sensor/sudden_motion_sensor_mac.cc @@ -310,7 +310,7 @@ bool SuddenMotionSensor::Init() { const SensorDescriptor* sensor_candidate = NULL; // Look for the current model in the supported sensor list. - base::mac::ScopedCFTypeRef<CFDataRef> board_id_data; + base::ScopedCFTypeRef<CFDataRef> board_id_data; const int kNumSensors = arraysize(kSupportedSensors); for (int i = 0; i < kNumSensors; ++i) { diff --git a/ui/base/clipboard/clipboard_mac.mm b/ui/base/clipboard/clipboard_mac.mm index 759e5a0..bb5bfae 100644 --- a/ui/base/clipboard/clipboard_mac.mm +++ b/ui/base/clipboard/clipboard_mac.mm @@ -159,21 +159,21 @@ void Clipboard::WriteBitmap(const char* pixel_data, const char* size_data) { const gfx::Size* size = reinterpret_cast<const gfx::Size*>(size_data); // Safe because the image goes away before the call returns. - base::mac::ScopedCFTypeRef<CFDataRef> data( + base::ScopedCFTypeRef<CFDataRef> data( CFDataCreateWithBytesNoCopy(kCFAllocatorDefault, reinterpret_cast<const UInt8*>(pixel_data), - size->width()*size->height()*4, + size->width() * size->height() * 4, kCFAllocatorNull)); - base::mac::ScopedCFTypeRef<CGDataProviderRef> data_provider( + base::ScopedCFTypeRef<CGDataProviderRef> data_provider( CGDataProviderCreateWithCFData(data)); - base::mac::ScopedCFTypeRef<CGImageRef> cgimage( + base::ScopedCFTypeRef<CGImageRef> cgimage( CGImageCreate(size->width(), size->height(), 8, 32, - size->width()*4, + size->width() * 4, base::mac::GetSRGBColorSpace(), // TODO(avi): do better kCGImageAlphaPremultipliedFirst | kCGBitmapByteOrder32Host, data_provider, diff --git a/ui/base/resource/resource_bundle_ios.mm b/ui/base/resource/resource_bundle_ios.mm index f4919d7..d9f1fb5 100644 --- a/ui/base/resource/resource_bundle_ios.mm +++ b/ui/base/resource/resource_bundle_ios.mm @@ -135,15 +135,16 @@ gfx::Image& ResourceBundle::GetNativeImageNamed(int resource_id, ImageRTL rtl) { CGSize source_size = [ui_image size]; CGSize target_size = CGSizeMake(source_size.width * target_scale, source_size.height * target_scale); - base::mac::ScopedCFTypeRef<CGColorSpaceRef> color_space( + base::ScopedCFTypeRef<CGColorSpaceRef> color_space( CGColorSpaceCreateDeviceRGB()); - base::mac::ScopedCFTypeRef<CGContextRef> context( - CGBitmapContextCreate( - NULL, - target_size.width, target_size.height, - 8, target_size.width * 4, - color_space, - kCGImageAlphaPremultipliedFirst | kCGBitmapByteOrder32Host)); + base::ScopedCFTypeRef<CGContextRef> context(CGBitmapContextCreate( + NULL, + target_size.width, + target_size.height, + 8, + target_size.width * 4, + color_space, + kCGImageAlphaPremultipliedFirst | kCGBitmapByteOrder32Host)); CGRect target_rect = CGRectMake(0, 0, target_size.width, target_size.height); @@ -158,7 +159,7 @@ gfx::Image& ResourceBundle::GetNativeImageNamed(int resource_id, ImageRTL rtl) { CGContextFillRect(context, target_rect); } - base::mac::ScopedCFTypeRef<CGImageRef> cg_image( + base::ScopedCFTypeRef<CGImageRef> cg_image( CGBitmapContextCreateImage(context)); ui_image.reset([[UIImage alloc] initWithCGImage:cg_image scale:target_scale diff --git a/ui/gfx/blit.cc b/ui/gfx/blit.cc index 9bb7e4a..a0bae8a 100644 --- a/ui/gfx/blit.cc +++ b/ui/gfx/blit.cc @@ -71,9 +71,9 @@ void BlitContextToContext(NativeDrawingContext dst_context, : transform.ty; src_rect.Offset(transform.tx, delta_y); - base::mac::ScopedCFTypeRef<CGImageRef> - src_image(CGBitmapContextCreateImage(src_context)); - base::mac::ScopedCFTypeRef<CGImageRef> src_sub_image( + base::ScopedCFTypeRef<CGImageRef> src_image( + CGBitmapContextCreateImage(src_context)); + base::ScopedCFTypeRef<CGImageRef> src_sub_image( CGImageCreateWithImageInRect(src_image, src_rect.ToCGRect())); CGContextDrawImage(dst_context, dst_rect.ToCGRect(), src_sub_image); #elif defined(OS_ANDROID) diff --git a/ui/gfx/color_profile_mac.cc b/ui/gfx/color_profile_mac.cc index c313745..2c7f686 100644 --- a/ui/gfx/color_profile_mac.cc +++ b/ui/gfx/color_profile_mac.cc @@ -10,7 +10,7 @@ namespace gfx { void ReadColorProfile(std::vector<char>* profile) { CGColorSpaceRef monitor_color_space(base::mac::GetSystemColorSpace()); - base::mac::ScopedCFTypeRef<CFDataRef> icc_profile( + base::ScopedCFTypeRef<CFDataRef> icc_profile( CGColorSpaceCopyICCProfile(monitor_color_space)); if (icc_profile) { size_t length = CFDataGetLength(icc_profile); diff --git a/ui/gfx/image/image_ios.mm b/ui/gfx/image/image_ios.mm index 1e21bd8..e2ff8dc 100644 --- a/ui/gfx/image/image_ios.mm +++ b/ui/gfx/image/image_ios.mm @@ -27,20 +27,19 @@ namespace { // Caller takes ownership of returned UIImage. UIImage* CreateErrorUIImage(float scale) { LOG(ERROR) << "Unable to decode PNG into UIImage."; - base::mac::ScopedCFTypeRef<CGColorSpaceRef> color_space( + base::ScopedCFTypeRef<CGColorSpaceRef> color_space( CGColorSpaceCreateDeviceRGB()); - base::mac::ScopedCFTypeRef<CGContextRef> context( - CGBitmapContextCreate(NULL, // Allow CG to allocate memory. - 16, // width - 16, // height - 8, // bitsPerComponent - 0, // CG will calculate by default. - color_space, - kCGImageAlphaPremultipliedFirst | - kCGBitmapByteOrder32Host)); + base::ScopedCFTypeRef<CGContextRef> context(CGBitmapContextCreate( + NULL, // Allow CG to allocate memory. + 16, // width + 16, // height + 8, // bitsPerComponent + 0, // CG will calculate by default. + color_space, + kCGImageAlphaPremultipliedFirst | kCGBitmapByteOrder32Host)); CGContextSetRGBFillColor(context, 1.0, 0.0, 0.0, 1.0); CGContextFillRect(context, CGRectMake(0.0, 0.0, 16, 16)); - base::mac::ScopedCFTypeRef<CGImageRef> cg_image( + base::ScopedCFTypeRef<CGImageRef> cg_image( CGBitmapContextCreateImage(context)); return [[UIImage imageWithCGImage:cg_image.get() scale:scale diff --git a/ui/gfx/image/image_skia_util_ios.mm b/ui/gfx/image/image_skia_util_ios.mm index 2d4afed..0ff8978 100644 --- a/ui/gfx/image/image_skia_util_ios.mm +++ b/ui/gfx/image/image_skia_util_ios.mm @@ -49,7 +49,7 @@ UIImage* UIImageFromImageSkiaRep(const gfx::ImageSkiaRep& image_skia_rep) { return nil; float scale = ui::GetScaleFactorScale(image_skia_rep.scale_factor()); - base::mac::ScopedCFTypeRef<CGColorSpaceRef> color_space( + base::ScopedCFTypeRef<CGColorSpaceRef> color_space( CGColorSpaceCreateDeviceRGB()); return gfx::SkBitmapToUIImageWithColorSpace(image_skia_rep.sk_bitmap(), scale, color_space); diff --git a/ui/gfx/image/image_unittest_util.cc b/ui/gfx/image/image_unittest_util.cc index b011413..ef59eb6 100644 --- a/ui/gfx/image/image_unittest_util.cc +++ b/ui/gfx/image/image_unittest_util.cc @@ -186,7 +186,7 @@ PlatformImage CreatePlatformImage() { ui::ScaleFactor scale_factor = ui::GetMaxScaleFactor(); float scale = ui::GetScaleFactorScale(scale_factor); - base::mac::ScopedCFTypeRef<CGColorSpaceRef> color_space( + base::ScopedCFTypeRef<CGColorSpaceRef> color_space( CGColorSpaceCreateDeviceRGB()); UIImage* image = gfx::SkBitmapToUIImageWithColorSpace(bitmap, scale, color_space); diff --git a/ui/gfx/image/image_unittest_util_ios.mm b/ui/gfx/image/image_unittest_util_ios.mm index f2d200d..5626617 100644 --- a/ui/gfx/image/image_unittest_util_ios.mm +++ b/ui/gfx/image/image_unittest_util_ios.mm @@ -14,19 +14,20 @@ namespace test { SkColor GetPlatformImageColor(PlatformImage image, int x, int y) { // Start by extracting the target pixel into a 1x1 CGImage. - base::mac::ScopedCFTypeRef<CGImageRef> pixel_image( + base::ScopedCFTypeRef<CGImageRef> pixel_image( CGImageCreateWithImageInRect(image.CGImage, CGRectMake(x, y, 1, 1))); // Draw that pixel into a 1x1 bitmap context. - base::mac::ScopedCFTypeRef<CGColorSpaceRef> color_space( + base::ScopedCFTypeRef<CGColorSpaceRef> color_space( CGColorSpaceCreateDeviceRGB()); - base::mac::ScopedCFTypeRef<CGContextRef> bitmap_context( - CGBitmapContextCreate(/*data=*/ NULL, - /*width=*/ 1, /*height=*/ 1, - /*bitsPerComponent=*/ 8, /*bytesPerRow=*/ 4, - color_space, - kCGImageAlphaPremultipliedFirst | - kCGBitmapByteOrder32Host)); + base::ScopedCFTypeRef<CGContextRef> bitmap_context(CGBitmapContextCreate( + /*data=*/ NULL, + /*width=*/ 1, + /*height=*/ 1, + /*bitsPerComponent=*/ 8, + /*bytesPerRow=*/ 4, + color_space, + kCGImageAlphaPremultipliedFirst | kCGBitmapByteOrder32Host)); CGContextDrawImage(bitmap_context, CGRectMake(0, 0, 1, 1), pixel_image); // The CGBitmapContext has the same memory layout as SkColor, so we can just diff --git a/ui/gfx/render_text_mac.cc b/ui/gfx/render_text_mac.cc index 67a547d..f6a1b78 100644 --- a/ui/gfx/render_text_mac.cc +++ b/ui/gfx/render_text_mac.cc @@ -107,22 +107,26 @@ void RenderTextMac::EnsureLayout() { runs_valid_ = false; const Font& font = GetFont(); - base::mac::ScopedCFTypeRef<CFStringRef> font_name_cf_string( + base::ScopedCFTypeRef<CFStringRef> font_name_cf_string( base::SysUTF8ToCFStringRef(font.GetFontName())); - base::mac::ScopedCFTypeRef<CTFontRef> ct_font( + base::ScopedCFTypeRef<CTFontRef> ct_font( CTFontCreateWithName(font_name_cf_string, font.GetFontSize(), NULL)); const void* keys[] = { kCTFontAttributeName }; const void* values[] = { ct_font }; - base::mac::ScopedCFTypeRef<CFDictionaryRef> attributes( - CFDictionaryCreate(NULL, keys, values, arraysize(keys), NULL, + base::ScopedCFTypeRef<CFDictionaryRef> attributes( + CFDictionaryCreate(NULL, + keys, + values, + arraysize(keys), + NULL, &kCFTypeDictionaryValueCallBacks)); - base::mac::ScopedCFTypeRef<CFStringRef> cf_text( + base::ScopedCFTypeRef<CFStringRef> cf_text( base::SysUTF16ToCFStringRef(text())); - base::mac::ScopedCFTypeRef<CFAttributedStringRef> attr_text( + base::ScopedCFTypeRef<CFAttributedStringRef> attr_text( CFAttributedStringCreate(NULL, cf_text, attributes)); - base::mac::ScopedCFTypeRef<CFMutableAttributedStringRef> attr_text_mutable( + base::ScopedCFTypeRef<CFMutableAttributedStringRef> attr_text_mutable( CFAttributedStringCreateMutableCopy(NULL, 0, attr_text)); // TODO(asvitkine|msw): Respect GetTextDirection(), which may not match the @@ -193,7 +197,7 @@ void RenderTextMac::ApplyStyles(CFMutableAttributedStringRef attr_string, for (size_t i = 0, end = 0; i < layout_text_length; i = end) { end = TextIndexToLayoutIndex(style.GetRange().end()); const CFRange range = CFRangeMake(i, end - i); - base::mac::ScopedCFTypeRef<CGColorRef> foreground( + base::ScopedCFTypeRef<CGColorRef> foreground( gfx::CGColorCreateFromSkColor(style.color())); CFAttributedStringSetAttribute(attr_string, range, kCTForegroundColorAttributeName, foreground); @@ -201,7 +205,7 @@ void RenderTextMac::ApplyStyles(CFMutableAttributedStringRef attr_string, if (style.style(UNDERLINE)) { CTUnderlineStyle value = kCTUnderlineStyleSingle; - base::mac::ScopedCFTypeRef<CFNumberRef> underline_value( + base::ScopedCFTypeRef<CFNumberRef> underline_value( CFNumberCreate(NULL, kCFNumberSInt32Type, &value)); CFAttributedStringSetAttribute(attr_string, range, kCTUnderlineStyleAttributeName, @@ -212,7 +216,7 @@ void RenderTextMac::ApplyStyles(CFMutableAttributedStringRef attr_string, const int traits = (style.style(BOLD) ? kCTFontBoldTrait : 0) | (style.style(ITALIC) ? kCTFontItalicTrait : 0); if (traits != 0) { - base::mac::ScopedCFTypeRef<CTFontRef> styled_font( + base::ScopedCFTypeRef<CTFontRef> styled_font( CTFontCreateCopyWithSymbolicTraits(font, 0.0, NULL, traits, traits)); // TODO(asvitkine): Handle |styled_font| == NULL case better. if (styled_font) { @@ -293,7 +297,7 @@ void RenderTextMac::ComputeRuns() { CTFontRef ct_font = base::mac::GetValueFromDictionary<CTFontRef>(attributes, kCTFontAttributeName); - base::mac::ScopedCFTypeRef<CFStringRef> font_name_ref( + base::ScopedCFTypeRef<CFStringRef> font_name_ref( CTFontCopyFamilyName(ct_font)); run->font_name = base::SysCFStringRefToUTF8(font_name_ref); run->text_size = CTFontGetSize(ct_font); diff --git a/ui/gfx/render_text_mac.h b/ui/gfx/render_text_mac.h index b89737b..345fef0 100644 --- a/ui/gfx/render_text_mac.h +++ b/ui/gfx/render_text_mac.h @@ -74,11 +74,11 @@ class RenderTextMac : public RenderText { void ComputeRuns(); // The Core Text line of text. Created by |EnsureLayout()|. - base::mac::ScopedCFTypeRef<CTLineRef> line_; + base::ScopedCFTypeRef<CTLineRef> line_; // Array to hold CFAttributedString attributes that allows Core Text to hold // weak references to them without leaking. - base::mac::ScopedCFTypeRef<CFMutableArrayRef> attributes_; + base::ScopedCFTypeRef<CFMutableArrayRef> attributes_; // Visual dimensions of the text. Computed by |EnsureLayout()|. Size string_size_; diff --git a/ui/shell_dialogs/select_file_dialog_mac.mm b/ui/shell_dialogs/select_file_dialog_mac.mm index 8c1ffa3..8893762 100644 --- a/ui/shell_dialogs/select_file_dialog_mac.mm +++ b/ui/shell_dialogs/select_file_dialog_mac.mm @@ -29,8 +29,7 @@ namespace { const int kFileTypePopupTag = 1234; CFStringRef CreateUTIFromExtension(const base::FilePath::StringType& ext) { - base::mac::ScopedCFTypeRef<CFStringRef> ext_cf( - base::SysUTF8ToCFStringRef(ext)); + base::ScopedCFTypeRef<CFStringRef> ext_cf(base::SysUTF8ToCFStringRef(ext)); return UTTypeCreatePreferredIdentifierForTag( kUTTagClassFilenameExtension, ext_cf.get(), NULL); } @@ -226,7 +225,7 @@ void SelectFileDialogImpl::SelectFileImpl( const std::vector<base::FilePath::StringType>& ext_list = file_types->extensions[i]; for (size_t j = 0; j < ext_list.size(); ++j) { - base::mac::ScopedCFTypeRef<CFStringRef> uti( + base::ScopedCFTypeRef<CFStringRef> uti( CreateUTIFromExtension(ext_list[j])); [file_type_set addObject:base::mac::CFToNSCast(uti.get())]; @@ -234,7 +233,7 @@ void SelectFileDialogImpl::SelectFileImpl( // back to the original extension correctly. This occurs with dynamic // UTIs on 10.7 and 10.8. // See http://crbug.com/148840, http://openradar.me/12316273 - base::mac::ScopedCFTypeRef<CFStringRef> ext_cf( + base::ScopedCFTypeRef<CFStringRef> ext_cf( base::SysUTF8ToCFStringRef(ext_list[j])); [file_type_set addObject:base::mac::CFToNSCast(ext_cf.get())]; } @@ -340,9 +339,9 @@ NSView* SelectFileDialogImpl::GetAccessoryView(const FileTypeInfo* file_types, const std::vector<base::FilePath::StringType>& ext_list = file_types->extensions[type]; DCHECK(!ext_list.empty()); - base::mac::ScopedCFTypeRef<CFStringRef> uti( + base::ScopedCFTypeRef<CFStringRef> uti( CreateUTIFromExtension(ext_list[0])); - base::mac::ScopedCFTypeRef<CFStringRef> description( + base::ScopedCFTypeRef<CFStringRef> description( UTTypeCopyDescription(uti.get())); type_description = diff --git a/ui/snapshot/snapshot_mac.mm b/ui/snapshot/snapshot_mac.mm index 5833704..5a0c6d6 100644 --- a/ui/snapshot/snapshot_mac.mm +++ b/ui/snapshot/snapshot_mac.mm @@ -41,9 +41,11 @@ bool GrabViewSnapshot(gfx::NativeView view, png_representation->clear(); - base::mac::ScopedCFTypeRef<CGImageRef> windowSnapshot(CGWindowListCreateImage( - screen_snapshot_bounds.ToCGRect(), kCGWindowListOptionIncludingWindow, - [window windowNumber], kCGWindowImageBoundsIgnoreFraming)); + base::ScopedCFTypeRef<CGImageRef> windowSnapshot( + CGWindowListCreateImage(screen_snapshot_bounds.ToCGRect(), + kCGWindowListOptionIncludingWindow, + [window windowNumber], + kCGWindowImageBoundsIgnoreFraming)); if (CGImageGetWidth(windowSnapshot) <= 0) return false; diff --git a/ui/surface/accelerated_surface_mac.cc b/ui/surface/accelerated_surface_mac.cc index ce80eb0..5c63de7 100644 --- a/ui/surface/accelerated_surface_mac.cc +++ b/ui/surface/accelerated_surface_mac.cc @@ -116,7 +116,7 @@ static void AddBooleanValue(CFMutableDictionaryRef dictionary, static void AddIntegerValue(CFMutableDictionaryRef dictionary, const CFStringRef key, int32 value) { - base::mac::ScopedCFTypeRef<CFNumberRef> number( + base::ScopedCFTypeRef<CFNumberRef> number( CFNumberCreate(NULL, kCFNumberSInt32Type, &value)); CFDictionaryAddValue(dictionary, key, number.get()); } @@ -215,7 +215,7 @@ uint32 AcceleratedSurface::SetSurfaceSize(const gfx::Size& size) { // Allocate a new IOSurface, which is the GPU resource that can be // shared across processes. - base::mac::ScopedCFTypeRef<CFMutableDictionaryRef> properties; + base::ScopedCFTypeRef<CFMutableDictionaryRef> properties; properties.reset(CFDictionaryCreateMutable(kCFAllocatorDefault, 0, &kCFTypeDictionaryKeyCallBacks, diff --git a/ui/surface/accelerated_surface_mac.h b/ui/surface/accelerated_surface_mac.h index e070287..0fbcbdb 100644 --- a/ui/surface/accelerated_surface_mac.h +++ b/ui/surface/accelerated_surface_mac.h @@ -118,7 +118,7 @@ class SURFACE_EXPORT AcceleratedSurface { // to the shared region (IOSurface). scoped_refptr<gfx::GLSurface> gl_surface_; scoped_refptr<gfx::GLContext> gl_context_; - base::mac::ScopedCFTypeRef<CFTypeRef> io_surface_; + base::ScopedCFTypeRef<CFTypeRef> io_surface_; // The id of |io_surface_| or 0 if that's NULL. uint32 io_surface_id_; diff --git a/webkit/common/cursors/webcursor_mac.mm b/webkit/common/cursors/webcursor_mac.mm index 11fd937..bbf18a4 100644 --- a/webkit/common/cursors/webcursor_mac.mm +++ b/webkit/common/cursors/webcursor_mac.mm @@ -158,18 +158,17 @@ CGImageRef CreateCGImageFromCustomData(const std::vector<char>& custom_data, data = NULL; } - base::mac::ScopedCFTypeRef<CGColorSpaceRef> cg_color( + base::ScopedCFTypeRef<CGColorSpaceRef> cg_color( CGColorSpaceCreateDeviceRGB()); // The settings here match SetCustomData() below; keep in sync. - base::mac::ScopedCFTypeRef<CGContextRef> context( - CGBitmapContextCreate(data, - size.width(), - size.height(), - 8, - size.width()*4, - cg_color.get(), - kCGImageAlphaPremultipliedLast | - kCGBitmapByteOrder32Big)); + base::ScopedCFTypeRef<CGContextRef> context(CGBitmapContextCreate( + data, + size.width(), + size.height(), + 8, + size.width() * 4, + cg_color.get(), + kCGImageAlphaPremultipliedLast | kCGBitmapByteOrder32Big)); return CGBitmapContextCreateImage(context.get()); } diff --git a/webkit/plugins/npapi/plugin_list_mac.mm b/webkit/plugins/npapi/plugin_list_mac.mm index 5383149..f55dd41 100644 --- a/webkit/plugins/npapi/plugin_list_mac.mm +++ b/webkit/plugins/npapi/plugin_list_mac.mm @@ -19,7 +19,7 @@ #include "base/strings/sys_string_conversions.h" #include "base/strings/utf_string_conversions.h" -using base::mac::ScopedCFTypeRef; +using base::ScopedCFTypeRef; namespace webkit { namespace npapi { |