diff options
author | snej@chromium.org <snej@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-12-03 23:06:51 +0000 |
---|---|---|
committer | snej@chromium.org <snej@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-12-03 23:06:51 +0000 |
commit | 89d6e6e3456280a12b4b806de8cbe3d049476df6 (patch) | |
tree | fe449cc80e3d1780c2db174d61836de639db0501 /chrome/common/platform_util_mac.mm | |
parent | 758338d7593c0b403ffde83b5490c9a19e47ddaa (diff) | |
download | chromium_src-89d6e6e3456280a12b4b806de8cbe3d049476df6.zip chromium_src-89d6e6e3456280a12b4b806de8cbe3d049476df6.tar.gz chromium_src-89d6e6e3456280a12b4b806de8cbe3d049476df6.tar.bz2 |
Implement "Email Link To Page" menu command.
This menu item only exists in the Mac build, but the code is cross-platform so it could be hooked up on other platforms as well, if desired.
It works by generating a URL of the form
mailto:?subject=Fwd:%20PAGETITLE&body=%0A%0APAGEURL
and telling platform_utils to open it.
This is my first patch involving command handling; I've tried to follow the way similar menu commands
like Print are implemented, but feel free to tell me if there are better ways.
I didn't find any place for unit tests for TabContents; if this needs tests, let me know where they should go.
BUG=29232
TEST=none
Review URL: http://codereview.chromium.org/466019
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@33746 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common/platform_util_mac.mm')
-rw-r--r-- | chrome/common/platform_util_mac.mm | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/chrome/common/platform_util_mac.mm b/chrome/common/platform_util_mac.mm index cf858eb..2c9883a 100644 --- a/chrome/common/platform_util_mac.mm +++ b/chrome/common/platform_util_mac.mm @@ -20,21 +20,24 @@ namespace platform_util { void ShowItemInFolder(const FilePath& full_path) { DCHECK_EQ([NSThread currentThread], [NSThread mainThread]); NSString* path_string = base::SysUTF8ToNSString(full_path.value()); - [[NSWorkspace sharedWorkspace] selectFile:path_string - inFileViewerRootedAtPath:nil]; + if (!path_string || ![[NSWorkspace sharedWorkspace] selectFile:path_string + inFileViewerRootedAtPath:nil]) + LOG(WARNING) << "NSWorkspace failed to select file " << full_path.value(); } void OpenItem(const FilePath& full_path) { DCHECK_EQ([NSThread currentThread], [NSThread mainThread]); NSString* path_string = base::SysUTF8ToNSString(full_path.value()); - [[NSWorkspace sharedWorkspace] openFile:path_string]; + if (!path_string || ![[NSWorkspace sharedWorkspace] openFile:path_string]) + LOG(WARNING) << "NSWorkspace failed to open file " << full_path.value(); } void OpenExternal(const GURL& url) { DCHECK_EQ([NSThread currentThread], [NSThread mainThread]); NSString* url_string = base::SysUTF8ToNSString(url.spec()); NSURL* ns_url = [NSURL URLWithString:url_string]; - [[NSWorkspace sharedWorkspace] openURL:ns_url]; + if (!ns_url || ![[NSWorkspace sharedWorkspace] openURL:ns_url]) + LOG(WARNING) << "NSWorkspace failed to open URL " << url; } gfx::NativeWindow GetTopLevel(gfx::NativeView view) { |