Index: base/mac/foundation_util.mm |
diff --git a/base/mac/foundation_util.mm b/base/mac/foundation_util.mm |
index 6ae5df3389977a2268567f062d540d5d11418434..92ae6633f56acfe9898f9d61f472af6424e632b8 100644 |
--- a/base/mac/foundation_util.mm |
+++ b/base/mac/foundation_util.mm |
@@ -18,6 +18,10 @@ |
#include "build/build_config.h" |
#if !defined(OS_IOS) |
+#import <AppKit/AppKit.h> |
+#endif |
+ |
+#if !defined(OS_IOS) |
extern "C" { |
CFTypeID SecACLGetTypeID(); |
CFTypeID SecTrustedApplicationGetTypeID(); |
@@ -316,7 +320,7 @@ NSFont* CFToNSCast(CTFontRef cf_val) { |
DCHECK(!cf_val || |
CTFontGetTypeID() == CFGetTypeID(cf_val) || |
(_CFIsObjC(CTFontGetTypeID(), cf_val) && |
- [ns_val isKindOfClass:NSClassFromString(@"NSFont")])); |
+ [ns_val isKindOfClass:[NSFont class]])); |
Nico
2016/04/29 02:50:57
Splitting these NSClassFromString("foo") -> [foo c
tapted
2016/04/29 03:17:45
Done.
|
return ns_val; |
} |
@@ -324,7 +328,7 @@ CTFontRef NSToCFCast(NSFont* ns_val) { |
CTFontRef cf_val = reinterpret_cast<CTFontRef>(ns_val); |
DCHECK(!cf_val || |
CTFontGetTypeID() == CFGetTypeID(cf_val) || |
- [ns_val isKindOfClass:NSClassFromString(@"NSFont")]); |
+ [ns_val isKindOfClass:[NSFont class]]); |
return cf_val; |
} |
#endif |
@@ -342,13 +346,6 @@ CFCast<TypeCF##Ref>(const CFTypeRef& cf_val) { \ |
return (TypeCF##Ref)(cf_val); \ |
} \ |
return NULL; \ |
-} \ |
-\ |
-template<> TypeCF##Ref \ |
-CFCastStrict<TypeCF##Ref>(const CFTypeRef& cf_val) { \ |
- TypeCF##Ref rv = CFCast<TypeCF##Ref>(cf_val); \ |
- DCHECK(cf_val == NULL || rv); \ |
- return rv; \ |
} |
CF_CAST_DEFN(CFArray); |
@@ -388,18 +385,11 @@ CFCast<CTFontRef>(const CFTypeRef& cf_val) { |
return NULL; |
id<NSObject> ns_val = reinterpret_cast<id>(const_cast<void*>(cf_val)); |
- if ([ns_val isKindOfClass:NSClassFromString(@"NSFont")]) { |
+ if ([ns_val isKindOfClass:[NSFont class]]) { |
return (CTFontRef)(cf_val); |
} |
return NULL; |
} |
- |
-template<> CTFontRef |
-CFCastStrict<CTFontRef>(const CFTypeRef& cf_val) { |
- CTFontRef rv = CFCast<CTFontRef>(cf_val); |
- DCHECK(cf_val == NULL || rv); |
- return rv; |
-} |
#endif |
#if !defined(OS_IOS) |