Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2136)

Unified Diff: base/mac/foundation_util.h

Issue 8769016: Use the new base::mac::GetValueFromDictionary<>() method. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: update example comment Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | base/mac/foundation_util.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/mac/foundation_util.h
diff --git a/base/mac/foundation_util.h b/base/mac/foundation_util.h
index a36ad755231c2927e94395b1a139b1a0c0de5b03..1a874706357c853a14cdc9a9bca8649ee67f3e8b 100644
--- a/base/mac/foundation_util.h
+++ b/base/mac/foundation_util.h
@@ -113,20 +113,6 @@ TYPE_NAME_FOR_CF_TYPE_DECL(CFString);
#undef TYPE_NAME_FOR_CF_TYPE_DECL
-// Helper function for GetValueFromDictionary to create the error message
-// that appears when a type mismatch is encountered.
-std::string GetValueFromDictionaryErrorMessage(
- CFStringRef key, const std::string& expected_type, CFTypeRef value);
-
-// Utility function to pull out a value from a dictionary, check its type, and
-// return it. Returns NULL if the key is not present or of the wrong type.
-// This is now deprecated in favor of the two-argument form below.
-// TODO(kushi.p): Remove this function once all cases of it have been
-// replaced with the two-argument form below. See: crbug.com/104200.
-BASE_EXPORT CFTypeRef GetValueFromDictionary(CFDictionaryRef dict,
- CFStringRef key,
- CFTypeID expected_type);
-
// Retain/release calls for memory management in C++.
BASE_EXPORT void NSObjectRetain(void* obj);
BASE_EXPORT void NSObjectRelease(void* obj);
@@ -243,10 +229,8 @@ namespace mac {
// CFNumberRef some_number = base::mac::CFCast<CFNumberRef>(
// CFArrayGetValueAtIndex(array, index));
//
-// CFStringRef some_string = base::mac::CFCastStrict<CFStringRef>(
-// base::mac::GetValueFromDictionary(some_dict,
-// CFSTR("a_key"),
-// CFStringGetTypeID()));
+// CFTypeRef hello = CFSTR("hello world");
+// CFStringRef some_string = base::mac::CFCastStrict<CFStringRef>(hello);
BASE_EXPORT template<typename T>
T CFCast(const CFTypeRef& cf_val);
@@ -294,8 +278,13 @@ T* ObjCCastStrict(id objc_val) {
#endif // defined(__OBJC__)
+// Helper function for GetValueFromDictionary to create the error message
+// that appears when a type mismatch is encountered.
+std::string GetValueFromDictionaryErrorMessage(
+ CFStringRef key, const std::string& expected_type, CFTypeRef value);
+
// Utility function to pull out a value from a dictionary, check its type, and
-// return it. Returns NULL if the key is not present or of the wrong type.
+// return it. Returns NULL if the key is not present or of the wrong type.
BASE_EXPORT template<typename T>
T GetValueFromDictionary(CFDictionaryRef dict, CFStringRef key) {
CFTypeRef value = CFDictionaryGetValue(dict, key);
« no previous file with comments | « no previous file | base/mac/foundation_util.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698