OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "base/mac/foundation_util.h" | 5 #include "base/mac/foundation_util.h" |
6 | 6 |
7 #include <stdlib.h> | 7 #include <stdlib.h> |
8 #include <string.h> | 8 #include <string.h> |
9 | 9 |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
376 } | 376 } |
377 | 377 |
378 } // namespace mac | 378 } // namespace mac |
379 } // namespace base | 379 } // namespace base |
380 | 380 |
381 std::ostream& operator<<(std::ostream& o, const CFStringRef string) { | 381 std::ostream& operator<<(std::ostream& o, const CFStringRef string) { |
382 return o << base::SysCFStringRefToUTF8(string); | 382 return o << base::SysCFStringRefToUTF8(string); |
383 } | 383 } |
384 | 384 |
385 std::ostream& operator<<(std::ostream& o, const CFErrorRef err) { | 385 std::ostream& operator<<(std::ostream& o, const CFErrorRef err) { |
386 base::mac::ScopedCFTypeRef<CFStringRef> desc(CFErrorCopyDescription(err)); | 386 base::ScopedCFTypeRef<CFStringRef> desc(CFErrorCopyDescription(err)); |
387 base::mac::ScopedCFTypeRef<CFDictionaryRef> user_info( | 387 base::ScopedCFTypeRef<CFDictionaryRef> user_info(CFErrorCopyUserInfo(err)); |
388 CFErrorCopyUserInfo(err)); | |
389 CFStringRef errorDesc = NULL; | 388 CFStringRef errorDesc = NULL; |
390 if (user_info.get()) { | 389 if (user_info.get()) { |
391 errorDesc = reinterpret_cast<CFStringRef>( | 390 errorDesc = reinterpret_cast<CFStringRef>( |
392 CFDictionaryGetValue(user_info.get(), kCFErrorDescriptionKey)); | 391 CFDictionaryGetValue(user_info.get(), kCFErrorDescriptionKey)); |
393 } | 392 } |
394 o << "Code: " << CFErrorGetCode(err) | 393 o << "Code: " << CFErrorGetCode(err) |
395 << " Domain: " << CFErrorGetDomain(err) | 394 << " Domain: " << CFErrorGetDomain(err) |
396 << " Desc: " << desc.get(); | 395 << " Desc: " << desc.get(); |
397 if(errorDesc) { | 396 if(errorDesc) { |
398 o << "(" << errorDesc << ")"; | 397 o << "(" << errorDesc << ")"; |
399 } | 398 } |
400 return o; | 399 return o; |
401 } | 400 } |
OLD | NEW |