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
diff --git a/chrome/browser/tab_contents/tab_contents.cc b/chrome/browser/tab_contents/tab_contents.cc
index 4799e6e..300be68d 100644
--- a/chrome/browser/tab_contents/tab_contents.cc
+++ b/chrome/browser/tab_contents/tab_contents.cc
@@ -58,6 +58,7 @@
 #include "chrome/common/chrome_switches.h"
 #include "chrome/common/extensions/extension_action.h"
 #include "chrome/common/notification_service.h"
+#include "chrome/common/platform_util.h"
 #include "chrome/common/pref_names.h"
 #include "chrome/common/pref_service.h"
 #include "chrome/common/render_messages.h"
@@ -1100,6 +1101,14 @@
   return save_package_->Init();
 }
 
+void TabContents::EmailPageLocation() {
+  std::string title = EscapeQueryParamValue(UTF16ToUTF8(GetTitle()), false);
+  std::string page_url = EscapeQueryParamValue(GetURL().spec(), false);
+  std::string mailto = std::string("mailto:?subject=Fwd:%20") +
+      title + "&body=%0A%0A" + page_url;
+  platform_util::OpenExternal(GURL(mailto));
+}
+
 void TabContents::PrintPreview() {
   // We don't show the print preview yet, only the print dialog.
   PrintNow();