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

Side by Side Diff: base/mac/mac_util.mm

Issue 6594096: Clean up CF To NS Casts and make them slightly safer (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 9 months 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/mac_util.h" 5 #include "base/mac/mac_util.h"
6 6
7 #import <Cocoa/Cocoa.h> 7 #import <Cocoa/Cocoa.h>
8 8
9 #include "base/file_path.h" 9 #include "base/file_path.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after
475 ScopedCFTypeRef<LSSharedFileListItemRef> item(GetLoginItemForApp()); 475 ScopedCFTypeRef<LSSharedFileListItemRef> item(GetLoginItemForApp());
476 if (!item.get()) { 476 if (!item.get()) {
477 LOG(ERROR) << "Process launched at Login but can't access Login Item List."; 477 LOG(ERROR) << "Process launched at Login but can't access Login Item List.";
478 return false; 478 return false;
479 } 479 }
480 return IsHiddenLoginItem(item); 480 return IsHiddenLoginItem(item);
481 } 481 }
482 482
483 } // namespace mac 483 } // namespace mac
484 } // namespace base 484 } // namespace base
485
486 std::ostream& operator<<(std::ostream& o, const CFStringRef string) {
487 return o << base::SysCFStringRefToUTF8(string);
488 }
489
490 std::ostream& operator<<(std::ostream& o, const CFErrorRef err) {
491 base::mac::ScopedCFTypeRef<CFStringRef> desc(CFErrorCopyDescription(err));
492 base::mac::ScopedCFTypeRef<CFDictionaryRef> user_info(
493 CFErrorCopyUserInfo(err));
494 CFStringRef errorDesc = NULL;
495 if (user_info.get()) {
496 errorDesc = reinterpret_cast<CFStringRef>(
497 CFDictionaryGetValue(user_info.get(), kCFErrorDescriptionKey));
498 }
499 o << "Code: " << CFErrorGetCode(err)
500 << " Domain: " << CFErrorGetDomain(err)
501 << " Desc: " << desc.get();
502 if(errorDesc) {
503 o << "(" << errorDesc << ")";
504 }
505 return o;
506 }
507
OLDNEW
« base/mac/mac_util.h ('K') | « base/mac/mac_util.h ('k') | chrome/app/chrome_main.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698