From 1805b51645d51ee08205aa8e5cc3c72404ab8960 Mon Sep 17 00:00:00 2001 From: "stuartmorgan@chromium.org" Date: Wed, 10 Jun 2009 16:12:48 +0000 Subject: Implement OpenItem on the Mac, and have the download manager call it when clicking a file link. BUG=13552 TEST=Clicking a file link in the download manager should open the file. Review URL: http://codereview.chromium.org/119398 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@18061 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/browser/download/download_file.cc | 7 ++++++- chrome/common/platform_util_mac.mm | 3 ++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/chrome/browser/download/download_file.cc b/chrome/browser/download/download_file.cc index 7be3411..8731b53 100644 --- a/chrome/browser/download/download_file.cc +++ b/chrome/browser/download/download_file.cc @@ -544,8 +544,13 @@ void DownloadFileManager::OnOpenDownloadInShell(const FilePath& full_path, } else { win_util::OpenItemViaShell(full_path); } +#elif defined(OS_MACOSX) + // Quarantine takes care of asking the user about dangerous files, so we can + // just open it. + platform_util::OpenItem(full_path); #else - // TODO(port) implement me. + // TODO(port) implement me. (Does Linux need to use a "safe" open, or can it + // just share the Mac call to platform_util?) NOTIMPLEMENTED(); #endif } diff --git a/chrome/common/platform_util_mac.mm b/chrome/common/platform_util_mac.mm index c3a4ab7..41ca53b 100644 --- a/chrome/common/platform_util_mac.mm +++ b/chrome/common/platform_util_mac.mm @@ -22,7 +22,8 @@ void ShowItemInFolder(const FilePath& full_path) { } void OpenItem(const FilePath& full_path) { - NOTIMPLEMENTED(); + NSString* path_string = base::SysUTF8ToNSString(full_path.value()); + [[NSWorkspace sharedWorkspace] openFile:path_string]; } gfx::NativeWindow GetTopLevel(gfx::NativeView view) { -- cgit v1.1