#include "base/files/file_path.h"
#include "base/files/file_util.h"
#include "base/logging.h"
+#include "base/mac/foundation_util.h"
#include "base/mac/mac_logging.h"
#include "base/mac/scoped_aedesc.h"
#include "base/strings/stringprintf.h"
// NSWorkspace#openURLs.
std::string OpenURL(NSURL* ns_url, bool activate) {
CFURLRef openingApp = nullptr;
- OSStatus status = LSGetApplicationForURL((CFURLRef)ns_url,
- kLSRolesAll,
- nullptr,
- &openingApp);
+ OSStatus status = LSGetApplicationForURL(base::mac::NSToCFCast(ns_url),
+ kLSRolesAll,
+ nullptr,
+ &openingApp);
if (status != noErr)
return MessageForOSStatus(status, "Failed to open");
// Add the single path to the file list. C-style cast to avoid both a
// static_cast and a const_cast to get across the toll-free bridge.
- CFURLRef pathURLRef = (CFURLRef)[NSURL fileURLWithPath:path_string];
+ CFURLRef pathURLRef = base::mac::NSToCFCast(
+ [NSURL fileURLWithPath:path_string]);
FSRef pathRef;
if (CFURLGetFSRef(pathURLRef, &pathRef)) {
status = AEPutPtr(fileList.OutPointer(), // theAEDescList