diff options
author | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-10-17 04:09:06 +0000 |
---|---|---|
committer | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-10-17 04:09:06 +0000 |
commit | df0ca6c858762b101bf424ff6c0522409fa195fc (patch) | |
tree | efa188eee6972e2c0de358f2d19a2348ce6dcb06 /base/mac_util.mm | |
parent | 73de26a684944782a92f8e6840e1b290c9a424cd (diff) | |
download | chromium_src-df0ca6c858762b101bf424ff6c0522409fa195fc.zip chromium_src-df0ca6c858762b101bf424ff6c0522409fa195fc.tar.gz chromium_src-df0ca6c858762b101bf424ff6c0522409fa195fc.tar.bz2 |
Move scoped_cftyperef from base to base/mac, use the new namespace, and name it
properly (scoped_cftyperef -> ScopedCFTypeRef).
TEST=it compiles
BUG=none
Review URL: http://codereview.chromium.org/3855001
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@62887 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/mac_util.mm')
-rw-r--r-- | base/mac_util.mm | 32 |
1 files changed, 17 insertions, 15 deletions
diff --git a/base/mac_util.mm b/base/mac_util.mm index b3a594a..f4e988a 100644 --- a/base/mac_util.mm +++ b/base/mac_util.mm @@ -8,11 +8,13 @@ #include "base/file_path.h" #include "base/logging.h" +#include "base/mac/scoped_cftyperef.h" #include "base/message_loop.h" -#include "base/scoped_cftyperef.h" #include "base/scoped_nsobject.h" #include "base/sys_string_conversions.h" +using base::mac::ScopedCFTypeRef; + namespace { // a count of currently outstanding requests for full screen mode from browser @@ -78,7 +80,7 @@ bool WasLaunchedAsLoginItem() { // representing the current application. If such an item is found, returns // retained reference to it. Caller is responsible for releasing the reference. LSSharedFileListItemRef GetLoginItemForApp() { - scoped_cftyperef<LSSharedFileListRef> login_items(LSSharedFileListCreate( + ScopedCFTypeRef<LSSharedFileListRef> login_items(LSSharedFileListCreate( NULL, kLSSharedFileListSessionLoginItems, NULL)); if (!login_items.get()) { @@ -98,7 +100,7 @@ LSSharedFileListItemRef GetLoginItemForApp() { CFURLRef item_url_ref = NULL; if (LSSharedFileListItemResolve(item, 0, &item_url_ref, NULL) == noErr) { - scoped_cftyperef<CFURLRef> item_url(item_url_ref); + ScopedCFTypeRef<CFURLRef> item_url(item_url_ref); if (CFEqual(item_url, url)) { CFRetain(item); return item; @@ -119,7 +121,7 @@ static NSString* kLSSharedFileListLoginItemHidden = #endif bool IsHiddenLoginItem(LSSharedFileListItemRef item) { - scoped_cftyperef<CFBooleanRef> hidden(reinterpret_cast<CFBooleanRef>( + ScopedCFTypeRef<CFBooleanRef> hidden(reinterpret_cast<CFBooleanRef>( LSSharedFileListItemCopyProperty(item, reinterpret_cast<CFStringRef>(kLSSharedFileListLoginItemHidden)))); @@ -131,7 +133,7 @@ bool IsHiddenLoginItem(LSSharedFileListItemRef item) { namespace mac_util { std::string PathFromFSRef(const FSRef& ref) { - scoped_cftyperef<CFURLRef> url( + ScopedCFTypeRef<CFURLRef> url( CFURLCreateFromFSRef(kCFAllocatorDefault, &ref)); NSString *path_string = [(NSURL *)url.get() path]; return [path_string fileSystemRepresentation]; @@ -455,9 +457,9 @@ CFTypeRef GetValueFromDictionary(CFDictionaryRef dict, return value; if (CFGetTypeID(value) != expected_type) { - scoped_cftyperef<CFStringRef> expected_type_ref( + ScopedCFTypeRef<CFStringRef> expected_type_ref( CFCopyTypeIDDescription(expected_type)); - scoped_cftyperef<CFStringRef> actual_type_ref( + ScopedCFTypeRef<CFStringRef> actual_type_ref( CFCopyTypeIDDescription(CFGetTypeID(value))); LOG(WARNING) << "Expected value for key " << base::SysCFStringRefToUTF8(key) @@ -569,7 +571,7 @@ void SetProcessName(CFStringRef process_name) { CGImageRef CopyNSImageToCGImage(NSImage* image) { // This is based loosely on http://www.cocoadev.com/index.pl?CGImageRef . NSSize size = [image size]; - scoped_cftyperef<CGContextRef> context( + ScopedCFTypeRef<CGContextRef> context( CGBitmapContextCreate(NULL, // Allow CG to allocate memory. size.width, size.height, @@ -595,7 +597,7 @@ CGImageRef CopyNSImageToCGImage(NSImage* image) { } bool CheckLoginItemStatus(bool* is_hidden) { - scoped_cftyperef<LSSharedFileListItemRef> item(GetLoginItemForApp()); + ScopedCFTypeRef<LSSharedFileListItemRef> item(GetLoginItemForApp()); if (!item.get()) return false; @@ -606,12 +608,12 @@ bool CheckLoginItemStatus(bool* is_hidden) { } void AddToLoginItems(bool hide_on_startup) { - scoped_cftyperef<LSSharedFileListItemRef> item(GetLoginItemForApp()); + ScopedCFTypeRef<LSSharedFileListItemRef> item(GetLoginItemForApp()); if (item.get() && (IsHiddenLoginItem(item) == hide_on_startup)) { return; // Already is a login item with required hide flag. } - scoped_cftyperef<LSSharedFileListRef> login_items(LSSharedFileListCreate( + ScopedCFTypeRef<LSSharedFileListRef> login_items(LSSharedFileListCreate( NULL, kLSSharedFileListSessionLoginItems, NULL)); if (!login_items.get()) { @@ -632,7 +634,7 @@ void AddToLoginItems(bool hide_on_startup) { dictionaryWithObject:[NSNumber numberWithBool:hide] forKey:(NSString*)kLSSharedFileListLoginItemHidden]; - scoped_cftyperef<LSSharedFileListItemRef> new_item; + ScopedCFTypeRef<LSSharedFileListItemRef> new_item; new_item.reset(LSSharedFileListInsertItemURL( login_items, kLSSharedFileListItemLast, NULL, NULL, reinterpret_cast<CFURLRef>(url), @@ -644,11 +646,11 @@ void AddToLoginItems(bool hide_on_startup) { } void RemoveFromLoginItems() { - scoped_cftyperef<LSSharedFileListItemRef> item(GetLoginItemForApp()); + ScopedCFTypeRef<LSSharedFileListItemRef> item(GetLoginItemForApp()); if (!item.get()) return; - scoped_cftyperef<LSSharedFileListRef> login_items(LSSharedFileListCreate( + ScopedCFTypeRef<LSSharedFileListRef> login_items(LSSharedFileListCreate( NULL, kLSSharedFileListSessionLoginItems, NULL)); if (!login_items.get()) { @@ -663,7 +665,7 @@ bool WasLaunchedAsHiddenLoginItem() { if (!WasLaunchedAsLoginItem()) return false; - scoped_cftyperef<LSSharedFileListItemRef> item(GetLoginItemForApp()); + ScopedCFTypeRef<LSSharedFileListItemRef> item(GetLoginItemForApp()); if (!item.get()) { LOG(ERROR) << "Process launched at Login but can't access Login Item List."; return false; |