summaryrefslogtreecommitdiffstats
path: root/base/scoped_clipboard_writer.cc
diff options
context:
space:
mode:
authorestade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-10 02:00:50 +0000
committerestade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-10 02:00:50 +0000
commitbe623b0f2ec23b3032fc6c8b61d6062accf51bb7 (patch)
tree2ffa24729ec7c5a0c1d9d92d200ec66fa675feef /base/scoped_clipboard_writer.cc
parent956d5aecbbf21ab3f84c87a8aec7d3a47eefbd34 (diff)
downloadchromium_src-be623b0f2ec23b3032fc6c8b61d6062accf51bb7.zip
chromium_src-be623b0f2ec23b3032fc6c8b61d6062accf51bb7.tar.gz
chromium_src-be623b0f2ec23b3032fc6c8b61d6062accf51bb7.tar.bz2
Clipboard:
- Move link construction logic to scoped_clipboard_writer.cc - Make callers use EscapeForHTML on the anchor text - Make WriteHyperlink just write html, and not a bookmark as well (only affects one caller, which I updated) - implement WriteBookmark for gtk BUG=18034,18035 Review URL: http://codereview.chromium.org/194052 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@25833 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/scoped_clipboard_writer.cc')
-rw-r--r--base/scoped_clipboard_writer.cc18
1 files changed, 9 insertions, 9 deletions
diff --git a/base/scoped_clipboard_writer.cc b/base/scoped_clipboard_writer.cc
index 1e9e846..dff3321 100644
--- a/base/scoped_clipboard_writer.cc
+++ b/base/scoped_clipboard_writer.cc
@@ -67,18 +67,18 @@ void ScopedClipboardWriter::WriteBookmark(const string16& bookmark_title,
objects_[Clipboard::CBF_BOOKMARK] = parameters;
}
-void ScopedClipboardWriter::WriteHyperlink(const string16& link_text,
+void ScopedClipboardWriter::WriteHyperlink(const std::string& anchor_text,
const std::string& url) {
- if (link_text.empty() || url.empty())
+ if (anchor_text.empty() || url.empty())
return;
- std::string utf8_markup = UTF16ToUTF8(link_text);
-
- Clipboard::ObjectMapParams parameters;
- parameters.push_back(Clipboard::ObjectMapParam(utf8_markup.begin(),
- utf8_markup.end()));
- parameters.push_back(Clipboard::ObjectMapParam(url.begin(), url.end()));
- objects_[Clipboard::CBF_LINK] = parameters;
+ // Construct the hyperlink.
+ std::string html("<a href=\"");
+ html.append(url);
+ html.append("\">");
+ html.append(anchor_text);
+ html.append("</a>");
+ WriteHTML(UTF8ToUTF16(html), std::string());
}
void ScopedClipboardWriter::WriteFile(const FilePath& file) {