From 89d6e6e3456280a12b4b806de8cbe3d049476df6 Mon Sep 17 00:00:00 2001 From: "snej@chromium.org" Date: Thu, 3 Dec 2009 23:06:51 +0000 Subject: 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 --- net/base/escape.cc | 4 ++++ net/base/escape.h | 2 ++ 2 files changed, 6 insertions(+) (limited to 'net/base') diff --git a/net/base/escape.cc b/net/base/escape.cc index db03fa8..184e93c 100644 --- a/net/base/escape.cc +++ b/net/base/escape.cc @@ -186,6 +186,10 @@ static const Charmap kQueryCharmap( 0xffffffffL, 0xfc00987dL, 0x78000001L, 0xb8000001L, 0xffffffffL, 0xffffffffL, 0xffffffffL, 0xffffffffL); +std::string EscapeQueryParamValue(const std::string& text, bool use_plus) { + return Escape(text, kQueryCharmap, use_plus); +} + std::string EscapeQueryParamValue(const std::string& text) { return Escape(text, kQueryCharmap, true); } diff --git a/net/base/escape.h b/net/base/escape.h index 5476d9c..679e613 100644 --- a/net/base/escape.h +++ b/net/base/escape.h @@ -110,6 +110,7 @@ string16 UnescapeAndDecodeUTF8URLComponent(const std::string& text, // Escapes characters in text suitable for use as a query parameter value. // We %XX everything except alphanumerics and -_.!~*'() +// Spaces change to "+" unless you pass usePlus=false. // This is basically the same as encodeURIComponent in javascript. // For the string16 version, we do a conversion to charset before encoding the // string. If the charset doesn't exist, we return false. @@ -117,6 +118,7 @@ string16 UnescapeAndDecodeUTF8URLComponent(const std::string& text, // TODO(brettw) bug 1201094: This function should be removed. See the bug for // why and what callers should do instead. std::string EscapeQueryParamValue(const std::string& text); +std::string EscapeQueryParamValue(const std::string& text, bool use_plus); bool EscapeQueryParamValue(const string16& text, const char* codepage, string16* escaped); -- cgit v1.1