summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-10-17 04:09:06 +0000
committerbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-10-17 04:09:06 +0000
commitdf0ca6c858762b101bf424ff6c0522409fa195fc (patch)
treeefa188eee6972e2c0de358f2d19a2348ce6dcb06
parent73de26a684944782a92f8e6840e1b290c9a424cd (diff)
downloadchromium_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
-rw-r--r--app/clipboard/clipboard_mac.mm8
-rw-r--r--app/surface/accelerated_surface_mac.cc6
-rw-r--r--app/surface/accelerated_surface_mac.h4
-rw-r--r--base/file_path.cc8
-rw-r--r--base/mac/scoped_cftyperef.h (renamed from base/scoped_cftyperef.h)39
-rw-r--r--base/mac_util.mm32
-rw-r--r--base/mac_util_unittest.mm6
-rw-r--r--base/native_library_mac.mm15
-rw-r--r--base/scoped_nsobject.h16
-rw-r--r--base/sys_string_conversions_mac.mm4
-rw-r--r--base/time_mac.cc6
-rw-r--r--chrome/app/breakpad_mac.mm4
-rw-r--r--chrome/browser/cocoa/animatable_image.mm4
-rw-r--r--chrome/browser/cocoa/certificate_viewer.mm4
-rw-r--r--chrome/browser/cocoa/download_started_animation_mac.mm1
-rw-r--r--chrome/browser/cocoa/file_metadata.mm4
-rw-r--r--chrome/browser/cocoa/install_from_dmg.mm3
-rw-r--r--chrome/browser/cocoa/page_info_window_mac.mm1
-rw-r--r--chrome/browser/cocoa/shell_dialogs_mac.mm6
-rw-r--r--chrome/browser/cocoa/ssl_client_certificate_selector.mm1
-rw-r--r--chrome/browser/cocoa/tab_view.mm6
-rw-r--r--chrome/browser/cocoa/tabpose_window.h6
-rw-r--r--chrome/browser/cocoa/tabpose_window.mm14
-rw-r--r--chrome/browser/file_path_watcher_mac.cc8
-rw-r--r--chrome/browser/policy/configuration_policy_provider_mac.cc6
-rw-r--r--chrome/browser/policy/configuration_policy_provider_mac_unittest.cc18
-rw-r--r--chrome/browser/preferences_mock_mac.h6
-rw-r--r--chrome/browser/renderer_host/backing_store_mac.h6
-rw-r--r--chrome/browser/renderer_host/backing_store_mac.mm13
-rw-r--r--chrome/browser/renderer_host/render_widget_host_view_mac.mm3
-rw-r--r--chrome/browser/search_engines/template_url_prepopulate_data.cc4
-rw-r--r--chrome/common/font_loader_mac.mm1
-rw-r--r--chrome/common/mach_message_source_mac.cc3
-rw-r--r--chrome/common/mach_message_source_mac.h4
-rw-r--r--chrome/common/sandbox_mac.mm10
-rw-r--r--chrome/common/sandbox_mac_fontloading_unittest.mm4
-rw-r--r--chrome/plugin/plugin_thread.cc17
-rw-r--r--chrome/plugin/webplugin_proxy.cc8
-rw-r--r--chrome/plugin/webplugin_proxy.h6
-rw-r--r--chrome/renderer/print_web_view_helper_mac.mm1
-rw-r--r--chrome/renderer/webplugin_delegate_pepper.cc6
-rw-r--r--chrome/renderer/webplugin_delegate_proxy.cc4
-rw-r--r--gfx/blit.cc6
-rw-r--r--gfx/canvas_skia_mac.mm6
-rw-r--r--net/base/cert_test_util.cc6
-rw-r--r--net/base/keygen_handler_mac.cc8
-rw-r--r--net/base/network_change_notifier_mac.cc9
-rw-r--r--net/base/network_config_watcher_mac.cc3
-rw-r--r--net/base/network_config_watcher_mac.h4
-rw-r--r--net/base/platform_mime_util_mac.cc16
-rw-r--r--net/base/ssl_config_service_mac.cc4
-rw-r--r--net/base/x509_certificate_mac.cc41
-rw-r--r--net/proxy/proxy_config_service_mac.cc4
-rw-r--r--net/proxy/proxy_resolver_mac.cc14
-rw-r--r--net/socket/ssl_client_socket_mac.cc6
-rw-r--r--printing/image.cc6
-rw-r--r--printing/pdf_metafile_mac.cc10
-rw-r--r--printing/pdf_metafile_mac.h8
-rw-r--r--printing/printed_document_mac.cc1
-rw-r--r--printing/printing_context_mac.mm4
-rw-r--r--skia/ext/skia_utils_mac.mm6
-rw-r--r--webkit/glue/plugins/pepper_graphics_2d.cc6
-rw-r--r--webkit/glue/plugins/pepper_plugin_instance.cc6
-rw-r--r--webkit/glue/plugins/plugin_lib_mac.mm15
-rw-r--r--webkit/glue/webcursor_mac.mm17
65 files changed, 276 insertions, 256 deletions
diff --git a/app/clipboard/clipboard_mac.mm b/app/clipboard/clipboard_mac.mm
index 0fa5d8f..c587e3a 100644
--- a/app/clipboard/clipboard_mac.mm
+++ b/app/clipboard/clipboard_mac.mm
@@ -9,7 +9,7 @@
#include "base/file_path.h"
#include "base/logging.h"
#include "base/mac_util.h"
-#include "base/scoped_cftyperef.h"
+#include "base/mac/scoped_cftyperef.h"
#include "base/scoped_nsobject.h"
#include "base/sys_string_conversions.h"
#include "base/utf_string_conversions.h"
@@ -105,16 +105,16 @@ 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.
- scoped_cftyperef<CFDataRef> data(
+ base::mac::ScopedCFTypeRef<CFDataRef> data(
CFDataCreateWithBytesNoCopy(kCFAllocatorDefault,
reinterpret_cast<const UInt8*>(pixel_data),
size->width()*size->height()*4,
kCFAllocatorNull));
- scoped_cftyperef<CGDataProviderRef> data_provider(
+ base::mac::ScopedCFTypeRef<CGDataProviderRef> data_provider(
CGDataProviderCreateWithCFData(data));
- scoped_cftyperef<CGImageRef> cgimage(
+ base::mac::ScopedCFTypeRef<CGImageRef> cgimage(
CGImageCreate(size->width(),
size->height(),
8,
diff --git a/app/surface/accelerated_surface_mac.cc b/app/surface/accelerated_surface_mac.cc
index a3cd8b9..c081f4d 100644
--- a/app/surface/accelerated_surface_mac.cc
+++ b/app/surface/accelerated_surface_mac.cc
@@ -8,7 +8,7 @@
#include "app/gfx/gl/gl_implementation.h"
#include "app/surface/io_surface_support_mac.h"
#include "base/logging.h"
-#include "base/scoped_cftyperef.h"
+#include "base/mac/scoped_cftyperef.h"
#include "gfx/rect.h"
AcceleratedSurface::AcceleratedSurface()
@@ -110,7 +110,7 @@ static void AddBooleanValue(CFMutableDictionaryRef dictionary,
static void AddIntegerValue(CFMutableDictionaryRef dictionary,
const CFStringRef key,
int32 value) {
- scoped_cftyperef<CFNumberRef> number(
+ base::mac::ScopedCFTypeRef<CFNumberRef> number(
CFNumberCreate(NULL, kCFNumberSInt32Type, &value));
CFDictionaryAddValue(dictionary, key, number.get());
}
@@ -223,7 +223,7 @@ uint64 AcceleratedSurface::SetSurfaceSize(const gfx::Size& size) {
// Allocate a new IOSurface, which is the GPU resource that can be
// shared across processes.
- scoped_cftyperef<CFMutableDictionaryRef> properties;
+ base::mac::ScopedCFTypeRef<CFMutableDictionaryRef> properties;
properties.reset(CFDictionaryCreateMutable(kCFAllocatorDefault,
0,
&kCFTypeDictionaryKeyCallBacks,
diff --git a/app/surface/accelerated_surface_mac.h b/app/surface/accelerated_surface_mac.h
index eb9d4f4..a111c14 100644
--- a/app/surface/accelerated_surface_mac.h
+++ b/app/surface/accelerated_surface_mac.h
@@ -11,7 +11,7 @@
#include "app/gfx/gl/gl_context.h"
#include "app/surface/transport_dib.h"
#include "base/callback.h"
-#include "base/scoped_cftyperef.h"
+#include "base/mac/scoped_cftyperef.h"
#include "base/scoped_ptr.h"
#include "gfx/rect.h"
#include "gfx/size.h"
@@ -130,7 +130,7 @@ class AcceleratedSurface {
// 10.6 and later).
// TODO(dspringer,kbr): Should the GPU backing store be encapsulated in its
// own class so all this implementation detail is hidden?
- scoped_cftyperef<CFTypeRef> io_surface_;
+ base::mac::ScopedCFTypeRef<CFTypeRef> io_surface_;
// TODO(dspringer): If we end up keeping this TransportDIB mechanism, this
// should really be a scoped_ptr_malloc<>, with a deallocate functor that
// runs |dib_free_callback_|. I was not able to figure out how to
diff --git a/base/file_path.cc b/base/file_path.cc
index e330e3c..5165828 100644
--- a/base/file_path.cc
+++ b/base/file_path.cc
@@ -21,7 +21,7 @@
#include "base/utf_string_conversions.h"
#if defined(OS_MACOSX)
-#include "base/scoped_cftyperef.h"
+#include "base/mac/scoped_cftyperef.h"
#include "base/third_party/icu/icu_utf.h"
#endif
@@ -991,7 +991,7 @@ int FilePath::HFSFastUnicodeCompare(const StringType& string1,
}
StringType FilePath::GetHFSDecomposedForm(const StringType& string) {
- scoped_cftyperef<CFStringRef> cfstring(
+ base::mac::ScopedCFTypeRef<CFStringRef> cfstring(
CFStringCreateWithBytesNoCopy(
NULL,
reinterpret_cast<const UInt8*>(string.c_str()),
@@ -1038,7 +1038,7 @@ int FilePath::CompareIgnoreCase(const StringType& string1,
// GetHFSDecomposedForm() returns an empty string in an error case.
if (hfs1.empty() || hfs2.empty()) {
NOTREACHED();
- scoped_cftyperef<CFStringRef> cfstring1(
+ base::mac::ScopedCFTypeRef<CFStringRef> cfstring1(
CFStringCreateWithBytesNoCopy(
NULL,
reinterpret_cast<const UInt8*>(string1.c_str()),
@@ -1046,7 +1046,7 @@ int FilePath::CompareIgnoreCase(const StringType& string1,
kCFStringEncodingUTF8,
false,
kCFAllocatorNull));
- scoped_cftyperef<CFStringRef> cfstring2(
+ base::mac::ScopedCFTypeRef<CFStringRef> cfstring2(
CFStringCreateWithBytesNoCopy(
NULL,
reinterpret_cast<const UInt8*>(string2.c_str()),
diff --git a/base/scoped_cftyperef.h b/base/mac/scoped_cftyperef.h
index 4e41816..9add988 100644
--- a/base/scoped_cftyperef.h
+++ b/base/mac/scoped_cftyperef.h
@@ -1,35 +1,39 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef BASE_SCOPED_CFTYPEREF_H_
-#define BASE_SCOPED_CFTYPEREF_H_
+#ifndef BASE_MAC_SCOPED_CFTYPEREF_H_
+#define BASE_MAC_SCOPED_CFTYPEREF_H_
#pragma once
#include <CoreFoundation/CoreFoundation.h>
+
#include "base/basictypes.h"
#include "base/compiler_specific.h"
-// scoped_cftyperef<> is patterned after scoped_ptr<>, but maintains ownership
+namespace base {
+namespace mac {
+
+// ScopedCFTypeRef<> is patterned after scoped_ptr<>, but maintains ownership
// of a CoreFoundation object: any object that can be represented as a
// CFTypeRef. Style deviations here are solely for compatibility with
// scoped_ptr<>'s interface, with which everyone is already familiar.
//
-// When scoped_cftyperef<> takes ownership of an object (in the constructor or
+// When ScopedCFTypeRef<> takes ownership of an object (in the constructor or
// in reset()), it takes over the caller's existing ownership claim. The
-// caller must own the object it gives to scoped_cftyperef<>, and relinquishes
-// an ownership claim to that object. scoped_cftyperef<> does not call
+// caller must own the object it gives to ScopedCFTypeRef<>, and relinquishes
+// an ownership claim to that object. ScopedCFTypeRef<> does not call
// CFRetain().
template<typename CFT>
-class scoped_cftyperef {
+class ScopedCFTypeRef {
public:
typedef CFT element_type;
- explicit scoped_cftyperef(CFT object = NULL)
+ explicit ScopedCFTypeRef(CFT object = NULL)
: object_(object) {
}
- ~scoped_cftyperef() {
+ ~ScopedCFTypeRef() {
if (object_)
CFRelease(object_);
}
@@ -56,15 +60,15 @@ class scoped_cftyperef {
return object_;
}
- void swap(scoped_cftyperef& that) {
+ void swap(ScopedCFTypeRef& that) {
CFT temp = that.object_;
that.object_ = object_;
object_ = temp;
}
- // scoped_cftyperef<>::release() is like scoped_ptr<>::release. It is NOT
- // a wrapper for CFRelease(). To force a scoped_cftyperef<> object to call
- // CFRelease(), use scoped_cftyperef<>::reset().
+ // ScopedCFTypeRef<>::release() is like scoped_ptr<>::release. It is NOT
+ // a wrapper for CFRelease(). To force a ScopedCFTypeRef<> object to call
+ // CFRelease(), use ScopedCFTypeRef<>::reset().
CFT release() WARN_UNUSED_RESULT {
CFT temp = object_;
object_ = NULL;
@@ -74,7 +78,10 @@ class scoped_cftyperef {
private:
CFT object_;
- DISALLOW_COPY_AND_ASSIGN(scoped_cftyperef);
+ DISALLOW_COPY_AND_ASSIGN(ScopedCFTypeRef);
};
-#endif // BASE_SCOPED_CFTYPEREF_H_
+} // namespace mac
+} // namespace base
+
+#endif // BASE_MAC_SCOPED_CFTYPEREF_H_
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;
diff --git a/base/mac_util_unittest.mm b/base/mac_util_unittest.mm
index 45b3c0e..7999878 100644
--- a/base/mac_util_unittest.mm
+++ b/base/mac_util_unittest.mm
@@ -10,7 +10,7 @@
#import "base/chrome_application_mac.h"
#include "base/file_path.h"
#include "base/file_util.h"
-#include "base/scoped_cftyperef.h"
+#include "base/mac/scoped_cftyperef.h"
#include "base/scoped_nsobject.h"
#include "base/scoped_ptr.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -151,7 +151,7 @@ TEST_F(MacUtilTest, TestExcludeFileFromBackups) {
}
TEST_F(MacUtilTest, TestGetValueFromDictionary) {
- scoped_cftyperef<CFMutableDictionaryRef> dict(
+ base::mac::ScopedCFTypeRef<CFMutableDictionaryRef> dict(
CFDictionaryCreateMutable(0, 0,
&kCFTypeDictionaryKeyCallBacks,
&kCFTypeDictionaryValueCallBacks));
@@ -175,7 +175,7 @@ TEST_F(MacUtilTest, CopyNSImageToCGImage) {
NSRectFill(rect);
[nsImage unlockFocus];
- scoped_cftyperef<CGImageRef> cgImage(
+ base::mac::ScopedCFTypeRef<CGImageRef> cgImage(
mac_util::CopyNSImageToCGImage(nsImage.get()));
EXPECT_TRUE(cgImage.get());
}
diff --git a/base/native_library_mac.mm b/base/native_library_mac.mm
index d13a4b6..95cac15 100644
--- a/base/native_library_mac.mm
+++ b/base/native_library_mac.mm
@@ -9,7 +9,7 @@
#include "base/file_path.h"
#include "base/file_util.h"
-#include "base/scoped_cftyperef.h"
+#include "base/mac/scoped_cftyperef.h"
#include "base/string_util.h"
#include "base/utf_string_conversions.h"
@@ -27,11 +27,12 @@ NativeLibrary LoadNativeLibrary(const FilePath& library_path) {
native_lib->dylib = dylib;
return native_lib;
}
- scoped_cftyperef<CFURLRef> url(CFURLCreateFromFileSystemRepresentation(
- kCFAllocatorDefault,
- (const UInt8*)library_path.value().c_str(),
- library_path.value().length(),
- true));
+ base::mac::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());
@@ -61,7 +62,7 @@ void UnloadNativeLibrary(NativeLibrary library) {
void* GetFunctionPointerFromNativeLibrary(NativeLibrary library,
const char* name) {
if (library->type == BUNDLE) {
- scoped_cftyperef<CFStringRef> symbol_name(
+ base::mac::ScopedCFTypeRef<CFStringRef> symbol_name(
CFStringCreateWithCString(kCFAllocatorDefault, name,
kCFStringEncodingUTF8));
return CFBundleGetFunctionPointerForName(library->bundle, symbol_name);
diff --git a/base/scoped_nsobject.h b/base/scoped_nsobject.h
index 1b40ade..a9783e0 100644
--- a/base/scoped_nsobject.h
+++ b/base/scoped_nsobject.h
@@ -41,10 +41,10 @@ class scoped_nsobject {
void reset(NST* object = nil) {
// We intentionally do not check that object != object_ as the caller must
- // already have an ownership claim over whatever it gives to scoped_nsobject
- // and scoped_cftyperef, whether it's in the constructor or in a call to
- // reset(). In either case, it relinquishes that claim and the scoper
- // assumes it.
+ // already have an ownership claim over whatever it gives to
+ // scoped_nsobject and ScopedCFTypeRef, whether it's in the constructor or
+ // in a call to reset(). In either case, it relinquishes that claim and
+ // the scoper assumes it.
[object_ release];
object_ = object;
}
@@ -114,10 +114,10 @@ class scoped_nsobject<id> {
void reset(id object = nil) {
// We intentionally do not check that object != object_ as the caller must
- // already have an ownership claim over whatever it gives to scoped_nsobject
- // and scoped_cftyperef, whether it's in the constructor or in a call to
- // reset(). In either case, it relinquishes that claim and the scoper
- // assumes it.
+ // already have an ownership claim over whatever it gives to
+ // scoped_nsobject and ScopedCFTypeRef, whether it's in the constructor or
+ // in a call to reset(). In either case, it relinquishes that claim and
+ // the scoper assumes it.
[object_ release];
object_ = object;
}
diff --git a/base/sys_string_conversions_mac.mm b/base/sys_string_conversions_mac.mm
index 9b9a07e..4b5648c 100644
--- a/base/sys_string_conversions_mac.mm
+++ b/base/sys_string_conversions_mac.mm
@@ -9,7 +9,7 @@
#include <vector>
#include "base/foundation_utils_mac.h"
-#include "base/scoped_cftyperef.h"
+#include "base/mac/scoped_cftyperef.h"
#include "base/string_piece.h"
namespace base {
@@ -78,7 +78,7 @@ static OutStringType STLStringToSTLStringWithEncodingsT(
if (in_length == 0)
return OutStringType();
- scoped_cftyperef<CFStringRef> cfstring(
+ base::mac::ScopedCFTypeRef<CFStringRef> cfstring(
CFStringCreateWithBytesNoCopy(NULL,
reinterpret_cast<const UInt8*>(in.data()),
in_length *
diff --git a/base/time_mac.cc b/base/time_mac.cc
index 6b46b95..6dfaa20 100644
--- a/base/time_mac.cc
+++ b/base/time_mac.cc
@@ -12,7 +12,7 @@
#include "base/basictypes.h"
#include "base/logging.h"
-#include "base/scoped_cftyperef.h"
+#include "base/mac/scoped_cftyperef.h"
namespace base {
@@ -70,7 +70,7 @@ Time Time::FromExploded(bool is_local, const Exploded& exploded) {
date.month = exploded.month;
date.year = exploded.year;
- scoped_cftyperef<CFTimeZoneRef>
+ base::mac::ScopedCFTypeRef<CFTimeZoneRef>
time_zone(is_local ? CFTimeZoneCopySystem() : NULL);
CFAbsoluteTime seconds = CFGregorianDateGetAbsoluteTime(date, time_zone) +
kCFAbsoluteTimeIntervalSince1970;
@@ -83,7 +83,7 @@ void Time::Explode(bool is_local, Exploded* exploded) const {
(static_cast<double>((us_ - kWindowsEpochDeltaMicroseconds) /
kMicrosecondsPerSecond) - kCFAbsoluteTimeIntervalSince1970);
- scoped_cftyperef<CFTimeZoneRef>
+ base::mac::ScopedCFTypeRef<CFTimeZoneRef>
time_zone(is_local ? CFTimeZoneCopySystem() : NULL);
CFGregorianDate date = CFAbsoluteTimeGetGregorianDate(seconds, time_zone);
diff --git a/chrome/app/breakpad_mac.mm b/chrome/app/breakpad_mac.mm
index dc9c1ad..54d32c0 100644
--- a/chrome/app/breakpad_mac.mm
+++ b/chrome/app/breakpad_mac.mm
@@ -14,8 +14,8 @@
#include "base/file_util.h"
#import "base/logging.h"
#include "base/mac_util.h"
+#include "base/mac/scoped_cftyperef.h"
#include "base/path_service.h"
-#include "base/scoped_cftyperef.h"
#import "base/scoped_nsautorelease_pool.h"
#include "base/sys_string_conversions.h"
#import "breakpad/src/client/mac/Framework/Breakpad.h"
@@ -63,7 +63,7 @@ void InitCrashReporter() {
if (is_browser) {
// Since the configuration management infrastructure is possibly not
// initialized when this code runs, read the policy preference directly.
- scoped_cftyperef<CFStringRef> key(
+ base::mac::ScopedCFTypeRef<CFStringRef> key(
base::SysUTF8ToCFStringRef(policy::key::kMetricsReportingEnabled));
Boolean key_valid;
Boolean metrics_reporting_enabled = CFPreferencesGetAppBooleanValue(key,
diff --git a/chrome/browser/cocoa/animatable_image.mm b/chrome/browser/cocoa/animatable_image.mm
index 1c73f55..2169843 100644
--- a/chrome/browser/cocoa/animatable_image.mm
+++ b/chrome/browser/cocoa/animatable_image.mm
@@ -6,7 +6,7 @@
#include "base/logging.h"
#import "base/mac_util.h"
-#include "base/scoped_cftyperef.h"
+#include "base/mac/scoped_cftyperef.h"
#import "third_party/GTM/AppKit/GTMNSAnimation+Duration.h"
@interface AnimatableImage (Private)
@@ -130,7 +130,7 @@
// Sets the layer contents by converting the NSImage to a CGImageRef. This will
// rasterize PDF resources.
- (void)setLayerContents:(CALayer*)layer {
- scoped_cftyperef<CGImageRef> image(
+ base::mac::ScopedCFTypeRef<CGImageRef> image(
mac_util::CopyNSImageToCGImage(image_.get()));
// Create the layer that will be animated.
[layer setContents:(id)image.get()];
diff --git a/chrome/browser/cocoa/certificate_viewer.mm b/chrome/browser/cocoa/certificate_viewer.mm
index ed29ef4..8c5a954 100644
--- a/chrome/browser/cocoa/certificate_viewer.mm
+++ b/chrome/browser/cocoa/certificate_viewer.mm
@@ -10,7 +10,7 @@
#include <vector>
#include "base/logging.h"
-#include "base/scoped_cftyperef.h"
+#include "base/mac/scoped_cftyperef.h"
#include "net/base/x509_certificate.h"
void ShowCertificateViewer(gfx::NativeWindow parent,
@@ -19,7 +19,7 @@ void ShowCertificateViewer(gfx::NativeWindow parent,
if (!cert_mac)
return;
- scoped_cftyperef<CFMutableArrayRef> certificates(
+ base::mac::ScopedCFTypeRef<CFMutableArrayRef> certificates(
CFArrayCreateMutable(kCFAllocatorDefault, 0, &kCFTypeArrayCallBacks));
if (!certificates.get()) {
NOTREACHED();
diff --git a/chrome/browser/cocoa/download_started_animation_mac.mm b/chrome/browser/cocoa/download_started_animation_mac.mm
index 0ff5ef9..0ed926b 100644
--- a/chrome/browser/cocoa/download_started_animation_mac.mm
+++ b/chrome/browser/cocoa/download_started_animation_mac.mm
@@ -12,7 +12,6 @@
#import <QuartzCore/QuartzCore.h>
#include "app/resource_bundle.h"
-#include "base/scoped_cftyperef.h"
#include "chrome/browser/tab_contents/tab_contents.h"
#include "chrome/browser/tab_contents/tab_contents_view_mac.h"
#import "chrome/browser/cocoa/animatable_image.h"
diff --git a/chrome/browser/cocoa/file_metadata.mm b/chrome/browser/cocoa/file_metadata.mm
index 63c4aeb..ad3a92f 100644
--- a/chrome/browser/cocoa/file_metadata.mm
+++ b/chrome/browser/cocoa/file_metadata.mm
@@ -8,9 +8,9 @@
#include <Foundation/Foundation.h>
#include "base/file_path.h"
-#include "base/scoped_cftyperef.h"
#include "base/logging.h"
#include "base/mac_util.h"
+#include "base/mac/scoped_cftyperef.h"
#include "googleurl/src/gurl.h"
namespace file_metadata {
@@ -69,7 +69,7 @@ void AddOriginMetadataToFile(const FilePath& file, const GURL& source,
if (!file_path)
return;
- scoped_cftyperef<MDItemRef> md_item(
+ base::mac::ScopedCFTypeRef<MDItemRef> md_item(
MDItemCreate(NULL, reinterpret_cast<CFStringRef>(file_path)));
if (!md_item)
return;
diff --git a/chrome/browser/cocoa/install_from_dmg.mm b/chrome/browser/cocoa/install_from_dmg.mm
index cffe3fc..be6ad3b 100644
--- a/chrome/browser/cocoa/install_from_dmg.mm
+++ b/chrome/browser/cocoa/install_from_dmg.mm
@@ -37,8 +37,7 @@
namespace {
-// Just like scoped_cftyperef from base/scoped_cftyperef.h, but for
-// io_object_t and subclasses.
+// Just like ScopedCFTypeRef but for io_object_t and subclasses.
template<typename IOT>
class scoped_ioobject {
public:
diff --git a/chrome/browser/cocoa/page_info_window_mac.mm b/chrome/browser/cocoa/page_info_window_mac.mm
index e246c0a..2774e1e 100644
--- a/chrome/browser/cocoa/page_info_window_mac.mm
+++ b/chrome/browser/cocoa/page_info_window_mac.mm
@@ -7,7 +7,6 @@
#include <algorithm>
#include "app/l10n_util.h"
-#include "base/scoped_cftyperef.h"
#include "app/resource_bundle.h"
#include "base/string_util.h"
#include "base/sys_string_conversions.h"
diff --git a/chrome/browser/cocoa/shell_dialogs_mac.mm b/chrome/browser/cocoa/shell_dialogs_mac.mm
index 59fc881..bb1ad05 100644
--- a/chrome/browser/cocoa/shell_dialogs_mac.mm
+++ b/chrome/browser/cocoa/shell_dialogs_mac.mm
@@ -15,7 +15,7 @@
#import "base/cocoa_protocols_mac.h"
#include "base/logging.h"
#include "base/mac_util.h"
-#include "base/scoped_cftyperef.h"
+#include "base/mac/scoped_cftyperef.h"
#import "base/scoped_nsobject.h"
#include "base/sys_string_conversions.h"
#include "grit/generated_resources.h"
@@ -308,11 +308,11 @@ NSView* SelectFileDialogImpl::GetAccessoryView(const FileTypeInfo* file_types,
file_types->extensions[type];
DCHECK(!ext_list.empty());
NSString* type_extension = base::SysUTF8ToNSString(ext_list[0]);
- scoped_cftyperef<CFStringRef> uti(
+ base::mac::ScopedCFTypeRef<CFStringRef> uti(
UTTypeCreatePreferredIdentifierForTag(kUTTagClassFilenameExtension,
(CFStringRef)type_extension,
NULL));
- scoped_cftyperef<CFStringRef> description(
+ base::mac::ScopedCFTypeRef<CFStringRef> description(
UTTypeCopyDescription(uti.get()));
type_description =
diff --git a/chrome/browser/cocoa/ssl_client_certificate_selector.mm b/chrome/browser/cocoa/ssl_client_certificate_selector.mm
index 9db787c..c72e00f 100644
--- a/chrome/browser/cocoa/ssl_client_certificate_selector.mm
+++ b/chrome/browser/cocoa/ssl_client_certificate_selector.mm
@@ -11,7 +11,6 @@
#import "app/l10n_util_mac.h"
#include "base/logging.h"
#include "base/ref_counted.h"
-#include "base/scoped_cftyperef.h"
#import "base/scoped_nsobject.h"
#include "base/string_util.h"
#include "base/sys_string_conversions.h"
diff --git a/chrome/browser/cocoa/tab_view.mm b/chrome/browser/cocoa/tab_view.mm
index c9674e7..7b7ed59 100644
--- a/chrome/browser/cocoa/tab_view.mm
+++ b/chrome/browser/cocoa/tab_view.mm
@@ -6,8 +6,8 @@
#include "base/logging.h"
#import "base/mac_util.h"
+#include "base/mac/scoped_cftyperef.h"
#include "base/nsimage_cache_mac.h"
-#include "base/scoped_cftyperef.h"
#import "chrome/browser/cocoa/tab_controller.h"
#import "chrome/browser/cocoa/tab_window_controller.h"
#import "chrome/browser/cocoa/themed_window.h"
@@ -967,9 +967,9 @@ const CGFloat kRapidCloseDist = 2.5;
int workspace = -1;
// It's possible to query in bulk, but probably not necessary.
- scoped_cftyperef<CFArrayRef> windowIDs(CFArrayCreate(
+ base::mac::ScopedCFTypeRef<CFArrayRef> windowIDs(CFArrayCreate(
NULL, reinterpret_cast<const void **>(&windowID), 1, NULL));
- scoped_cftyperef<CFArrayRef> descriptions(
+ base::mac::ScopedCFTypeRef<CFArrayRef> descriptions(
CGWindowListCreateDescriptionFromArray(windowIDs));
DCHECK(CFArrayGetCount(descriptions.get()) <= 1);
if (CFArrayGetCount(descriptions.get()) > 0) {
diff --git a/chrome/browser/cocoa/tabpose_window.h b/chrome/browser/cocoa/tabpose_window.h
index fef3bbb..7728367 100644
--- a/chrome/browser/cocoa/tabpose_window.h
+++ b/chrome/browser/cocoa/tabpose_window.h
@@ -8,7 +8,7 @@
#import <Cocoa/Cocoa.h>
-#include "base/scoped_cftyperef.h"
+#include "base/mac/scoped_cftyperef.h"
#include "base/scoped_nsobject.h"
#include "base/scoped_ptr.h"
@@ -52,8 +52,8 @@ class TabStripModelObserverBridge;
CALayer* selectionHighlight_; // weak
// Colors used by the layers.
- scoped_cftyperef<CGColorRef> gray_;
- scoped_cftyperef<CGColorRef> darkBlue_;
+ base::mac::ScopedCFTypeRef<CGColorRef> gray_;
+ base::mac::ScopedCFTypeRef<CGColorRef> darkBlue_;
TabStripModel* tabStripModel_; // weak
diff --git a/chrome/browser/cocoa/tabpose_window.mm b/chrome/browser/cocoa/tabpose_window.mm
index ca80dc5..c67a5a1 100644
--- a/chrome/browser/cocoa/tabpose_window.mm
+++ b/chrome/browser/cocoa/tabpose_window.mm
@@ -8,6 +8,7 @@
#include "app/resource_bundle.h"
#include "base/mac_util.h"
+#include "base/mac/scoped_cftyperef.h"
#include "base/scoped_callback_factory.h"
#include "base/sys_string_conversions.h"
#include "chrome/app/chrome_dll_resource.h"
@@ -45,12 +46,13 @@ const CGFloat kObserverChangeAnimationDuration = 0.75; // In seconds.
@implementation DarkGradientLayer
- (void)drawInContext:(CGContextRef)context {
- scoped_cftyperef<CGColorSpaceRef> grayColorSpace(
+ base::mac::ScopedCFTypeRef<CGColorSpaceRef> grayColorSpace(
CGColorSpaceCreateWithName(kCGColorSpaceGenericGray));
CGFloat grays[] = { 0.277, 1.0, 0.39, 1.0 };
CGFloat locations[] = { 0, 1 };
- scoped_cftyperef<CGGradientRef> gradient(CGGradientCreateWithColorComponents(
- grayColorSpace.get(), grays, locations, arraysize(locations)));
+ base::mac::ScopedCFTypeRef<CGGradientRef> gradient(
+ CGGradientCreateWithColorComponents(
+ grayColorSpace.get(), grays, locations, arraysize(locations)));
CGPoint topLeft = CGPointMake(0.0, kTopGradientHeight);
CGContextDrawLinearGradient(context, gradient.get(), topLeft, CGPointZero, 0);
}
@@ -75,7 +77,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_|.
- scoped_cftyperef<CGImageRef> thumbnail_;
+ base::mac::ScopedCFTypeRef<CGImageRef> thumbnail_;
// True if the layer already sent a thumbnail request to a renderer.
BOOL didSendLoad_;
@@ -222,7 +224,7 @@ void ThumbnailLoader::LoadThumbnail() {
if (backing_store->cg_layer()) {
CGContextDrawLayerInRect(context, destRect, backing_store->cg_layer());
} else {
- scoped_cftyperef<CGImageRef> image(
+ base::mac::ScopedCFTypeRef<CGImageRef> image(
CGBitmapContextCreateImage(backing_store->cg_bitmap()));
CGContextDrawImage(context, destRect, image);
}
@@ -948,7 +950,7 @@ void AnimateCALayerFrameFromTo(
IDR_DEFAULT_FAVICON);
nsFavicon = defaultFavIcon;
}
- scoped_cftyperef<CGImageRef> favicon(
+ base::mac::ScopedCFTypeRef<CGImageRef> favicon(
mac_util::CopyNSImageToCGImage(nsFavicon));
CALayer* faviconLayer = [CALayer layer];
diff --git a/chrome/browser/file_path_watcher_mac.cc b/chrome/browser/file_path_watcher_mac.cc
index ddcfd41..cc925a6 100644
--- a/chrome/browser/file_path_watcher_mac.cc
+++ b/chrome/browser/file_path_watcher_mac.cc
@@ -10,7 +10,7 @@
#include "base/file_path.h"
#include "base/file_util.h"
#include "base/logging.h"
-#include "base/scoped_cftyperef.h"
+#include "base/mac/scoped_cftyperef.h"
#include "base/singleton.h"
#include "base/time.h"
@@ -187,12 +187,12 @@ void FilePathWatcherImpl::UpdateEventStream(FSEventStreamEventId start_event) {
if (fsevent_stream_)
DestroyEventStream();
- scoped_cftyperef<CFStringRef> cf_path(CFStringCreateWithCString(
+ base::mac::ScopedCFTypeRef<CFStringRef> cf_path(CFStringCreateWithCString(
NULL, target_.value().c_str(), kCFStringEncodingMacHFS));
- scoped_cftyperef<CFStringRef> cf_dir_path(CFStringCreateWithCString(
+ base::mac::ScopedCFTypeRef<CFStringRef> cf_dir_path(CFStringCreateWithCString(
NULL, target_.DirName().value().c_str(), kCFStringEncodingMacHFS));
CFStringRef paths_array[] = { cf_path.get(), cf_dir_path.get() };
- scoped_cftyperef<CFArrayRef> watched_paths(CFArrayCreate(
+ base::mac::ScopedCFTypeRef<CFArrayRef> watched_paths(CFArrayCreate(
NULL, reinterpret_cast<const void**>(paths_array), arraysize(paths_array),
&kCFTypeArrayCallBacks));
diff --git a/chrome/browser/policy/configuration_policy_provider_mac.cc b/chrome/browser/policy/configuration_policy_provider_mac.cc
index 185995a..552e33c 100644
--- a/chrome/browser/policy/configuration_policy_provider_mac.cc
+++ b/chrome/browser/policy/configuration_policy_provider_mac.cc
@@ -5,7 +5,7 @@
#include "chrome/browser/policy/configuration_policy_provider_mac.h"
#include "base/logging.h"
-#include "base/scoped_cftyperef.h"
+#include "base/mac/scoped_cftyperef.h"
#include "base/sys_string_conversions.h"
namespace policy {
@@ -26,9 +26,9 @@ bool ConfigurationPolicyProviderMac::Provide(ConfigurationPolicyStore* store) {
for (PolicyValueMap::const_iterator current = mapping.begin();
current != mapping.end(); ++current) {
- scoped_cftyperef<CFStringRef> name(
+ base::mac::ScopedCFTypeRef<CFStringRef> name(
base::SysUTF8ToCFStringRef(current->name));
- scoped_cftyperef<CFPropertyListRef> value(
+ base::mac::ScopedCFTypeRef<CFPropertyListRef> value(
preferences_->CopyAppValue(name, kCFPreferencesCurrentApplication));
if (!value.get())
continue;
diff --git a/chrome/browser/policy/configuration_policy_provider_mac_unittest.cc b/chrome/browser/policy/configuration_policy_provider_mac_unittest.cc
index 6bf40bb..86794a0 100644
--- a/chrome/browser/policy/configuration_policy_provider_mac_unittest.cc
+++ b/chrome/browser/policy/configuration_policy_provider_mac_unittest.cc
@@ -4,6 +4,7 @@
#include <gtest/gtest.h>
+#include "base/mac/scoped_cftyperef.h"
#include "base/stl_util-inl.h"
#include "base/sys_string_conversions.h"
#include "chrome/browser/policy/configuration_policy_pref_store.h"
@@ -72,7 +73,7 @@ class PolicyTestParams {
case Value::TYPE_LIST: {
const ListValue* list =
static_cast<const ListValue*>(test_value_.get());
- scoped_cftyperef<CFMutableArrayRef> array(
+ base::mac::ScopedCFTypeRef<CFMutableArrayRef> array(
CFArrayCreateMutable(NULL, list->GetSize(),
&kCFTypeArrayCallBacks));
for (ListValue::const_iterator element(list->begin());
@@ -82,7 +83,7 @@ class PolicyTestParams {
std::string element_value;
if (!(*element)->GetAsString(&element_value))
return NULL;
- scoped_cftyperef<CFStringRef> cf_element_value(
+ base::mac::ScopedCFTypeRef<CFStringRef> cf_element_value(
base::SysUTF8ToCFStringRef(element_value));
CFArrayAppendValue(array, cf_element_value.get());
}
@@ -150,18 +151,19 @@ TEST_P(ConfigurationPolicyProviderMacTest, Default) {
}
TEST_P(ConfigurationPolicyProviderMacTest, Invalid) {
- scoped_cftyperef<CFStringRef> name(
+ base::mac::ScopedCFTypeRef<CFStringRef> name(
base::SysUTF8ToCFStringRef(GetParam().policy_name()));
- scoped_cftyperef<CFDataRef> invalid_data(CFDataCreate(NULL, NULL, 0));
+ base::mac::ScopedCFTypeRef<CFDataRef> invalid_data(
+ CFDataCreate(NULL, NULL, 0));
prefs_->AddTestItem(name, invalid_data.get(), true);
EXPECT_TRUE(provider_->Provide(store_.get()));
EXPECT_TRUE(store_->policy_map().empty());
}
TEST_P(ConfigurationPolicyProviderMacTest, TestNonForcedValue) {
- scoped_cftyperef<CFStringRef> name(
+ base::mac::ScopedCFTypeRef<CFStringRef> name(
base::SysUTF8ToCFStringRef(GetParam().policy_name()));
- scoped_cftyperef<CFPropertyListRef> test_value(
+ base::mac::ScopedCFTypeRef<CFPropertyListRef> test_value(
GetParam().GetPropertyListValue());
ASSERT_TRUE(test_value.get());
prefs_->AddTestItem(name, test_value.get(), false);
@@ -170,9 +172,9 @@ TEST_P(ConfigurationPolicyProviderMacTest, TestNonForcedValue) {
}
TEST_P(ConfigurationPolicyProviderMacTest, TestValue) {
- scoped_cftyperef<CFStringRef> name(
+ base::mac::ScopedCFTypeRef<CFStringRef> name(
base::SysUTF8ToCFStringRef(GetParam().policy_name()));
- scoped_cftyperef<CFPropertyListRef> test_value(
+ base::mac::ScopedCFTypeRef<CFPropertyListRef> test_value(
GetParam().GetPropertyListValue());
ASSERT_TRUE(test_value.get());
prefs_->AddTestItem(name, test_value, true);
diff --git a/chrome/browser/preferences_mock_mac.h b/chrome/browser/preferences_mock_mac.h
index c804776..6c1ea3d 100644
--- a/chrome/browser/preferences_mock_mac.h
+++ b/chrome/browser/preferences_mock_mac.h
@@ -6,7 +6,7 @@
#define CHROME_BROWSER_PREFERENCES_MOCK_MAC_H_
#pragma once
-#include "base/scoped_cftyperef.h"
+#include "base/mac/scoped_cftyperef.h"
#include "chrome/browser/preferences_mac.h"
// Mock preferences wrapper for testing code that interacts with CFPreferences.
@@ -24,8 +24,8 @@ class MockPreferences : public MacPreferences {
void AddTestItem(CFStringRef key, CFPropertyListRef value, bool is_forced);
private:
- scoped_cftyperef<CFMutableDictionaryRef> values_;
- scoped_cftyperef<CFMutableSetRef> forced_;
+ base::mac::ScopedCFTypeRef<CFMutableDictionaryRef> values_;
+ base::mac::ScopedCFTypeRef<CFMutableSetRef> forced_;
};
#endif // CHROME_BROWSER_PREFERENCES_MOCK_MAC_H_
diff --git a/chrome/browser/renderer_host/backing_store_mac.h b/chrome/browser/renderer_host/backing_store_mac.h
index 0c1e4a7..2c75400d 100644
--- a/chrome/browser/renderer_host/backing_store_mac.h
+++ b/chrome/browser/renderer_host/backing_store_mac.h
@@ -7,7 +7,7 @@
#pragma once
#include "base/basictypes.h"
-#include "base/scoped_cftyperef.h"
+#include "base/mac/scoped_cftyperef.h"
#include "chrome/browser/renderer_host/backing_store.h"
class BackingStoreMac : public BackingStore {
@@ -48,8 +48,8 @@ class BackingStoreMac : public BackingStore {
// result.
CGContextRef CreateCGBitmapContext();
- scoped_cftyperef<CGContextRef> cg_bitmap_;
- scoped_cftyperef<CGLayerRef> cg_layer_;
+ base::mac::ScopedCFTypeRef<CGContextRef> cg_bitmap_;
+ base::mac::ScopedCFTypeRef<CGLayerRef> cg_layer_;
DISALLOW_COPY_AND_ASSIGN(BackingStoreMac);
};
diff --git a/chrome/browser/renderer_host/backing_store_mac.mm b/chrome/browser/renderer_host/backing_store_mac.mm
index f793395..bea378f 100644
--- a/chrome/browser/renderer_host/backing_store_mac.mm
+++ b/chrome/browser/renderer_host/backing_store_mac.mm
@@ -9,6 +9,7 @@
#include "app/surface/transport_dib.h"
#include "base/logging.h"
#include "base/mac_util.h"
+#include "base/mac/scoped_cftyperef.h"
#include "base/sys_info.h"
#include "chrome/browser/renderer_host/render_process_host.h"
#include "chrome/browser/renderer_host/render_widget_host.h"
@@ -67,11 +68,11 @@ void BackingStoreMac::PaintToBackingStore(
if (!dib)
return;
- scoped_cftyperef<CGDataProviderRef> data_provider(
+ base::mac::ScopedCFTypeRef<CGDataProviderRef> data_provider(
CGDataProviderCreateWithData(NULL, dib->memory(),
bitmap_rect.width() * bitmap_rect.height() * 4, NULL));
- scoped_cftyperef<CGImageRef> bitmap_image(
+ base::mac::ScopedCFTypeRef<CGImageRef> bitmap_image(
CGImageCreate(bitmap_rect.width(), bitmap_rect.height(), 8, 32,
4 * bitmap_rect.width(), mac_util::GetSystemColorSpace(),
kCGImageAlphaPremultipliedFirst | kCGBitmapByteOrder32Host,
@@ -81,7 +82,7 @@ void BackingStoreMac::PaintToBackingStore(
const gfx::Rect& copy_rect = copy_rects[i];
// Only the subpixels given by copy_rect have pixels to copy.
- scoped_cftyperef<CGImageRef> image(
+ base::mac::ScopedCFTypeRef<CGImageRef> image(
CGImageCreateWithImageInRect(bitmap_image, CGRectMake(
copy_rect.x() - bitmap_rect.x(),
copy_rect.y() - bitmap_rect.y(),
@@ -93,7 +94,7 @@ void BackingStoreMac::PaintToBackingStore(
cg_layer_.reset(CreateCGLayer());
if (cg_layer()) {
// now that we have a layer, copy the cached image into it
- scoped_cftyperef<CGImageRef> bitmap_image(
+ base::mac::ScopedCFTypeRef<CGImageRef> bitmap_image(
CGBitmapContextCreateImage(cg_bitmap_));
CGContextDrawImage(CGLayerGetContext(cg_layer()),
CGRectMake(0, 0, size().width(), size().height()),
@@ -162,7 +163,7 @@ void BackingStoreMac::ScrollBackingStore(int dx, int dy,
// See http://crbug.com/45553 , comments 5 and 6.
static bool needs_layer_workaround = NeedsLayerWorkaround();
- scoped_cftyperef<CGLayerRef> new_layer;
+ base::mac::ScopedCFTypeRef<CGLayerRef> new_layer;
CGContextRef layer;
if (needs_layer_workaround) {
@@ -189,7 +190,7 @@ void BackingStoreMac::ScrollBackingStore(int dx, int dy,
cg_layer_.swap(new_layer);
} else {
// We don't have a layer, so scroll the contents of the CGBitmapContext.
- scoped_cftyperef<CGImageRef> bitmap_image(
+ base::mac::ScopedCFTypeRef<CGImageRef> bitmap_image(
CGBitmapContextCreateImage(cg_bitmap_));
CGContextSaveGState(cg_bitmap_);
CGContextClipToRect(cg_bitmap_,
diff --git a/chrome/browser/renderer_host/render_widget_host_view_mac.mm b/chrome/browser/renderer_host/render_widget_host_view_mac.mm
index a27fbcd..acf62a0 100644
--- a/chrome/browser/renderer_host/render_widget_host_view_mac.mm
+++ b/chrome/browser/renderer_host/render_widget_host_view_mac.mm
@@ -11,6 +11,7 @@
#import "base/chrome_application_mac.h"
#include "base/command_line.h"
#include "base/logging.h"
+#include "base/mac/scoped_cftyperef.h"
#include "base/metrics/histogram.h"
#import "base/scoped_nsautorelease_pool.h"
#import "base/scoped_nsobject.h"
@@ -1684,7 +1685,7 @@ void RenderWidgetHostViewMac::SetTextInputActive(bool active) {
// paints.
CGContextRef context = static_cast<CGContextRef>(
[[NSGraphicsContext currentContext] graphicsPort]);
- scoped_cftyperef<CGImageRef> image(
+ base::mac::ScopedCFTypeRef<CGImageRef> image(
CGBitmapContextCreateImage(backingStore->cg_bitmap()));
CGRect imageRect = bitmapRect.ToCGRect();
imageRect.origin.y = yOffset;
diff --git a/chrome/browser/search_engines/template_url_prepopulate_data.cc b/chrome/browser/search_engines/template_url_prepopulate_data.cc
index b8b7361..362f95b 100644
--- a/chrome/browser/search_engines/template_url_prepopulate_data.cc
+++ b/chrome/browser/search_engines/template_url_prepopulate_data.cc
@@ -23,7 +23,7 @@
#if defined(OS_WIN)
#undef IN // On Windows, windef.h defines this, which screws up "India" cases.
#elif defined(OS_MACOSX)
-#include "base/scoped_cftyperef.h"
+#include "base/mac/scoped_cftyperef.h"
#endif
using base::Time;
@@ -2863,7 +2863,7 @@ int GetCurrentCountryID() {
#elif defined(OS_MACOSX)
int GetCurrentCountryID() {
- scoped_cftyperef<CFLocaleRef> locale(CFLocaleCopyCurrent());
+ base::mac::ScopedCFTypeRef<CFLocaleRef> locale(CFLocaleCopyCurrent());
CFStringRef country = (CFStringRef)CFLocaleGetValue(locale.get(),
kCFLocaleCountryCode);
if (!country)
diff --git a/chrome/common/font_loader_mac.mm b/chrome/common/font_loader_mac.mm
index b88bffe..a5bb781 100644
--- a/chrome/common/font_loader_mac.mm
+++ b/chrome/common/font_loader_mac.mm
@@ -11,7 +11,6 @@
#include "base/file_util.h"
#include "base/logging.h"
#include "base/mac_util.h"
-#include "base/scoped_cftyperef.h"
#include "base/sys_string_conversions.h"
// static
diff --git a/chrome/common/mach_message_source_mac.cc b/chrome/common/mach_message_source_mac.cc
index 1249d8a..76c899e 100644
--- a/chrome/common/mach_message_source_mac.cc
+++ b/chrome/common/mach_message_source_mac.cc
@@ -5,6 +5,7 @@
#include "chrome/common/mach_message_source_mac.h"
#include "base/logging.h"
+#include "base/mac/scoped_cftyperef.h"
MachMessageSource::MachMessageSource(mach_port_t port,
MachPortListener* msg_listener,
@@ -16,7 +17,7 @@ MachMessageSource::MachMessageSource(mach_port_t port,
CFMachPortContext port_context = {0};
port_context.info = msg_listener;
- scoped_cftyperef<CFMachPortRef> cf_mach_port_ref(
+ base::mac::ScopedCFTypeRef<CFMachPortRef> cf_mach_port_ref(
CFMachPortCreateWithPort(kCFAllocatorDefault,
port,
MachMessageSource::OnReceiveMachMessage,
diff --git a/chrome/common/mach_message_source_mac.h b/chrome/common/mach_message_source_mac.h
index 5ad8329..b1c20fb 100644
--- a/chrome/common/mach_message_source_mac.h
+++ b/chrome/common/mach_message_source_mac.h
@@ -8,7 +8,7 @@
#include <CoreServices/CoreServices.h>
-#include "base/scoped_cftyperef.h"
+#include "base/mac/scoped_cftyperef.h"
// Handles registering and cleaning up after a CFRunloopSource for a Mach port.
// Messages received on the port are piped through to a delegate.
@@ -56,7 +56,7 @@ class MachMessageSource {
static void OnReceiveMachMessage(CFMachPortRef port, void* msg, CFIndex size,
void* closure);
- scoped_cftyperef<CFRunLoopSourceRef> machport_runloop_ref_;
+ base::mac::ScopedCFTypeRef<CFRunLoopSourceRef> machport_runloop_ref_;
DISALLOW_COPY_AND_ASSIGN(MachMessageSource);
};
diff --git a/chrome/common/sandbox_mac.mm b/chrome/common/sandbox_mac.mm
index 303a538..f4d1eec 100644
--- a/chrome/common/sandbox_mac.mm
+++ b/chrome/common/sandbox_mac.mm
@@ -17,7 +17,7 @@ extern "C" {
#include "base/file_util.h"
#include "base/mac_util.h"
#include "base/rand_util_c.h"
-#include "base/scoped_cftyperef.h"
+#include "base/mac/scoped_cftyperef.h"
#include "base/scoped_nsautorelease_pool.h"
#include "base/string16.h"
#include "base/string_util.h"
@@ -190,12 +190,12 @@ void SandboxWarmup() {
base::ScopedNSAutoreleasePool scoped_pool;
{ // CGColorSpaceCreateWithName(), CGBitmapContextCreate() - 10.5.6
- scoped_cftyperef<CGColorSpaceRef> rgb_colorspace(
+ base::mac::ScopedCFTypeRef<CGColorSpaceRef> rgb_colorspace(
CGColorSpaceCreateWithName(kCGColorSpaceGenericRGB));
// Allocate a 1x1 image.
char data[4];
- scoped_cftyperef<CGContextRef> context(
+ base::mac::ScopedCFTypeRef<CGContextRef> context(
CGBitmapContextCreate(data, 1, 1, 8, 1 * 4,
rgb_colorspace,
kCGImageAlphaPremultipliedFirst |
@@ -206,7 +206,7 @@ void SandboxWarmup() {
(void) mac_util::GetSystemColorSpace();
// CGColorSpaceCreateSystemDefaultCMYK - 10.6
- scoped_cftyperef<CGColorSpaceRef> cmyk_colorspace(
+ base::mac::ScopedCFTypeRef<CGColorSpaceRef> cmyk_colorspace(
CGColorSpaceCreateWithName(kCGColorSpaceGenericCMYK));
}
@@ -231,7 +231,7 @@ void SandboxWarmup() {
char png_header[] = {0x89, 0x50, 0x4E, 0x47, 0x0D, 0x0A, 0x1A, 0x0A};
NSData* data = [NSData dataWithBytes:png_header
length:arraysize(png_header)];
- scoped_cftyperef<CGImageSourceRef> img(
+ base::mac::ScopedCFTypeRef<CGImageSourceRef> img(
CGImageSourceCreateWithData((CFDataRef)data,
NULL));
CGImageSourceGetStatus(img);
diff --git a/chrome/common/sandbox_mac_fontloading_unittest.mm b/chrome/common/sandbox_mac_fontloading_unittest.mm
index f07a444..834fc0b 100644
--- a/chrome/common/sandbox_mac_fontloading_unittest.mm
+++ b/chrome/common/sandbox_mac_fontloading_unittest.mm
@@ -6,7 +6,7 @@
#include "base/file_util.h"
#include "base/logging.h"
-#include "base/scoped_cftyperef.h"
+#include "base/mac/scoped_cftyperef.h"
#include "base/scoped_ptr.h"
#include "base/shared_memory.h"
#include "chrome/common/font_loader_mac.h"
@@ -136,7 +136,7 @@ bool FontLoadingTestCase::SandboxedTest() {
LOG(ERROR) << "Got NULL CGFontRef";
return false;
}
- scoped_cftyperef<CGFontRef> cgfont;
+ base::mac::ScopedCFTypeRef<CGFontRef> cgfont;
cgfont.reset(font_ref);
const NSFont* nsfont = reinterpret_cast<const NSFont*>(
diff --git a/chrome/plugin/plugin_thread.cc b/chrome/plugin/plugin_thread.cc
index 8e2b3ba..954cf9f 100644
--- a/chrome/plugin/plugin_thread.cc
+++ b/chrome/plugin/plugin_thread.cc
@@ -38,7 +38,7 @@
#elif defined(OS_MACOSX)
#include "app/l10n_util.h"
#include "base/mac_util.h"
-#include "base/scoped_cftyperef.h"
+#include "base/mac/scoped_cftyperef.h"
#include "base/sys_string_conversions.h"
#include "grit/chromium_strings.h"
#endif
@@ -103,13 +103,14 @@ PluginThread::PluginThread()
plugin->NP_Initialize();
#if defined(OS_MACOSX)
- scoped_cftyperef<CFStringRef> plugin_name(base::SysUTF16ToCFStringRef(
- plugin->plugin_info().name));
- scoped_cftyperef<CFStringRef> app_name(base::SysUTF16ToCFStringRef(
- l10n_util::GetStringUTF16(IDS_SHORT_PLUGIN_APP_NAME)));
- scoped_cftyperef<CFStringRef> process_name(CFStringCreateWithFormat(
- kCFAllocatorDefault, NULL, CFSTR("%@ (%@)"),
- plugin_name.get(), app_name.get()));
+ base::mac::ScopedCFTypeRef<CFStringRef> plugin_name(
+ base::SysUTF16ToCFStringRef(plugin->plugin_info().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("%@ (%@)"),
+ plugin_name.get(), app_name.get()));
mac_util::SetProcessName(process_name);
#endif
}
diff --git a/chrome/plugin/webplugin_proxy.cc b/chrome/plugin/webplugin_proxy.cc
index 9741393..f41da3e 100644
--- a/chrome/plugin/webplugin_proxy.cc
+++ b/chrome/plugin/webplugin_proxy.cc
@@ -11,6 +11,7 @@
#endif
#if defined(OS_MACOSX)
#include "base/mac_util.h"
+#include "base/mac/scoped_cftyperef.h"
#endif
#include "base/scoped_handle.h"
#include "base/shared_memory.h"
@@ -218,7 +219,8 @@ NPObject* WebPluginProxy::GetPluginElement() {
int npobject_route_id = channel_->GenerateRouteID();
bool success = false;
- Send(new PluginHostMsg_GetPluginElement(route_id_, npobject_route_id, &success));
+ Send(new PluginHostMsg_GetPluginElement(route_id_, npobject_route_id,
+ &success));
if (!success)
return NULL;
@@ -416,12 +418,12 @@ void WebPluginProxy::Paint(const gfx::Rect& rect) {
CGContextRef saved_context_weak = windowless_context_.get();
if (background_context_.get()) {
- scoped_cftyperef<CGImageRef> image(
+ base::mac::ScopedCFTypeRef<CGImageRef> image(
CGBitmapContextCreateImage(background_context_));
CGRect source_rect = rect.ToCGRect();
// Flip the rect we use to pull from the canvas, since it's upside-down.
source_rect.origin.y = CGImageGetHeight(image) - rect.y() - rect.height();
- scoped_cftyperef<CGImageRef> sub_image(
+ base::mac::ScopedCFTypeRef<CGImageRef> sub_image(
CGImageCreateWithImageInRect(image, source_rect));
CGContextDrawImage(windowless_context_, rect.ToCGRect(), sub_image);
} else if (transparent_) {
diff --git a/chrome/plugin/webplugin_proxy.h b/chrome/plugin/webplugin_proxy.h
index bf0b705..a33dae7 100644
--- a/chrome/plugin/webplugin_proxy.h
+++ b/chrome/plugin/webplugin_proxy.h
@@ -15,7 +15,7 @@
#include "base/hash_tables.h"
#include "base/ref_counted.h"
#if defined(OS_MACOSX)
-#include "base/scoped_cftyperef.h"
+#include "base/mac/scoped_cftyperef.h"
#endif
#include "base/scoped_handle.h"
#include "base/scoped_ptr.h"
@@ -208,8 +208,8 @@ class WebPluginProxy : public webkit_glue::WebPlugin {
#if defined(OS_MACOSX)
scoped_ptr<TransportDIB> windowless_dib_;
scoped_ptr<TransportDIB> background_dib_;
- scoped_cftyperef<CGContextRef> windowless_context_;
- scoped_cftyperef<CGContextRef> background_context_;
+ base::mac::ScopedCFTypeRef<CGContextRef> windowless_context_;
+ base::mac::ScopedCFTypeRef<CGContextRef> background_context_;
scoped_ptr<WebPluginAcceleratedSurfaceProxy> accelerated_surface_;
#else
scoped_ptr<skia::PlatformCanvas> windowless_canvas_;
diff --git a/chrome/renderer/print_web_view_helper_mac.mm b/chrome/renderer/print_web_view_helper_mac.mm
index 97410dc..3864b31 100644
--- a/chrome/renderer/print_web_view_helper_mac.mm
+++ b/chrome/renderer/print_web_view_helper_mac.mm
@@ -9,7 +9,6 @@
#include "app/l10n_util.h"
#include "base/logging.h"
#include "base/process_util.h"
-#include "base/scoped_cftyperef.h"
#include "chrome/common/render_messages.h"
#include "chrome/common/render_messages_params.h"
#include "chrome/renderer/render_view.h"
diff --git a/chrome/renderer/webplugin_delegate_pepper.cc b/chrome/renderer/webplugin_delegate_pepper.cc
index ea434f6..7d0a5a2 100644
--- a/chrome/renderer/webplugin_delegate_pepper.cc
+++ b/chrome/renderer/webplugin_delegate_pepper.cc
@@ -25,7 +25,7 @@
#include "base/path_service.h"
#include "base/process_util.h"
#if defined(OS_MACOSX)
-#include "base/scoped_cftyperef.h"
+#include "base/mac/scoped_cftyperef.h"
#endif
#include "base/scoped_ptr.h"
#include "base/string_number_conversions.h"
@@ -1739,11 +1739,11 @@ void WebPluginDelegatePepper::DrawSkBitmapToCanvas(
int canvas_height) {
SkAutoLockPixels lock(bitmap);
DCHECK(bitmap.getConfig() == SkBitmap::kARGB_8888_Config);
- scoped_cftyperef<CGDataProviderRef> data_provider(
+ base::mac::ScopedCFTypeRef<CGDataProviderRef> data_provider(
CGDataProviderCreateWithData(
NULL, bitmap.getAddr32(0, 0),
bitmap.rowBytes() * bitmap.height(), NULL));
- scoped_cftyperef<CGImageRef> image(
+ base::mac::ScopedCFTypeRef<CGImageRef> image(
CGImageCreate(
bitmap.width(), bitmap.height(),
8, 32, bitmap.rowBytes(),
diff --git a/chrome/renderer/webplugin_delegate_proxy.cc b/chrome/renderer/webplugin_delegate_proxy.cc
index f4229ff..b5baf2e 100644
--- a/chrome/renderer/webplugin_delegate_proxy.cc
+++ b/chrome/renderer/webplugin_delegate_proxy.cc
@@ -55,10 +55,6 @@
#include "ipc/ipc_channel_posix.h"
#endif
-#if defined(OS_MACOSX)
-#include "base/scoped_cftyperef.h"
-#endif
-
using WebKit::WebBindings;
using WebKit::WebCursorInfo;
using WebKit::WebDragData;
diff --git a/gfx/blit.cc b/gfx/blit.cc
index 3c4f345..88d4057 100644
--- a/gfx/blit.cc
+++ b/gfx/blit.cc
@@ -17,7 +17,7 @@
#if defined(OS_MACOSX)
#include "base/mac_util.h"
-#include "base/scoped_cftyperef.h"
+#include "base/mac/scoped_cftyperef.h"
#endif
namespace gfx {
@@ -70,9 +70,9 @@ void BlitContextToContext(NativeDrawingContext dst_context,
: transform.ty;
src_rect.Offset(transform.tx, delta_y);
- scoped_cftyperef<CGImageRef>
+ base::mac::ScopedCFTypeRef<CGImageRef>
src_image(CGBitmapContextCreateImage(src_context));
- scoped_cftyperef<CGImageRef> src_sub_image(
+ base::mac::ScopedCFTypeRef<CGImageRef> src_sub_image(
CGImageCreateWithImageInRect(src_image, src_rect.ToCGRect()));
CGContextDrawImage(dst_context, dst_rect.ToCGRect(), src_sub_image);
#else // Linux, BSD, others
diff --git a/gfx/canvas_skia_mac.mm b/gfx/canvas_skia_mac.mm
index f134eda..547a5e4 100644
--- a/gfx/canvas_skia_mac.mm
+++ b/gfx/canvas_skia_mac.mm
@@ -6,7 +6,7 @@
#include "gfx/canvas_skia.h"
-#include "base/scoped_cftyperef.h"
+#include "base/mac/scoped_cftyperef.h"
#include "base/sys_string_conversions.h"
#include "gfx/font.h"
#include "gfx/rect.h"
@@ -70,7 +70,7 @@ void CanvasSkia::DrawStringInt(const std::wstring& text,
NSAttributedString* ns_string =
[[[NSAttributedString alloc] initWithString:base::SysWideToNSString(text)
attributes:attributes] autorelease];
- scoped_cftyperef<CTFramesetterRef> framesetter(
+ base::mac::ScopedCFTypeRef<CTFramesetterRef> framesetter(
CTFramesetterCreateWithAttributedString(
reinterpret_cast<CFAttributedStringRef>(ns_string)));
@@ -78,7 +78,7 @@ void CanvasSkia::DrawStringInt(const std::wstring& text,
CGMutablePathRef path = CGPathCreateMutable();
CGPathAddRect(path, NULL, text_bounds);
- scoped_cftyperef<CTFrameRef> frame(
+ base::mac::ScopedCFTypeRef<CTFrameRef> frame(
CTFramesetterCreateFrame(framesetter, CFRangeMake(0, 0), path, NULL));
CTFrameDraw(frame, context);
CGContextRestoreGState(context);
diff --git a/net/base/cert_test_util.cc b/net/base/cert_test_util.cc
index 8815cd5..7e8fde0 100644
--- a/net/base/cert_test_util.cc
+++ b/net/base/cert_test_util.cc
@@ -15,7 +15,7 @@
#include "base/nss_util.h"
#elif defined(OS_MACOSX)
#include <Security/Security.h>
-#include "base/scoped_cftyperef.h"
+#include "base/mac/scoped_cftyperef.h"
#endif
#include "base/file_util.h"
@@ -104,7 +104,7 @@ X509Certificate* LoadTemporaryRootCert(const FilePath& filename) {
static_cast<CFIndex>(rawcert.size()));
if (!pem)
return NULL;
- scoped_cftyperef<CFDataRef> scoped_pem(pem);
+ base::mac::ScopedCFTypeRef<CFDataRef> scoped_pem(pem);
SecExternalFormat input_format = kSecFormatUnknown;
SecExternalItemType item_type = kSecItemTypeUnknown;
@@ -112,7 +112,7 @@ X509Certificate* LoadTemporaryRootCert(const FilePath& filename) {
if (SecKeychainItemImport(pem, NULL, &input_format, &item_type, 0, NULL, NULL,
&cert_array))
return NULL;
- scoped_cftyperef<CFArrayRef> scoped_cert_array(cert_array);
+ base::mac::ScopedCFTypeRef<CFArrayRef> scoped_cert_array(cert_array);
if (!CFArrayGetCount(cert_array))
return NULL;
diff --git a/net/base/keygen_handler_mac.cc b/net/base/keygen_handler_mac.cc
index 460fd46..fdad99e 100644
--- a/net/base/keygen_handler_mac.cc
+++ b/net/base/keygen_handler_mac.cc
@@ -12,7 +12,7 @@
#include "base/crypto/cssm_init.h"
#include "base/lock.h"
#include "base/logging.h"
-#include "base/scoped_cftyperef.h"
+#include "base/mac/scoped_cftyperef.h"
#include "base/string_util.h"
#include "base/sys_string_conversions.h"
@@ -111,7 +111,7 @@ std::string KeygenHandler::GenKeyAndSignChallenge() {
if (url_.has_host()) {
// TODO(davidben): Use something like "Key generated for
// example.com", but localize it.
- scoped_cftyperef<CFStringRef> label(
+ base::mac::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
@@ -137,7 +137,7 @@ std::string KeygenHandler::GenKeyAndSignChallenge() {
base::LogCSSMError("SecKeychainItemExpor", err);
goto failure;
}
- scoped_cftyperef<CFDataRef> scoped_key_data(key_data);
+ base::mac::ScopedCFTypeRef<CFDataRef> scoped_key_data(key_data);
// Create an ASN.1 encoder.
err = SecAsn1CoderCreate(&coder);
@@ -232,7 +232,7 @@ static OSStatus CreateRSAKeyPair(int size_in_bits,
base::LogCSSMError("SecKeychainCopyDefault", err);
return err;
}
- scoped_cftyperef<SecKeychainRef> scoped_keychain(keychain);
+ base::mac::ScopedCFTypeRef<SecKeychainRef> scoped_keychain(keychain);
{
AutoLock locked(base::GetMacSecurityServicesLock());
err = SecKeyCreatePair(
diff --git a/net/base/network_change_notifier_mac.cc b/net/base/network_change_notifier_mac.cc
index e5b3ce39..7521c90 100644
--- a/net/base/network_change_notifier_mac.cc
+++ b/net/base/network_change_notifier_mac.cc
@@ -7,6 +7,8 @@
#include <SystemConfiguration/SCDynamicStoreKey.h>
#include <SystemConfiguration/SCSchemaDefinitions.h>
+#include "base/mac/scoped_cftyperef.h"
+
namespace net {
NetworkChangeNotifierMac::NetworkChangeNotifierMac()
@@ -22,10 +24,11 @@ bool NetworkChangeNotifierMac::IsCurrentlyOffline() const {
void NetworkChangeNotifierMac::SetDynamicStoreNotificationKeys(
SCDynamicStoreRef store) {
// Called on notifier thread.
- scoped_cftyperef<CFMutableArrayRef> notification_keys(
+ base::mac::ScopedCFTypeRef<CFMutableArrayRef> notification_keys(
CFArrayCreateMutable(kCFAllocatorDefault, 0, &kCFTypeArrayCallBacks));
- scoped_cftyperef<CFStringRef> key(SCDynamicStoreKeyCreateNetworkGlobalEntity(
- NULL, kSCDynamicStoreDomainState, kSCEntNetInterface));
+ base::mac::ScopedCFTypeRef<CFStringRef> key(
+ SCDynamicStoreKeyCreateNetworkGlobalEntity(
+ NULL, kSCDynamicStoreDomainState, kSCEntNetInterface));
CFArrayAppendValue(notification_keys.get(), key.get());
key.reset(SCDynamicStoreKeyCreateNetworkGlobalEntity(
NULL, kSCDynamicStoreDomainState, kSCEntNetIPv4));
diff --git a/net/base/network_config_watcher_mac.cc b/net/base/network_config_watcher_mac.cc
index 8e60223..365859e 100644
--- a/net/base/network_config_watcher_mac.cc
+++ b/net/base/network_config_watcher_mac.cc
@@ -9,6 +9,7 @@
#include <algorithm>
#include "base/thread.h"
+#include "base/mac/scoped_cftyperef.h"
// We only post tasks to a child thread we own, so we don't need refcounting.
DISABLE_RUNNABLE_METHOD_REFCOUNT(net::NetworkConfigWatcherMac);
@@ -76,7 +77,7 @@ void NetworkConfigWatcherMac::Init() {
NULL, // This is not reference counted. No release function.
NULL, // No description for this.
};
- scoped_cftyperef<SCDynamicStoreRef> store(SCDynamicStoreCreate(
+ base::mac::ScopedCFTypeRef<SCDynamicStoreRef> store(SCDynamicStoreCreate(
NULL, CFSTR("org.chromium"), DynamicStoreCallback, &context));
run_loop_source_.reset(SCDynamicStoreCreateRunLoopSource(
NULL, store.get(), 0));
diff --git a/net/base/network_config_watcher_mac.h b/net/base/network_config_watcher_mac.h
index 78f06a5..f9f9d36 100644
--- a/net/base/network_config_watcher_mac.h
+++ b/net/base/network_config_watcher_mac.h
@@ -9,7 +9,7 @@
#include "base/basictypes.h"
#include "base/message_loop.h"
-#include "base/scoped_cftyperef.h"
+#include "base/mac/scoped_cftyperef.h"
#include "base/scoped_ptr.h"
namespace base {
@@ -55,7 +55,7 @@ class NetworkConfigWatcherMac : public MessageLoop::DestructionObserver {
// was created on.
scoped_ptr<base::Thread> notifier_thread_;
- scoped_cftyperef<CFRunLoopSourceRef> run_loop_source_;
+ base::mac::ScopedCFTypeRef<CFRunLoopSourceRef> run_loop_source_;
Delegate* const delegate_;
diff --git a/net/base/platform_mime_util_mac.cc b/net/base/platform_mime_util_mac.cc
index ce8c336..9d27e5d 100644
--- a/net/base/platform_mime_util_mac.cc
+++ b/net/base/platform_mime_util_mac.cc
@@ -5,7 +5,7 @@
#include <CoreServices/CoreServices.h>
#include <string>
-#include "base/scoped_cftyperef.h"
+#include "base/mac/scoped_cftyperef.h"
#include "base/sys_string_conversions.h"
#include "net/base/platform_mime_util.h"
@@ -16,16 +16,17 @@ bool PlatformMimeUtil::GetPlatformMimeTypeFromExtension(
std::string ext_nodot = ext;
if (ext_nodot.length() >= 1 && ext_nodot[0] == L'.')
ext_nodot.erase(ext_nodot.begin());
- scoped_cftyperef<CFStringRef> ext_ref(base::SysUTF8ToCFStringRef(ext_nodot));
+ base::mac::ScopedCFTypeRef<CFStringRef> ext_ref(
+ base::SysUTF8ToCFStringRef(ext_nodot));
if (!ext_ref)
return false;
- scoped_cftyperef<CFStringRef> uti(
+ base::mac::ScopedCFTypeRef<CFStringRef> uti(
UTTypeCreatePreferredIdentifierForTag(kUTTagClassFilenameExtension,
ext_ref,
NULL));
if (!uti)
return false;
- scoped_cftyperef<CFStringRef> mime_ref(
+ base::mac::ScopedCFTypeRef<CFStringRef> mime_ref(
UTTypeCopyPreferredTagWithClass(uti, kUTTagClassMIMEType));
if (!mime_ref)
return false;
@@ -36,16 +37,17 @@ bool PlatformMimeUtil::GetPlatformMimeTypeFromExtension(
bool PlatformMimeUtil::GetPreferredExtensionForMimeType(
const std::string& mime_type, FilePath::StringType* ext) const {
- scoped_cftyperef<CFStringRef> mime_ref(base::SysUTF8ToCFStringRef(mime_type));
+ base::mac::ScopedCFTypeRef<CFStringRef> mime_ref(
+ base::SysUTF8ToCFStringRef(mime_type));
if (!mime_ref)
return false;
- scoped_cftyperef<CFStringRef> uti(
+ base::mac::ScopedCFTypeRef<CFStringRef> uti(
UTTypeCreatePreferredIdentifierForTag(kUTTagClassMIMEType,
mime_ref,
NULL));
if (!uti)
return false;
- scoped_cftyperef<CFStringRef> ext_ref(
+ base::mac::ScopedCFTypeRef<CFStringRef> ext_ref(
UTTypeCopyPreferredTagWithClass(uti, kUTTagClassFilenameExtension));
if (!ext_ref)
return false;
diff --git a/net/base/ssl_config_service_mac.cc b/net/base/ssl_config_service_mac.cc
index 82a3632..2ce1d5c 100644
--- a/net/base/ssl_config_service_mac.cc
+++ b/net/base/ssl_config_service_mac.cc
@@ -6,7 +6,7 @@
#include <CoreFoundation/CoreFoundation.h>
-#include "base/scoped_cftyperef.h"
+#include "base/mac/scoped_cftyperef.h"
using base::TimeDelta;
using base::TimeTicks;
@@ -36,7 +36,7 @@ bool RevocationStyleIsEnabled(CFStringRef key) {
kRevocationPreferencesIdentifier, kCFPreferencesCurrentUser,
kCFPreferencesAnyHost);
if (plist_ref) {
- scoped_cftyperef<CFPropertyListRef> scoped_plist_ref(plist_ref);
+ base::mac::ScopedCFTypeRef<CFPropertyListRef> scoped_plist_ref(plist_ref);
if (CFGetTypeID(plist_ref) == CFStringGetTypeID()) {
CFStringRef style = reinterpret_cast<CFStringRef>(plist_ref);
if (CFStringCompare(kNoneRevocationValue, style,
diff --git a/net/base/x509_certificate_mac.cc b/net/base/x509_certificate_mac.cc
index cd8a3ca..05fbe63 100644
--- a/net/base/x509_certificate_mac.cc
+++ b/net/base/x509_certificate_mac.cc
@@ -10,12 +10,13 @@
#include "base/logging.h"
#include "base/pickle.h"
-#include "base/scoped_cftyperef.h"
+#include "base/mac/scoped_cftyperef.h"
#include "base/sys_string_conversions.h"
#include "net/base/cert_status_flags.h"
#include "net/base/cert_verify_result.h"
#include "net/base/net_errors.h"
+using base::mac::ScopedCFTypeRef;
using base::Time;
namespace net {
@@ -46,7 +47,7 @@ class MacTrustedCertificates {
OSStatus status = SecTrustCopyAnchorCertificates(&anchor_array);
if (status)
return NULL;
- scoped_cftyperef<CFArrayRef> scoped_anchor_array(anchor_array);
+ ScopedCFTypeRef<CFArrayRef> scoped_anchor_array(anchor_array);
CFMutableArrayRef merged_array = CFArrayCreateMutableCopy(
kCFAllocatorDefault, 0, anchor_array);
if (!merged_array)
@@ -337,17 +338,17 @@ OSStatus CopyCertChain(SecCertificateRef cert_handle,
OSStatus result = X509Certificate::CreateSSLClientPolicy(&ssl_policy);
if (result)
return result;
- scoped_cftyperef<SecPolicyRef> scoped_ssl_policy(ssl_policy);
+ ScopedCFTypeRef<SecPolicyRef> scoped_ssl_policy(ssl_policy);
// Create a SecTrustRef.
- scoped_cftyperef<CFArrayRef> input_certs(
+ ScopedCFTypeRef<CFArrayRef> input_certs(
CFArrayCreate(NULL, (const void**)&cert_handle, 1,
&kCFTypeArrayCallBacks));
SecTrustRef trust_ref = NULL;
result = SecTrustCreateWithCertificates(input_certs, ssl_policy, &trust_ref);
if (result)
return result;
- scoped_cftyperef<SecTrustRef> trust(trust_ref);
+ ScopedCFTypeRef<SecTrustRef> trust(trust_ref);
// Evaluate trust, which creates the cert chain.
SecTrustResultType status;
@@ -396,7 +397,7 @@ void AddCertificatesFromBytes(const char* data, size_t length,
SecExternalFormat format,
X509Certificate::OSCertHandles* output) {
SecExternalFormat input_format = format;
- scoped_cftyperef<CFDataRef> local_data(CFDataCreateWithBytesNoCopy(
+ ScopedCFTypeRef<CFDataRef> local_data(CFDataCreateWithBytesNoCopy(
kCFAllocatorDefault, reinterpret_cast<const UInt8*>(data),
length, kCFAllocatorNull));
@@ -409,7 +410,7 @@ void AddCertificatesFromBytes(const char* data, size_t length,
return;
}
- scoped_cftyperef<CFArrayRef> scoped_items(items);
+ ScopedCFTypeRef<CFArrayRef> scoped_items(items);
CFTypeID cert_type_id = SecCertificateGetTypeID();
for (CFIndex i = 0; i < CFArrayGetCount(items); ++i) {
@@ -513,7 +514,7 @@ int X509Certificate::Verify(const std::string& hostname, int flags,
&ssl_policy);
if (status)
return NetErrorFromOSStatus(status);
- scoped_cftyperef<SecPolicyRef> scoped_ssl_policy(ssl_policy);
+ ScopedCFTypeRef<SecPolicyRef> scoped_ssl_policy(ssl_policy);
// Create and configure a SecTrustRef, which takes our certificate(s)
// and our SSL SecPolicyRef. SecTrustCreateWithCertificates() takes an
@@ -524,7 +525,7 @@ int X509Certificate::Verify(const std::string& hostname, int flags,
&kCFTypeArrayCallBacks);
if (!cert_array)
return ERR_OUT_OF_MEMORY;
- scoped_cftyperef<CFArrayRef> scoped_cert_array(cert_array);
+ ScopedCFTypeRef<CFArrayRef> scoped_cert_array(cert_array);
CFArrayAppendValue(cert_array, cert_handle_);
for (size_t i = 0; i < intermediate_ca_certs_.size(); ++i)
CFArrayAppendValue(cert_array, intermediate_ca_certs_[i]);
@@ -539,13 +540,13 @@ int X509Certificate::Verify(const std::string& hostname, int flags,
status = SecTrustCreateWithCertificates(cert_array, ssl_policy, &trust_ref);
if (status)
return NetErrorFromOSStatus(status);
- scoped_cftyperef<SecTrustRef> scoped_trust_ref(trust_ref);
+ ScopedCFTypeRef<SecTrustRef> scoped_trust_ref(trust_ref);
// Set the trusted anchor certificates for the SecTrustRef by merging the
// system trust anchors and the test root certificate.
CFArrayRef anchor_array =
Singleton<MacTrustedCertificates>::get()->CopyTrustedCertificateArray();
- scoped_cftyperef<CFArrayRef> scoped_anchor_array(anchor_array);
+ ScopedCFTypeRef<CFArrayRef> scoped_anchor_array(anchor_array);
if (anchor_array) {
status = SecTrustSetAnchorCertificates(trust_ref, anchor_array);
if (status)
@@ -573,7 +574,7 @@ int X509Certificate::Verify(const std::string& hostname, int flags,
sizeof(tp_action_data));
if (!action_data_ref)
return ERR_OUT_OF_MEMORY;
- scoped_cftyperef<CFDataRef> scoped_action_data_ref(action_data_ref);
+ ScopedCFTypeRef<CFDataRef> scoped_action_data_ref(action_data_ref);
status = SecTrustSetParameters(trust_ref, CSSM_TP_ACTION_DEFAULT,
action_data_ref);
if (status)
@@ -594,7 +595,7 @@ int X509Certificate::Verify(const std::string& hostname, int flags,
&chain_info);
if (status)
return NetErrorFromOSStatus(status);
- scoped_cftyperef<CFArrayRef> scoped_completed_chain(completed_chain);
+ ScopedCFTypeRef<CFArrayRef> scoped_completed_chain(completed_chain);
// Evaluate the results
OSStatus cssm_result;
@@ -864,7 +865,7 @@ bool X509Certificate::IsIssuedBy(
result = CopyCertChain(os_cert_handle(), &cert_chain);
if (result != noErr)
return false;
- scoped_cftyperef<CFArrayRef> scoped_cert_chain(cert_chain);
+ ScopedCFTypeRef<CFArrayRef> scoped_cert_chain(cert_chain);
// Check all the certs in the chain for a match.
int n = CFArrayGetCount(cert_chain);
@@ -902,10 +903,10 @@ bool X509Certificate::GetSSLClientCertificates (
const std::string& server_domain,
const std::vector<CertPrincipal>& valid_issuers,
std::vector<scoped_refptr<X509Certificate> >* certs) {
- scoped_cftyperef<SecIdentityRef> preferred_identity;
+ ScopedCFTypeRef<SecIdentityRef> preferred_identity;
if (!server_domain.empty()) {
// See if there's an identity preference for this domain:
- scoped_cftyperef<CFStringRef> domain_str(
+ ScopedCFTypeRef<CFStringRef> domain_str(
base::SysUTF8ToCFStringRef("https://" + server_domain));
SecIdentityRef identity = NULL;
if (SecIdentityCopyPreference(domain_str,
@@ -918,19 +919,19 @@ bool X509Certificate::GetSSLClientCertificates (
// Now enumerate the identities in the available keychains.
SecIdentitySearchRef search = nil;
OSStatus err = SecIdentitySearchCreate(NULL, CSSM_KEYUSE_SIGN, &search);
- scoped_cftyperef<SecIdentitySearchRef> scoped_search(search);
+ ScopedCFTypeRef<SecIdentitySearchRef> scoped_search(search);
while (!err) {
SecIdentityRef identity = NULL;
err = SecIdentitySearchCopyNext(search, &identity);
if (err)
break;
- scoped_cftyperef<SecIdentityRef> scoped_identity(identity);
+ ScopedCFTypeRef<SecIdentityRef> scoped_identity(identity);
SecCertificateRef cert_handle;
err = SecIdentityCopyCertificate(identity, &cert_handle);
if (err != noErr)
continue;
- scoped_cftyperef<SecCertificateRef> scoped_cert_handle(cert_handle);
+ ScopedCFTypeRef<SecCertificateRef> scoped_cert_handle(cert_handle);
scoped_refptr<X509Certificate> cert(
CreateFromHandle(cert_handle, SOURCE_LONE_CERT_IMPORT,
@@ -983,7 +984,7 @@ CFArrayRef X509Certificate::CreateClientCertificateChain() const {
LOG(ERROR) << "SecIdentityCreateWithCertificate error " << result;
return NULL;
}
- scoped_cftyperef<CFMutableArrayRef> chain(
+ ScopedCFTypeRef<CFMutableArrayRef> chain(
CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks));
CFArrayAppendValue(chain, identity);
diff --git a/net/proxy/proxy_config_service_mac.cc b/net/proxy/proxy_config_service_mac.cc
index a197313..c6faa27 100644
--- a/net/proxy/proxy_config_service_mac.cc
+++ b/net/proxy/proxy_config_service_mac.cc
@@ -9,7 +9,7 @@
#include "base/logging.h"
#include "base/mac_util.h"
-#include "base/scoped_cftyperef.h"
+#include "base/mac/scoped_cftyperef.h"
#include "base/sys_string_conversions.h"
#include "net/base/net_errors.h"
#include "net/proxy/proxy_config.h"
@@ -40,7 +40,7 @@ bool GetBoolFromDictionary(CFDictionaryRef dict,
}
void GetCurrentProxyConfig(ProxyConfig* config) {
- scoped_cftyperef<CFDictionaryRef> config_dict(
+ base::mac::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 8e8ef20..442715d 100644
--- a/net/proxy/proxy_resolver_mac.cc
+++ b/net/proxy/proxy_resolver_mac.cc
@@ -8,7 +8,7 @@
#include "base/logging.h"
#include "base/mac_util.h"
-#include "base/scoped_cftyperef.h"
+#include "base/mac/scoped_cftyperef.h"
#include "base/string_util.h"
#include "base/sys_string_conversions.h"
#include "net/base/net_errors.h"
@@ -60,19 +60,19 @@ int ProxyResolverMac::GetProxyForURL(const GURL& query_url,
CompletionCallback* /*callback*/,
RequestHandle* /*request*/,
const BoundNetLog& net_log) {
- scoped_cftyperef<CFStringRef> query_ref(
+ base::mac::ScopedCFTypeRef<CFStringRef> query_ref(
base::SysUTF8ToCFStringRef(query_url.spec()));
- scoped_cftyperef<CFURLRef> query_url_ref(
+ base::mac::ScopedCFTypeRef<CFURLRef> query_url_ref(
CFURLCreateWithString(kCFAllocatorDefault,
query_ref.get(),
NULL));
if (!query_url_ref.get())
return ERR_FAILED;
- scoped_cftyperef<CFStringRef> pac_ref(
+ base::mac::ScopedCFTypeRef<CFStringRef> pac_ref(
base::SysUTF8ToCFStringRef(
script_data_->type() == ProxyResolverScriptData::TYPE_AUTO_DETECT ?
std::string() : script_data_->url().spec()));
- scoped_cftyperef<CFURLRef> pac_url_ref(
+ base::mac::ScopedCFTypeRef<CFURLRef> pac_url_ref(
CFURLCreateWithString(kCFAllocatorDefault,
pac_ref.get(),
NULL));
@@ -95,7 +95,7 @@ int ProxyResolverMac::GetProxyForURL(const GURL& query_url,
CFTypeRef result = NULL;
CFStreamClientContext context = { 0, &result, NULL, NULL, NULL };
- scoped_cftyperef<CFRunLoopSourceRef> runloop_source(
+ base::mac::ScopedCFTypeRef<CFRunLoopSourceRef> runloop_source(
CFNetworkExecuteProxyAutoConfigurationURL(pac_url_ref.get(),
query_url_ref.get(),
ResultCallback,
@@ -119,7 +119,7 @@ int ProxyResolverMac::GetProxyForURL(const GURL& query_url,
return ERR_FAILED;
}
DCHECK(CFGetTypeID(result) == CFArrayGetTypeID());
- scoped_cftyperef<CFArrayRef> proxy_array_ref((CFArrayRef)result);
+ base::mac::ScopedCFTypeRef<CFArrayRef> proxy_array_ref((CFArrayRef)result);
// This string will be an ordered list of <proxy-uri> entries, separated by
// semi-colons. It is the format that ProxyInfo::UseNamedProxy() expects.
diff --git a/net/socket/ssl_client_socket_mac.cc b/net/socket/ssl_client_socket_mac.cc
index 9a60907..918b6b8 100644
--- a/net/socket/ssl_client_socket_mac.cc
+++ b/net/socket/ssl_client_socket_mac.cc
@@ -9,7 +9,7 @@
#include <sys/socket.h>
#include <sys/types.h>
-#include "base/scoped_cftyperef.h"
+#include "base/mac/scoped_cftyperef.h"
#include "base/singleton.h"
#include "base/string_util.h"
#include "net/base/address_list.h"
@@ -413,7 +413,7 @@ X509Certificate* GetServerCert(SSLContextRef ssl_context) {
// before the certificate message has arrived and been parsed).
if (status != noErr || !certs)
return NULL;
- scoped_cftyperef<CFArrayRef> scoped_certs(certs);
+ base::mac::ScopedCFTypeRef<CFArrayRef> scoped_certs(certs);
DCHECK_GT(CFArrayGetCount(certs), 0);
@@ -1042,7 +1042,7 @@ int SSLClientSocketMac::SetClientCert() {
if (!ssl_config_.send_client_cert || !ssl_config_.client_cert)
return noErr;
- scoped_cftyperef<CFArrayRef> cert_refs(
+ base::mac::ScopedCFTypeRef<CFArrayRef> cert_refs(
ssl_config_.client_cert->CreateClientCertificateChain());
VLOG(1) << "SSLSetCertificate(" << CFArrayGetCount(cert_refs) << " certs)";
OSStatus result = SSLSetCertificate(ssl_context_, cert_refs);
diff --git a/printing/image.cc b/printing/image.cc
index 51b5ea7..27822cf 100644
--- a/printing/image.cc
+++ b/printing/image.cc
@@ -15,7 +15,7 @@
#include "gfx/gdi_util.h" // EMF support
#elif defined(OS_MACOSX)
#include <ApplicationServices/ApplicationServices.h>
-#include "base/scoped_cftyperef.h"
+#include "base/mac/scoped_cftyperef.h"
#endif
namespace {
@@ -243,9 +243,9 @@ bool Image::LoadMetafile(const NativeMetafile& metafile) {
size_t bytes = row_length_ * size_.height();
DCHECK(bytes);
data_.resize(bytes);
- scoped_cftyperef<CGColorSpaceRef> color_space(
+ base::mac::ScopedCFTypeRef<CGColorSpaceRef> color_space(
CGColorSpaceCreateWithName(kCGColorSpaceGenericRGB));
- scoped_cftyperef<CGContextRef> bitmap_context(
+ base::mac::ScopedCFTypeRef<CGContextRef> bitmap_context(
CGBitmapContextCreate(&*data_.begin(), size_.width(), size_.height(),
8, row_length_, color_space,
kCGImageAlphaPremultipliedLast));
diff --git a/printing/pdf_metafile_mac.cc b/printing/pdf_metafile_mac.cc
index 9520369..d09721f 100644
--- a/printing/pdf_metafile_mac.cc
+++ b/printing/pdf_metafile_mac.cc
@@ -6,10 +6,12 @@
#include "base/file_path.h"
#include "base/logging.h"
-#include "base/scoped_cftyperef.h"
+#include "base/mac/scoped_cftyperef.h"
#include "base/sys_string_conversions.h"
#include "gfx/rect.h"
+using base::mac::ScopedCFTypeRef;
+
namespace printing {
PdfMetafile::PdfMetafile()
@@ -26,7 +28,7 @@ CGContextRef PdfMetafile::Init() {
LOG(ERROR) << "Failed to create pdf data for metafile";
return NULL;
}
- scoped_cftyperef<CGDataConsumerRef> pdf_consumer(
+ ScopedCFTypeRef<CGDataConsumerRef> pdf_consumer(
CGDataConsumerCreateWithCFData(pdf_data_));
if (!pdf_consumer.get()) {
LOG(ERROR) << "Failed to create data consumer for metafile";
@@ -202,7 +204,7 @@ bool PdfMetafile::SaveTo(const FilePath& file_path) const {
DCHECK(!context_.get());
std::string path_string = file_path.value();
- scoped_cftyperef<CFURLRef> path_url(CFURLCreateFromFileSystemRepresentation(
+ ScopedCFTypeRef<CFURLRef> path_url(CFURLCreateFromFileSystemRepresentation(
kCFAllocatorDefault, reinterpret_cast<const UInt8*>(path_string.c_str()),
path_string.length(), false));
SInt32 error_code;
@@ -216,7 +218,7 @@ CGPDFDocumentRef PdfMetafile::GetPDFDocument() const {
DCHECK(!context_.get());
if (!pdf_doc_.get()) {
- scoped_cftyperef<CGDataProviderRef> pdf_data_provider(
+ ScopedCFTypeRef<CGDataProviderRef> pdf_data_provider(
CGDataProviderCreateWithCFData(pdf_data_));
pdf_doc_.reset(CGPDFDocumentCreateWithProvider(pdf_data_provider));
}
diff --git a/printing/pdf_metafile_mac.h b/printing/pdf_metafile_mac.h
index 0a0ea3c..8872d99 100644
--- a/printing/pdf_metafile_mac.h
+++ b/printing/pdf_metafile_mac.h
@@ -9,7 +9,7 @@
#include <CoreFoundation/CoreFoundation.h>
#include "base/basictypes.h"
-#include "base/scoped_cftyperef.h"
+#include "base/mac/scoped_cftyperef.h"
namespace gfx {
class Rect;
@@ -90,13 +90,13 @@ class PdfMetafile {
CGPDFDocumentRef GetPDFDocument() const;
// Context for rendering to the pdf.
- scoped_cftyperef<CGContextRef> context_;
+ base::mac::ScopedCFTypeRef<CGContextRef> context_;
// PDF backing store.
- scoped_cftyperef<CFMutableDataRef> pdf_data_;
+ base::mac::ScopedCFTypeRef<CFMutableDataRef> pdf_data_;
// Lazily-created CGPDFDocument representation of pdf_data_.
- mutable scoped_cftyperef<CGPDFDocumentRef> pdf_doc_;
+ mutable base::mac::ScopedCFTypeRef<CGPDFDocumentRef> pdf_doc_;
// Whether or not a page is currently open.
bool page_is_open_;
diff --git a/printing/printed_document_mac.cc b/printing/printed_document_mac.cc
index 8ba8b813..d429109 100644
--- a/printing/printed_document_mac.cc
+++ b/printing/printed_document_mac.cc
@@ -8,7 +8,6 @@
#import <CoreFoundation/CoreFoundation.h>
#include "base/logging.h"
-#include "base/scoped_cftyperef.h"
#include "printing/page_number.h"
#include "printing/printed_page.h"
diff --git a/printing/printing_context_mac.mm b/printing/printing_context_mac.mm
index 50431ae6..a0ca19a 100644
--- a/printing/printing_context_mac.mm
+++ b/printing/printing_context_mac.mm
@@ -8,7 +8,7 @@
#import <AppKit/AppKit.h>
#include "base/logging.h"
-#include "base/scoped_cftyperef.h"
+#include "base/mac/scoped_cftyperef.h"
#include "base/sys_string_conversions.h"
namespace printing {
@@ -123,7 +123,7 @@ PrintingContext::Result PrintingContextMac::NewDocument(
PMPageFormat page_format =
static_cast<PMPageFormat>([print_info_ PMPageFormat]);
- scoped_cftyperef<CFStringRef> job_title(
+ base::mac::ScopedCFTypeRef<CFStringRef> job_title(
base::SysUTF16ToCFStringRef(document_name));
PMPrintSettingsSetJobName(print_settings, job_title.get());
diff --git a/skia/ext/skia_utils_mac.mm b/skia/ext/skia_utils_mac.mm
index a913587..f52709b 100644
--- a/skia/ext/skia_utils_mac.mm
+++ b/skia/ext/skia_utils_mac.mm
@@ -7,7 +7,7 @@
#import <AppKit/AppKit.h>
#include "base/logging.h"
-#include "base/scoped_cftyperef.h"
+#include "base/mac/scoped_cftyperef.h"
#include "base/scoped_ptr.h"
#include "skia/ext/bitmap_platform_device_mac.h"
#include "third_party/skia/include/utils/mac/SkCGUtils.h"
@@ -123,7 +123,7 @@ SkBitmap NSImageToSkBitmap(NSImage* image, NSSize size, bool is_opaque) {
bitmap.setIsOpaque(is_opaque);
- scoped_cftyperef<CGColorSpaceRef> color_space(
+ base::mac::ScopedCFTypeRef<CGColorSpaceRef> color_space(
CGColorSpaceCreateWithName(kCGColorSpaceGenericRGB));
void* data = bitmap.getPixels();
@@ -133,7 +133,7 @@ SkBitmap NSImageToSkBitmap(NSImage* image, NSSize 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)
- scoped_cftyperef<CGContextRef> context(
+ base::mac::ScopedCFTypeRef<CGContextRef> context(
CGBitmapContextCreate(data, size.width, size.height, 8, size.width*4,
color_space,
kCGImageAlphaPremultipliedFirst |
diff --git a/webkit/glue/plugins/pepper_graphics_2d.cc b/webkit/glue/plugins/pepper_graphics_2d.cc
index c122b5c..864b138d 100644
--- a/webkit/glue/plugins/pepper_graphics_2d.cc
+++ b/webkit/glue/plugins/pepper_graphics_2d.cc
@@ -25,7 +25,7 @@
#if defined(OS_MACOSX)
#include "base/mac_util.h"
-#include "base/scoped_cftyperef.h"
+#include "base/mac/scoped_cftyperef.h"
#endif
namespace pepper {
@@ -416,11 +416,11 @@ void Graphics2D::Paint(WebKit::WebCanvas* canvas,
#if defined(OS_MACOSX)
SkAutoLockPixels lock(backing_bitmap);
- scoped_cftyperef<CGDataProviderRef> data_provider(
+ base::mac::ScopedCFTypeRef<CGDataProviderRef> data_provider(
CGDataProviderCreateWithData(
NULL, backing_bitmap.getAddr32(0, 0),
backing_bitmap.rowBytes() * backing_bitmap.height(), NULL));
- scoped_cftyperef<CGImageRef> image(
+ base::mac::ScopedCFTypeRef<CGImageRef> image(
CGImageCreate(
backing_bitmap.width(), backing_bitmap.height(),
8, 32, backing_bitmap.rowBytes(),
diff --git a/webkit/glue/plugins/pepper_plugin_instance.cc b/webkit/glue/plugins/pepper_plugin_instance.cc
index 30c4fb3..8438da6 100644
--- a/webkit/glue/plugins/pepper_plugin_instance.cc
+++ b/webkit/glue/plugins/pepper_plugin_instance.cc
@@ -8,7 +8,7 @@
#include "base/metrics/histogram.h"
#if defined(OS_MACOSX)
#include "base/mac_util.h"
-#include "base/scoped_cftyperef.h"
+#include "base/mac/scoped_cftyperef.h"
#endif
#include "base/scoped_ptr.h"
#include "base/utf_string_conversions.h"
@@ -1027,11 +1027,11 @@ void PluginInstance::DrawSkBitmapToCanvas(
int canvas_height) {
SkAutoLockPixels lock(bitmap);
DCHECK(bitmap.getConfig() == SkBitmap::kARGB_8888_Config);
- scoped_cftyperef<CGDataProviderRef> data_provider(
+ base::mac::ScopedCFTypeRef<CGDataProviderRef> data_provider(
CGDataProviderCreateWithData(
NULL, bitmap.getAddr32(0, 0),
bitmap.rowBytes() * bitmap.height(), NULL));
- scoped_cftyperef<CGImageRef> image(
+ base::mac::ScopedCFTypeRef<CGImageRef> image(
CGImageCreate(
bitmap.width(), bitmap.height(),
8, 32, bitmap.rowBytes(),
diff --git a/webkit/glue/plugins/plugin_lib_mac.mm b/webkit/glue/plugins/plugin_lib_mac.mm
index bd2bcbb..89444c8 100644
--- a/webkit/glue/plugins/plugin_lib_mac.mm
+++ b/webkit/glue/plugins/plugin_lib_mac.mm
@@ -6,8 +6,8 @@
#include "webkit/glue/plugins/plugin_lib.h"
+#include "base/mac/scoped_cftyperef.h"
#include "base/native_library.h"
-#include "base/scoped_cftyperef.h"
#include "base/scoped_ptr.h"
#include "base/string_split.h"
#include "base/string_util.h"
@@ -19,8 +19,9 @@ static const short kSTRTypeDefinitionResourceID = 128;
static const short kSTRTypeDescriptionResourceID = 127;
static const short kSTRPluginDescriptionResourceID = 126;
-namespace NPAPI
-{
+using base::mac::ScopedCFTypeRef;
+
+namespace NPAPI {
namespace {
@@ -161,7 +162,7 @@ bool GetSTRResource(CFBundleRef bundle, short res_id,
pointer += sizeof(short);
for (short i = 0; i < num_strings; ++i) {
// Despite being 8-bits wide, these are legacy encoded. Make a round trip.
- scoped_cftyperef<CFStringRef> str(CFStringCreateWithPascalStringNoCopy(
+ ScopedCFTypeRef<CFStringRef> str(CFStringCreateWithPascalStringNoCopy(
kCFAllocatorDefault,
(unsigned char*)pointer,
GetApplicationTextEncoding(), // is this right?
@@ -309,13 +310,13 @@ bool PluginLib::ReadWebPluginInfo(const FilePath &filename,
//
// Strictly speaking, only STR# 128 is required.
- scoped_cftyperef<CFURLRef> bundle_url(CFURLCreateFromFileSystemRepresentation(
+ ScopedCFTypeRef<CFURLRef> bundle_url(CFURLCreateFromFileSystemRepresentation(
kCFAllocatorDefault, (const UInt8*)filename.value().c_str(),
filename.value().length(), true));
if (!bundle_url)
return false;
- scoped_cftyperef<CFBundleRef> bundle(CFBundleCreate(kCFAllocatorDefault,
- bundle_url.get()));
+ ScopedCFTypeRef<CFBundleRef> bundle(CFBundleCreate(kCFAllocatorDefault,
+ bundle_url.get()));
if (!bundle)
return false;
diff --git a/webkit/glue/webcursor_mac.mm b/webkit/glue/webcursor_mac.mm
index a6e7fc0..6b2729e 100644
--- a/webkit/glue/webcursor_mac.mm
+++ b/webkit/glue/webcursor_mac.mm
@@ -9,7 +9,7 @@
#include "base/logging.h"
#include "base/nsimage_cache_mac.h"
-#include "base/scoped_cftyperef.h"
+#include "base/mac/scoped_cftyperef.h"
#include "third_party/WebKit/WebKit/chromium/public/WebCursorInfo.h"
#include "third_party/WebKit/WebKit/chromium/public/WebImage.h"
#include "third_party/WebKit/WebKit/chromium/public/WebSize.h"
@@ -33,11 +33,12 @@ NSCursor* LoadCursor(const char* name, int x, int y) {
CGImageRef CreateCGImageFromCustomData(const std::vector<char>& custom_data,
const gfx::Size& custom_size) {
- scoped_cftyperef<CGColorSpaceRef> cg_color(CGColorSpaceCreateDeviceRGB());
+ base::mac::ScopedCFTypeRef<CGColorSpaceRef> cg_color(
+ CGColorSpaceCreateDeviceRGB());
// This is safe since we're not going to draw into the context we're creating.
void* data = const_cast<char*>(&custom_data[0]);
// The settings here match SetCustomData() below; keep in sync.
- scoped_cftyperef<CGContextRef> context(
+ base::mac::ScopedCFTypeRef<CGContextRef> context(
CGBitmapContextCreate(data,
custom_size.width(),
custom_size.height(),
@@ -56,7 +57,7 @@ NSCursor* CreateCustomCursor(const std::vector<char>& custom_data,
// results in an infinite loop. This CHECK ensures that we crash instead.
CHECK(!custom_data.empty());
- scoped_cftyperef<CGImageRef> cg_image(
+ base::mac::ScopedCFTypeRef<CGImageRef> cg_image(
CreateCGImageFromCustomData(custom_data, custom_size));
NSBitmapImageRep* ns_bitmap =
@@ -258,7 +259,7 @@ void WebCursor::InitFromCursor(const Cursor* cursor) {
}
}
- scoped_cftyperef<CGImageRef> cg_image(
+ base::mac::ScopedCFTypeRef<CGImageRef> cg_image(
CreateCGImageFromCustomData(raw_data, custom_size));
WebKit::WebCursorInfo cursor_info;
@@ -322,7 +323,7 @@ void WebCursor::SetCustomData(const WebImage& image) {
if (image.isNull())
return;
- scoped_cftyperef<CGColorSpaceRef> cg_color(
+ base::mac::ScopedCFTypeRef<CGColorSpaceRef> cg_color(
CGColorSpaceCreateDeviceRGB());
const WebSize& image_dimensions = image.size();
@@ -337,7 +338,7 @@ void WebCursor::SetCustomData(const WebImage& image) {
// These settings match up with the code in CreateCustomCursor() above; keep
// them in sync.
// TODO(avi): test to ensure that the flags here are correct for RGBA
- scoped_cftyperef<CGContextRef> context(
+ base::mac::ScopedCFTypeRef<CGContextRef> context(
CGBitmapContextCreate(&custom_data_[0],
image_width,
image_height,
@@ -354,7 +355,7 @@ void WebCursor::ImageFromCustomData(WebImage* image) const {
if (custom_data_.empty())
return;
- scoped_cftyperef<CGImageRef> cg_image(
+ base::mac::ScopedCFTypeRef<CGImageRef> cg_image(
CreateCGImageFromCustomData(custom_data_, custom_size_));
*image = cg_image.get();
}