This source file includes following definitions.
- URLToMarkup
- URLToImageMarkup
#include "content/renderer/clipboard_utils.h"
#include "base/strings/utf_string_conversions.h"
#include "net/base/escape.h"
#include "third_party/WebKit/public/platform/WebString.h"
#include "third_party/WebKit/public/platform/WebURL.h"
namespace content {
std::string URLToMarkup(const blink::WebURL& url,
const blink::WebString& title) {
std::string markup("<a href=\"");
markup.append(url.spec());
markup.append("\">");
markup.append(net::EscapeForHTML(base::UTF16ToUTF8(title)));
markup.append("</a>");
return markup;
}
std::string URLToImageMarkup(const blink::WebURL& url,
const blink::WebString& title) {
std::string markup("<img src=\"");
markup.append(net::EscapeForHTML(url.spec()));
markup.append("\"");
if (!title.isEmpty()) {
markup.append(" alt=\"");
markup.append(net::EscapeForHTML(base::UTF16ToUTF8(title)));
markup.append("\"");
}
markup.append("/>");
return markup;
}
}