| Index: base/mac_util.mm
|
| ===================================================================
|
| --- base/mac_util.mm (revision 62861)
|
| +++ base/mac_util.mm (working copy)
|
| @@ -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 @@
|
| // 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 @@
|
| 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 @@
|
| #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 @@
|
| 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 @@
|
| 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 @@
|
| 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 @@
|
| }
|
|
|
| bool CheckLoginItemStatus(bool* is_hidden) {
|
| - scoped_cftyperef<LSSharedFileListItemRef> item(GetLoginItemForApp());
|
| + ScopedCFTypeRef<LSSharedFileListItemRef> item(GetLoginItemForApp());
|
| if (!item.get())
|
| return false;
|
|
|
| @@ -606,12 +608,12 @@
|
| }
|
|
|
| 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 @@
|
| 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 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 @@
|
| 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;
|
|
|